|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.xolite.impl.BaseXMLEventParser
net.sf.xolite.dom.DomXMLEventParser
public class DomXMLEventParser
A XMLEventParser
implementation using a DOM tree as input.
Constructor Summary | |
---|---|
DomXMLEventParser()
Build a DomEventParser . |
Method Summary | |
---|---|
protected void |
addLocationInfo(XMLParseException xpe)
|
Iterator<String> |
getAttributeNameIterator(String attrNamespaceURI)
Get an iterator on names of all the attributes present in the current element and belonging to the given namespace. |
Iterator<String> |
getAttributeNamespaceIterator()
Get an iterator on namespaces of all the attributes present in the current element. |
String |
getAttributeValue(String attrName)
Get an attribute value. |
String |
getAttributeValueNS(String attrNamespaceURI,
String attrName)
Get value of an attribute with namespace. |
NamespaceContext |
getCurrentDefinedNamespaces()
Get NamespacePrefixResolver mapping the prefix to the namespace URI. |
String |
getElementText()
Get the content of the text buffer. |
String |
getNamespaceURI(String prefix)
Get namespace URI corresponding to the given prefix. |
String |
getPrefix(String namespaceURI)
Get the first perfix mapped to the given namespace. |
Iterator<String> |
getPrefixes(String namespaceURI)
Get all the prefix mapped to the given namespace. |
String |
getSourceDescription()
|
XMLSerializable |
parse(Document src)
'Parse' the given DOM Document to java objects. |
void |
parse(Document src,
XMLSerializable rootHandler)
'Parse' the given DOM Document using the given XMLSerializable as root handler. |
XMLSerializable |
parseElement(String uri,
String localName)
Create the XMLSerializable object corresponding to the given XML element, delegates the parsing to it and return the created object. |
protected void |
tearDown()
Clean state and avoid keeping dangling references to internal objects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DomXMLEventParser()
DomEventParser
.
Method Detail |
---|
public XMLSerializable parse(Document src) throws XMLParseException
src
- source DOM Document.
XMLParseException
- if the source contains an invalid XML document.public void parse(Document src, XMLSerializable rootHandler) throws XMLParseException
XMLSerializable
as root handler.
src
- source DOM Document.rootHandler
- the root handler.
XMLParseException
- if the source contains an invalid DOM document.protected void tearDown()
tearDown
in class BaseXMLEventParser
public String getNamespaceURI(String prefix)
getNamespaceURI
in interface NamespaceContext
getNamespaceURI
in class BaseXMLEventParser
NamespaceContext.getPrefix(java.lang.String)
public String getPrefix(String namespaceURI)
getPrefix
in interface NamespaceContext
getPrefix
in class BaseXMLEventParser
NamespaceContext.getPrefix(java.lang.String)
public Iterator<String> getPrefixes(String namespaceURI)
getPrefixes
in interface NamespaceContext
getPrefixes
in class BaseXMLEventParser
NamespaceContext.getPrefixes(java.lang.String)
public NamespaceContext getCurrentDefinedNamespaces()
XMLEventParser
NamespacePrefixResolver
mapping the prefix to the namespace URI. A copy of the current mapping object of
this parser at the moment of the call is returned.
getCurrentDefinedNamespaces
in interface XMLEventParser
getCurrentDefinedNamespaces
in class BaseXMLEventParser
public XMLSerializable parseElement(String uri, String localName) throws XMLParseException
XMLEventParser
XMLSerializable child = parser.getFactory().createObject(uri, localName, parser); parser.delegateParsingTo(child, uri, localName); return child;
parseElement
in interface XMLEventParser
parseElement
in class BaseXMLEventParser
XMLParseException
public String getElementText()
XMLEventParser
Use the ElementText helper class to get, parse, validate and format easily the element text.
Calling this method from a startElement
notification is useful only when parsing XML with mixed content. In this
case you got the text just before the started element.
protected void addLocationInfo(XMLParseException xpe)
addLocationInfo
in class BaseXMLEventParser
public String getSourceDescription()
public String getAttributeValue(String attrName) throws XMLParseException
XMLEventParser
attrName
- the name of the attribute.
XMLParseException
public String getAttributeValueNS(String attrNamespaceURI, String attrName) throws XMLParseException
XMLEventParser
This method allows to specify the namespace of the attribute. In most of the case attributes are not associated to namespaces. It is not necessary because attributes definitions are, in most of the case, local to the definition of the element containing it. So this method should be rarely used (use the corresponding method without namespace parameter). Examples of attributes using namespaces are: 'xml:lang' or 'xmlns:prefix'. To get values of those attributes you must provide the namespace URI.
attrNamespaceURI
- the namespace URI of the attribute.attrName
- the name of the attribute.
XMLParseException
public Iterator<String> getAttributeNamespaceIterator() throws XMLParseException
XMLEventParser
XMLParseException
public Iterator<String> getAttributeNameIterator(String attrNamespaceURI) throws XMLParseException
XMLEventParser
null
as namespace for attributes not bound to a namespace (i.e. most of the attributes).
attrNamespaceURI
- namespace of the attributes or null
for attributes without namespaces.
XMLParseException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |