public class XmlHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.lang.String |
qName
This element's QName.
|
java.lang.String |
value
This element's text() value.
|
java.lang.String |
xmlBase
The current state of
xml:base . |
java.lang.String |
xmlLang
The current state of
xml:lang . |
Constructor and Description |
---|
XmlHandler(ValidationContext vc,
Element parent,
Element element,
ElementMetadata<?,?> metadata)
Construct an xml parser that will add the element to its parent after
parsing is completed.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAbsoluteUri(java.lang.String uriValue)
Utility routine that combines the current state of
xml:base
with the specified URI to obtain an absolute URI. |
java.lang.Boolean |
getBooleanAttribute(org.xml.sax.Attributes attrs,
java.lang.String attrName)
Utility method to return the value of an xsd:boolean attribute.
|
XmlHandler |
getChildHandler(QName qName,
org.xml.sax.Attributes attrs,
java.util.List<XmlNamespace> namespaces)
Default child handler for xml.
|
Element |
getElement() |
void |
initializeXmlBlob(XmlBlob xmlBlob,
boolean mixedContent,
boolean fullTextIndex)
If a derived class wishes to retrieve all unrecognized XML in a blob,
it calls this method.
|
void |
processAttribute(QName qn,
java.lang.String value)
Called to process an attribute.
|
void |
processEndElement()
Called to process this element when the closing tag is encountered.
|
public java.lang.String qName
public java.lang.String value
public java.lang.String xmlLang
xml:lang
.
See http://www.w3.org/TR/REC-xml/#sec-lang-tag for more information.public java.lang.String xmlBase
xml:base
.
See http://www.cafeconleche.org/books/xmljava/chapters/ch03s03.html for
more information.public XmlHandler(ValidationContext vc, Element parent, Element element, ElementMetadata<?,?> metadata)
public Element getElement()
public void processAttribute(QName qn, java.lang.String value) throws ParseException
qn
- Attribute's qualified name.value
- Attribute value.ParseException
- Invalid attribute.public XmlHandler getChildHandler(QName qName, org.xml.sax.Attributes attrs, java.util.List<XmlNamespace> namespaces) throws ParseException, java.io.IOException
Element
if
the element has not been declared, otherwise it will parse into the type
defined by the metadata.qName
- Child element's qualified name.attrs
- Child element attributes. These attributes will be
communicated to the child element handler through its
processAttribute(com.google.gdata.model.QName, java.lang.String)
method. They are passed here because
sometimes the value of some attribute determines the element's
content type, so different element handlers may be needed.namespaces
- List of namespaces in effect for child element.null
if the child is
unrecognized.ParseException
- if a non-repeating element is repeated, or if the
element type requested cannot be created.java.io.IOException
- from overriding code. Not thrown by the default
implementation.public void processEndElement() throws ParseException
ParseException
public void initializeXmlBlob(XmlBlob xmlBlob, boolean mixedContent, boolean fullTextIndex) throws java.io.IOException
processAttribute(com.google.gdata.model.QName, java.lang.String)
.xmlBlob
- Supplies the XML blob that stores the resulting XML.mixedContent
- Specifies that the handler accepts mixed content XML.fullTextIndex
- Flag indicating whether unrecognized XML should be processed
for full-text indexing. If set, the resulting string ready for
indexing is stored in XmlBlob.fullText
.java.io.IOException
public java.lang.String getAbsoluteUri(java.lang.String uriValue) throws ParseException
xml:base
with the specified URI to obtain an absolute URI.
See http://www.cafeconleche.org/books/xmljava/chapters/ch03s03.html for more information.
uriValue
- URI to be interpreted in the context of xml:base
.ParseException
- Invalid URI.public java.lang.Boolean getBooleanAttribute(org.xml.sax.Attributes attrs, java.lang.String attrName) throws ParseException
attrs
- Elements attributes to test against.attrName
- Attribute name.null
otherwise.ParseException
- if attribute value is not valid xsd:boolean.