public class RootXmlReadHandler extends org.xml.sax.helpers.DefaultHandler
Constructor and Description |
---|
RootXmlReadHandler(ResourceManager manager,
ResourceKey source,
long version)
Creates a new root-handler using the given versioning information and resource-manager.
|
RootXmlReadHandler(ResourceManager manager,
ResourceKey source,
ResourceKey context,
long version)
Creates a new root-handler using the given versioning information and resource-manager.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
Process character data.
|
void |
delegate(XmlReadHandler handler,
String uri,
String tagName,
Attributes attrs)
Delegate to another handler.
|
void |
endElement(String originalUri,
String localName,
String qName)
Finish processing an element.
|
CommentHandler |
getCommentHandler()
Returns the comment handler that is used to collect comments.
|
ResourceKey |
getContext()
Returns the context key.
|
protected XmlReadHandler |
getCurrentHandler()
Returns the current handler.
|
DependencyCollector |
getDependencyCollector()
Returns the current dependency collector for this parse-operation.
|
Locator |
getDocumentLocator()
Returns the current documentLocator.
|
EntityResolver |
getEntityResolver() |
Object |
getHelperObject(String key)
Returns an object from the registry.
|
String[] |
getHelperObjectNames()
Returns the array of all currently registered helper-objects.
|
DefaultConfiguration |
getParserConfiguration()
Returns the parser-configuration.
|
ResourceManager |
getResourceManager()
Returns the resource-manager that is used to load external resources.
|
Object |
getResult()
Tries to return the parse-result of the selected root-handler.
|
protected XmlReadHandler |
getRootHandler()
Returns the root SAX handler.
|
ResourceKey |
getSource()
Returns the source key.
|
protected void |
installRootHandler(XmlReadHandler handler,
String uri,
String localName,
Attributes attributes)
Sets and configures the root handle for the given root-level element.
|
protected void |
interceptFirstStartElement(String uri,
String localName,
String qName,
Attributes attributes)
A helper call that allows to override the first call to the startElememt method.
|
boolean |
isFirstCall()
Checks, whether this is the first call to the handler.
|
boolean |
isXmlnsUrisNotAvailable()
Returns, whether the parser resolves namespace-URIs.
|
protected void |
pushDefaultNamespace(String nsuri)
Updates the current default namespace.
|
void |
recurse(XmlReadHandler handler,
String uri,
String tagName,
Attributes attrs)
Start a new handler stack and delegate to another handler.
|
void |
setDocumentLocator(Locator locator)
Receive an object for locating the origin of SAX document events.
|
void |
setHelperObject(String key,
Object value)
Adds an object to the registry.
|
protected void |
setRootHandler(XmlReadHandler handler)
Sets the root SAX handler.
|
void |
setXmlnsUrisNotAvailable(boolean xmlnsUrisNotAvailable)
Sets a hint that the parser will not be able to return URIs for XML-Namespaces.
|
void |
startDocument()
Starts processing a document.
|
void |
startElement(String originalUri,
String localName,
String qName,
Attributes attributes)
Starts processing an element.
|
void |
unwind(String uri,
String tagName)
Hand control back to the previous handler.
|
protected Attributes |
wrapAttributes(Attributes attributes) |
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
public RootXmlReadHandler(ResourceManager manager, ResourceKey source, long version)
manager
- the resource manager that loaded this xml-file.source
- the source-key that identifies from where the file was loaded.version
- the versioning information for the root-file.public RootXmlReadHandler(ResourceManager manager, ResourceKey source, ResourceKey context, long version)
manager
- the resource manager that loaded this xml-file.source
- the source-key that identifies from where the file was loaded.context
- the key that should be used to resolve relative paths.version
- the versioning information for the root-file.public ResourceKey getContext()
public ResourceManager getResourceManager()
public boolean isFirstCall()
public ResourceKey getSource()
public DependencyCollector getDependencyCollector()
public CommentHandler getCommentHandler()
public DefaultConfiguration getParserConfiguration()
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class org.xml.sax.helpers.DefaultHandler
locator
- the documentLocator.public Locator getDocumentLocator()
public void setHelperObject(String key, Object value)
key
- the key.value
- the object.public Object getHelperObject(String key)
key
- the key.public String[] getHelperObjectNames()
protected void setRootHandler(XmlReadHandler handler)
handler
- the SAX handler.protected XmlReadHandler getRootHandler()
public void recurse(XmlReadHandler handler, String uri, String tagName, Attributes attrs) throws SAXException
handler
- the handler.uri
- the namespace uri of the current tag.tagName
- the tag name.attrs
- the attributes.SAXException
- if there is a problem with the parser.public void delegate(XmlReadHandler handler, String uri, String tagName, Attributes attrs) throws SAXException
handler
- the new handler.tagName
- the tag name.uri
- the namespace uri of the current tag.attrs
- the attributes.SAXException
- if there is a problem with the parser.public void unwind(String uri, String tagName) throws SAXException
tagName
- the tagname.uri
- the namespace uri of the current tag.SAXException
- if there is a problem with the parser.protected XmlReadHandler getCurrentHandler()
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class org.xml.sax.helpers.DefaultHandler
SAXException
- not in this implementation.public final void startElement(String originalUri, String localName, String qName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
originalUri
- the URI.localName
- the local name.qName
- the qName.attributes
- the attributes.SAXException
- if there is a parsing problem.protected Attributes wrapAttributes(Attributes attributes)
protected void interceptFirstStartElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
uri
- the namespace uri of the current tag.localName
- the unqualified tag-name.qName
- the qualified tag-name.attributes
- the attributes of the current element.SAXException
- if something goes wrong.protected final void pushDefaultNamespace(String nsuri)
nsuri
- the uri of the current namespace.protected void installRootHandler(XmlReadHandler handler, String uri, String localName, Attributes attributes) throws SAXException
handler
- the read handler for the root element.uri
- the uri of the root elements namespace.localName
- the local tagname of the root element.attributes
- the attributes of the root element.SAXException
- if something goes wrong.public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
ch
- the character buffer.start
- the start index.length
- the length of the character data.SAXException
- if there is a parsing error.public final void endElement(String originalUri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
originalUri
- the URI.localName
- the local name.qName
- the qName.SAXException
- if there is a parsing error.public Object getResult() throws SAXException
SAXException
- if an error occurs.public EntityResolver getEntityResolver()
public boolean isXmlnsUrisNotAvailable()
public void setXmlnsUrisNotAvailable(boolean xmlnsUrisNotAvailable)
xmlnsUrisNotAvailable
- a flag indicating that the XML parser has troubles resolving namespaces.Copyright © 2002–2017 Pentaho Corporation. All rights reserved.