|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.milyn.delivery.sax.SAXElement
public class SAXElement
Element details as described by the SAX even model API.
SAXVisitor implementations will be passed
an instance of this class for each of the event methods of
SAXVisitor implementations.
writer set on it.
SAXVisitor implementations can take care of
serializing the elements at which they are targeted themselves. Alternatively, they
can use the WriterUtil class.
SAXVisitor implementations can also control the serialization
of their "child elements" by setting the writter
on the SAXElement instance they receive. This works because Smooks passes the
writer instance that's set on a SAXElement instance to all of the SAXElement
instances created for child elements.
Only one SAXVisitor can have access to the writer
for any individual SAXElement. The first visitor to request access to
the writer via the getWriter(SAXVisitor) method "owns" the writer
for that element. Any other visitors requesting access to get or change the writer
will result in a SAXWriterAccessException being thrown. In this situation,
you need to restructure the offending Smooks configuration and eliminate one of the
visitors attempting to gain access to the writer. If developing a new visitor,
you probably need to change the visitor to also implement the SAXVisitBefore
interface and use that event method to acquire ownership of the element writer
through a call to getWriter(SAXVisitor).
| Constructor Summary | |
|---|---|
SAXElement(QName name,
Attributes attributes,
SAXElement parent)
Public constructor. |
|
SAXElement(String namespaceURI,
String localName,
String qName,
Attributes attributes,
SAXElement parent)
Public constructor. |
|
| Method Summary | |
|---|---|
void |
accumulateText()
Turn on text accumulation for this SAXElement. |
boolean |
equals(Object obj)
|
String |
getAttribute(String attribute)
Get the named attribute from this element. |
String |
getAttribute(String namespaceURI,
String attribute)
Get the named attribute from this element. |
Attributes |
getAttributes()
Get the element attributes. |
Object |
getCache()
Deprecated. Use getCache(SAXVisitor). |
Object |
getCache(SAXVisitor visitor)
Get the element cache object. |
QName |
getName()
Get the element naming details. |
SAXElement |
getParent()
Get parent element. |
List<SAXText> |
getText()
Get the child text list associated with this SAXElement. |
String |
getTextContent()
Get the SAXText objects associated with this SAXElement,
as an accumulated String. |
Writer |
getWriter(SAXVisitor visitor)
Get the writer to which this element should be writen to. |
int |
hashCode()
|
boolean |
isWriterOwner(SAXVisitor visitor)
Is the supplied SAXVisitor the owner of the Writer associated
with this SAXElement instance. |
void |
setAttributes(Attributes attributes)
Set the element attributes. |
void |
setCache(Object cache)
Deprecated. Use setCache(SAXVisitor, Object). |
void |
setCache(SAXVisitor visitor,
Object cache)
Set the element cache object. |
void |
setName(QName name)
Set the naming details for the Element. |
void |
setParent(SAXElement parent)
Set parent element. |
void |
setWriter(Writer writer,
SAXVisitor visitor)
Set the writer to which this element should be writen to. |
Element |
toDOMElement(Document document)
Create a DOM Element instance from this SAXElement
instance. |
static QName |
toQName(String namespaceURI,
String localName,
String qName)
Create a QName instance from the supplied element naming parameters. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SAXElement(String namespaceURI,
String localName,
String qName,
Attributes attributes,
SAXElement parent)
namespaceURI - The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName - The local name (without prefix), or the
empty string if Namespace processing is not being
performed.qName - The qualified name (with prefix), or the
empty string if qualified names are not available.attributes - The attributes attached to the element. If
there are no attributes, it shall be an empty
Attributes object.parent - Parent element, or null if the element is the document root element.
public SAXElement(QName name,
Attributes attributes,
SAXElement parent)
name - The element QName.attributes - The attributes attached to the element. If
there are no attributes, it shall be an empty
Attributes object.parent - Parent element, or null if the element is the document root element.| Method Detail |
|---|
public static QName toQName(String namespaceURI,
String localName,
String qName)
QName instance from the supplied element naming parameters.
namespaceURI - The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.localName - The local name (without prefix), or the
empty string if Namespace processing is not being
performed.qName - The qualified name (with prefix), or the
empty string if qualified names are not available.
QName instance representing the element named by the supplied parameters.public void accumulateText()
text accumulation for this SAXElement.
For performance reasons, Text accumulation is not on by default.
public List<SAXText> getText()
text list associated with this SAXElement.
text list associated with this SAXElement,
or null if this SAXElement is not accumulating text.accumulateText()
public String getTextContent()
throws SmooksException
SAXText objects associated with this SAXElement,
as an accumulated String.
This method will produce a string containing all TextType SAXText
objects associated with this SAXElement. If you need to filter out specific
TextType SAXText objects, use the getText() method and manually
produce a String.
SAXText objects associated with this SAXElement,
as an accumulated String.
SmooksException - This SAXElement instance does not have
text accumulation turned on.accumulateText()
public Writer getWriter(SAXVisitor visitor)
throws SAXWriterAccessException
visitor - The visitor requesting access to element writer.
SAXWriterAccessException - Invalid access request for the element writer. See element writing.
public void setWriter(Writer writer,
SAXVisitor visitor)
throws SAXWriterAccessException
writer - The element writer.visitor - The visitor requesting to set the element writer.
SAXWriterAccessException - Invalid access request for the element writer. See element writing.public boolean isWriterOwner(SAXVisitor visitor)
SAXVisitor the owner of the Writer associated
with this SAXElement instance.
See element writing.
visitor - The visitor being checked.
SAXVisitor owns the Writer associated
with this SAXElement instance, otherwise false.public QName getName()
public void setName(QName name)
name - The element naming details.public Attributes getAttributes()
public void setAttributes(Attributes attributes)
attributes - The element attributes.public String getAttribute(String attribute)
attribute - The attribute name.
public String getAttribute(String namespaceURI,
String attribute)
namespaceURI - The namespace URI of the required attribute.attribute - The attribute name.
public Object getCache()
getCache(SAXVisitor).
public void setCache(Object cache)
setCache(SAXVisitor, Object).
cache - The element cache Object.public Object getCache(SAXVisitor visitor)
visitor - The SAXElement instance associated with the cache object.
public void setCache(SAXVisitor visitor,
Object cache)
visitor - The SAXElement instance to which the cache object is to be associated.cache - The element cache Object.public SAXElement getParent()
public void setParent(SAXElement parent)
parent - Parent element, or null if it's the documnent root.public String toString()
toString in class Objectpublic final boolean equals(Object obj)
equals in class Objectpublic final int hashCode()
hashCode in class Objectpublic Element toDOMElement(Document document)
Element instance from this SAXElement
instance.
document - The document to use to create the DOM Element.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||