Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.xmlbind
Class RemappingContentHandler

    java.lang.Object
      umontreal.iro.lecuyer.xmlbind.RemappingContentHandler

All Implemented Interfaces:
  ContentHandler

    public class RemappingContentHandler

extends Object
implements ContentHandler

SAX content handler remapping namespace prefixes. Some tools produces XML without giving control over the prefixes associated with namespace URIs. For example, the JAXB marshaller can output XML, but it generates prefixes such as `ns2`, `ns3`, etc. This content handler can be used to filter SAX events generated by such processors to map namespace URIs to user-defined prefixes. One simply provides a map associating prefixes with URIs along with a content handler filtered events are sent to. This content handler is used by `JAXBParamsConverter` to implement namsepace prefix mapping independently of the JAXB provider.

Constructor Summary
`RemappingContentHandler(Map<String,String> prefixToUri, ContentHandler targetHandler)` Constructs a new remapping content handler sending events to the given target handler, and using the supplied prefix-to-URI map.

Method Summary
`void` | `characters(char[] ch, int start, int length)`
`void` | `endDocument()`
`void` | `endElement(String uri, String localName, String qName)`
`void` | `endPrefixMapping(String prefix)`
`ContentHandler` | `getTargetHandler()` Returns the target content handler.
`void` | `ignorableWhitespace(char[] ch, int start, int length)`
`void` | `processingInstruction(String target, String data)`
`void` | `setDocumentLocator(Locator locator)`
`void` | `setTargetHandler(ContentHandler targetHandler)` Sets the target content handler.
`void` | `skippedEntity(String name)`
`void` | `startDocument()`
`void` | `startElement(String uri, String localName, String qName, Attributes atts)`
`void` | `startPrefixMapping(String prefix, String uri)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RemappingContentHandler

    public RemappingContentHandler(Map<String,String> prefixToUri,
                                   ContentHandler targetHandler)

  Constructs a new remapping content handler sending events to the given target handler, and using the supplied prefix-to-URI map.

  Parameters:
    `targetHandler` - the target handler to send events to.
    `prefixToUri` - the prefix-to-URI mapping.
  Throws:
    `NullPointerException` - if the content handler is `null`.
    `IllegalArgumentException` - if one URI is mapped to multiple prefixes.

Method Detail

### getTargetHandler

    public ContentHandler getTargetHandler()

  Returns the target content handler.

  Returns:
    the target content handler.

### setTargetHandler

    public void setTargetHandler(ContentHandler targetHandler)

  Sets the target content handler.

  Parameters:
    `targetHandler` - the new target handler.

### startDocument

    public void startDocument()
                       throws SAXException

  Specified by:
    `startDocument` in interface `ContentHandler`
  Throws:
    `SAXException`

### endDocument

    public void endDocument()
                     throws SAXException

  Specified by:
    `endDocument` in interface `ContentHandler`
  Throws:
    `SAXException`

### startElement

    public void startElement(String uri,
                             String localName,
                             String qName,
                             Attributes atts)
                      throws SAXException

  Specified by:
    `startElement` in interface `ContentHandler`
  Throws:
    `SAXException`

### startPrefixMapping

    public void startPrefixMapping(String prefix,
                                   String uri)
                            throws SAXException

  Specified by:
    `startPrefixMapping` in interface `ContentHandler`
  Throws:
    `SAXException`

### endElement

    public void endElement(String uri,
                           String localName,
                           String qName)
                    throws SAXException

  Specified by:
    `endElement` in interface `ContentHandler`
  Throws:
    `SAXException`

### endPrefixMapping

    public void endPrefixMapping(String prefix)
                          throws SAXException

  Specified by:
    `endPrefixMapping` in interface `ContentHandler`
  Throws:
    `SAXException`

### characters

    public void characters(char[] ch,
                           int start,
                           int length)
                    throws SAXException

  Specified by:
    `characters` in interface `ContentHandler`
  Throws:
    `SAXException`

### ignorableWhitespace

    public void ignorableWhitespace(char[] ch,
                                    int start,
                                    int length)
                             throws SAXException

  Specified by:
    `ignorableWhitespace` in interface `ContentHandler`
  Throws:
    `SAXException`

### processingInstruction

    public void processingInstruction(String target,
                                      String data)
                               throws SAXException

  Specified by:
    `processingInstruction` in interface `ContentHandler`
  Throws:
    `SAXException`

### setDocumentLocator

    public void setDocumentLocator(Locator locator)

  Specified by:
    `setDocumentLocator` in interface `ContentHandler`

### skippedEntity

    public void skippedEntity(String name)
                       throws SAXException

  Specified by:
    `skippedEntity` in interface `ContentHandler`
  Throws:
    `SAXException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

To submit a bug or ask questions, send an e-mail to Richard Simard.