Package org.xwiki.xml
Class Sax2Dom
- java.lang.Object
-
- org.xwiki.xml.Sax2Dom
-
- All Implemented Interfaces:
ContentHandler
,LexicalHandler
public class Sax2Dom extends Object implements ContentHandler, LexicalHandler
Convert SAX events into a Document.- Version:
- $Id: 3bf0cd0923788deebcf403fe1320f4567480923b $
-
-
Field Summary
Fields Modifier and Type Field Description static String
XML_PREFIX
"xml" namespace prefix.static String
XMLNS_PREFIX
"xmlns" namespace prefix.static String
XMLNS_STRING
"xmlns" namespace prefix with :.static String
XMLNS_URI
"xmlns" URL.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int length)
void
comment(char[] ch, int start, int length)
void
endCDATA()
void
endDocument()
void
endDTD()
void
endElement(String namespace, String localName, String qName)
void
endEntity(String name)
void
endPrefixMapping(String prefix)
Element
getRootElement()
Node
getRootNode()
void
ignorableWhitespace(char[] ch, int start, int length)
void
processingInstruction(String target, String data)
void
setDocumentLocator(Locator locator)
void
skippedEntity(String name)
void
startCDATA()
void
startDocument()
void
startDTD(String name, String publicId, String systemId)
void
startElement(String namespace, String localName, String qName, Attributes atts)
void
startEntity(String name)
void
startPrefixMapping(String prefix, String uri)
-
-
-
Field Detail
-
XML_PREFIX
public static final String XML_PREFIX
"xml" namespace prefix.- See Also:
- Constant Field Values
-
XMLNS_PREFIX
public static final String XMLNS_PREFIX
"xmlns" namespace prefix.- See Also:
- Constant Field Values
-
XMLNS_STRING
public static final String XMLNS_STRING
"xmlns" namespace prefix with :.- See Also:
- Constant Field Values
-
XMLNS_URI
public static final String XMLNS_URI
"xmlns" URL.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Sax2Dom
public Sax2Dom() throws ParserConfigurationException
Default constructor.- Throws:
ParserConfigurationException
- failed to create a newDocument
-
Sax2Dom
public Sax2Dom(Node root) throws ParserConfigurationException
- Parameters:
root
- the root node to fill with SAX events- Throws:
ParserConfigurationException
- failed to create a newDocument
-
-
Method Detail
-
characters
public void characters(char[] ch, int start, int length)
- Specified by:
characters
in interfaceContentHandler
-
startDocument
public void startDocument()
- Specified by:
startDocument
in interfaceContentHandler
-
endDocument
public void endDocument()
- Specified by:
endDocument
in interfaceContentHandler
-
startElement
public void startElement(String namespace, String localName, String qName, Attributes atts)
- Specified by:
startElement
in interfaceContentHandler
-
endElement
public void endElement(String namespace, String localName, String qName)
- Specified by:
endElement
in interfaceContentHandler
-
startPrefixMapping
public void startPrefixMapping(String prefix, String uri)
- Specified by:
startPrefixMapping
in interfaceContentHandler
-
endPrefixMapping
public void endPrefixMapping(String prefix)
- Specified by:
endPrefixMapping
in interfaceContentHandler
-
ignorableWhitespace
public void ignorableWhitespace(char[] ch, int start, int length)
- Specified by:
ignorableWhitespace
in interfaceContentHandler
-
processingInstruction
public void processingInstruction(String target, String data)
- Specified by:
processingInstruction
in interfaceContentHandler
-
setDocumentLocator
public void setDocumentLocator(Locator locator)
- Specified by:
setDocumentLocator
in interfaceContentHandler
-
skippedEntity
public void skippedEntity(String name)
- Specified by:
skippedEntity
in interfaceContentHandler
-
comment
public void comment(char[] ch, int start, int length)
- Specified by:
comment
in interfaceLexicalHandler
-
startCDATA
public void startCDATA()
- Specified by:
startCDATA
in interfaceLexicalHandler
-
endCDATA
public void endCDATA()
- Specified by:
endCDATA
in interfaceLexicalHandler
-
startEntity
public void startEntity(String name)
- Specified by:
startEntity
in interfaceLexicalHandler
-
endEntity
public void endEntity(String name)
- Specified by:
endEntity
in interfaceLexicalHandler
-
startDTD
public void startDTD(String name, String publicId, String systemId) throws SAXException
- Specified by:
startDTD
in interfaceLexicalHandler
- Throws:
SAXException
-
endDTD
public void endDTD()
- Specified by:
endDTD
in interfaceLexicalHandler
-
-