public class SAXOMBuilder extends DefaultHandler implements LexicalHandler, DeclHandler, OMXMLParserWrapper
Constructor and Description |
---|
SAXOMBuilder()
Deprecated.
Instead of creating an instance of this class directly, create a
SAXSource and use
OMXMLBuilderFactory.createOMBuilder(SAXSource, boolean) . |
SAXOMBuilder(OMFactory factory)
Deprecated.
Instead of creating an instance of this class directly, create a
SAXSource and use
OMXMLBuilderFactory.createOMBuilder(OMFactory, SAXSource, boolean) . |
SAXOMBuilder(OMFactory factory,
SAXSource source,
boolean expandEntityReferences)
For internal use only.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeDecl(String eName,
String aName,
String type,
String mode,
String value) |
void |
characterData(char[] ch,
int start,
int length,
int nodeType) |
void |
characters(char[] ch,
int start,
int length) |
void |
close()
Close this builder.
|
void |
comment(char[] ch,
int start,
int length) |
protected OMElement |
createNextElement(String localName) |
void |
discard(OMElement el) |
void |
elementDecl(String name,
String model) |
void |
endCDATA() |
void |
endDocument() |
void |
endDTD() |
void |
endElement(String uri,
String localName,
String qName) |
void |
endEntity(String name) |
void |
endPrefixMapping(String prefix) |
void |
externalEntityDecl(String name,
String publicId,
String systemId) |
short |
getBuilderType()
Returns the type of the builder.
|
String |
getCharacterEncoding()
Returns the encoding style of the XML data
|
OMDocument |
getDocument()
Get the document being built by this builder.
|
OMElement |
getDocumentElement()
Get the document element, i.e.
|
OMElement |
getDocumentElement(boolean discardDocument)
Get the document element, optionally discarding the document.
|
Object |
getParser()
Allows to access the underlying parser.
|
Object |
getRegisteredContentHandler()
get the registered external content handler
|
OMElement |
getRootElement()
Get the root element of the Axiom tree built by this content handler.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length) |
void |
internalEntityDecl(String name,
String value) |
boolean |
isCache() |
boolean |
isCompleted() |
int |
next()
Proceed the parser one step and return the event value.
|
void |
notationDecl(String name,
String publicId,
String systemId) |
void |
processingInstruction(String target,
String data) |
void |
registerExternalContentHandler(Object obj)
Registers an external content handler.
|
void |
setCache(boolean b) |
void |
setDocumentLocator(Locator locator) |
void |
skippedEntity(String name) |
void |
startCDATA() |
void |
startDocument() |
void |
startDTD(String name,
String publicId,
String systemId) |
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts) |
void |
startEntity(String name) |
void |
startPrefixMapping(String prefix,
String uri) |
void |
unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName) |
error, fatalError, resolveEntity, warning
public SAXOMBuilder(OMFactory factory, SAXSource source, boolean expandEntityReferences)
factory
- source
- expandEntityReferences
- public SAXOMBuilder(OMFactory factory)
SAXSource
and use
OMXMLBuilderFactory.createOMBuilder(OMFactory, SAXSource, boolean)
.public SAXOMBuilder()
SAXSource
and use
OMXMLBuilderFactory.createOMBuilder(SAXSource, boolean)
.public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class DefaultHandler
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class DefaultHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
endDocument
in class DefaultHandler
SAXException
public void startDTD(String name, String publicId, String systemId) throws SAXException
startDTD
in interface LexicalHandler
SAXException
public void elementDecl(String name, String model) throws SAXException
elementDecl
in interface DeclHandler
SAXException
public void attributeDecl(String eName, String aName, String type, String mode, String value) throws SAXException
attributeDecl
in interface DeclHandler
SAXException
public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException
externalEntityDecl
in interface DeclHandler
SAXException
public void internalEntityDecl(String name, String value) throws SAXException
internalEntityDecl
in interface DeclHandler
SAXException
public void notationDecl(String name, String publicId, String systemId) throws SAXException
notationDecl
in interface DTDHandler
notationDecl
in class DefaultHandler
SAXException
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException
unparsedEntityDecl
in interface DTDHandler
unparsedEntityDecl
in class DefaultHandler
SAXException
public void endDTD() throws SAXException
endDTD
in interface LexicalHandler
SAXException
protected OMElement createNextElement(String localName) throws OMException
OMException
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class DefaultHandler
SAXException
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class DefaultHandler
SAXException
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class DefaultHandler
SAXException
public void startCDATA() throws SAXException
startCDATA
in interface LexicalHandler
SAXException
public void endCDATA() throws SAXException
endCDATA
in interface LexicalHandler
SAXException
public void characterData(char[] ch, int start, int length, int nodeType) throws SAXException
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class DefaultHandler
SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ignorableWhitespace
in interface ContentHandler
ignorableWhitespace
in class DefaultHandler
SAXException
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
in interface ContentHandler
processingInstruction
in class DefaultHandler
SAXException
public void comment(char[] ch, int start, int length) throws SAXException
comment
in interface LexicalHandler
SAXException
public void skippedEntity(String name) throws SAXException
skippedEntity
in interface ContentHandler
skippedEntity
in class DefaultHandler
SAXException
public void startEntity(String name) throws SAXException
startEntity
in interface LexicalHandler
SAXException
public void endEntity(String name) throws SAXException
endEntity
in interface LexicalHandler
SAXException
public OMDocument getDocument()
OMXMLParserWrapper
getDocument
in interface OMXMLParserWrapper
OMDocument
instancepublic OMElement getRootElement()
OMException
- if the tree is not completepublic int next() throws OMException
OMXMLParserWrapper
next
in interface OMXMLParserWrapper
OMException
public void discard(OMElement el) throws OMException
discard
in interface OMXMLParserWrapper
OMException
public void setCache(boolean b) throws OMException
setCache
in interface OMXMLParserWrapper
OMException
public boolean isCache()
isCache
in interface OMXMLParserWrapper
public Object getParser()
OMXMLParserWrapper
getParser
in interface OMXMLParserWrapper
public boolean isCompleted()
isCompleted
in interface OMXMLParserWrapper
public OMElement getDocumentElement()
OMXMLParserWrapper
OMDocument.getOMDocumentElement()
on the document returned by
OMXMLParserWrapper.getDocument()
.
Note that this method will never return null
(except in the very special case
where the document has been requested before and the document element has been removed
explicitly): if the document being parsed has no document element, then this will result in a
parser error, i.e. an OMException
will be thrown.
getDocumentElement
in interface OMXMLParserWrapper
public OMElement getDocumentElement(boolean discardDocument)
OMXMLParserWrapper
OMXMLParserWrapper.getDocumentElement()
. However, if the discardDocument
parameter is set to true
, then the document element is removed from the document
and the document itself is discarded. In contrast to using OMNode.detach()
this
will not build the element. The implementation also ensures that the element is not built
when it is added to another OM tree. This makes it possible to add the content of a document
to an existing OM tree while preserving the deferred parsing feature. It is even possible to
create an OM tree where different subtrees are associated with different builder instances.getDocumentElement
in interface OMXMLParserWrapper
discardDocument
- specifies whether the document should be discardedpublic short getBuilderType()
OMXMLParserWrapper
OMConstants.PUSH_TYPE_BUILDER
or OMConstants.PULL_TYPE_BUILDER
.getBuilderType
in interface OMXMLParserWrapper
public void registerExternalContentHandler(Object obj)
OMXMLParserWrapper
registerExternalContentHandler
in interface OMXMLParserWrapper
public Object getRegisteredContentHandler()
OMXMLParserWrapper
getRegisteredContentHandler
in interface OMXMLParserWrapper
public String getCharacterEncoding()
OMXMLParserWrapper
getCharacterEncoding
in interface OMXMLParserWrapper
public void close()
OMXMLParserWrapper
close
in interface OMXMLParserWrapper
Copyright © 2004–2022 The Apache Software Foundation. All rights reserved.