|
||||||||||
| 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.
getCache() and setCache(Object) methods. The cache object can be used by
SAXVisitor implementations to store information
between calls to the SAXVisitor event methods.
Obviously we could have implemented this cache as a straightforward Map,
but that forces you to do silly things in situations where you wish to (for example)
store a List, or a single Object reference of some other type.
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(String namespaceURI,
String localName,
String qName,
Attributes attributes,
SAXElement parent)
Public constructor. |
|
| Method Summary | |
|---|---|
Attributes |
getAttributes()
Get the element attributes. |
Object |
getCache()
Get the element cache object. |
QName |
getName()
Get the element naming details. |
SAXElement |
getParent()
Get parent element. |
Writer |
getWriter(SAXVisitor visitor)
Get the writer to which this element should be writen to. |
void |
setAttributes(Attributes attributes)
Set the element attributes. |
void |
setCache(Object cache)
Set the element cache object. |
void |
setName(QName name)
Set the naming details for the Element. |
void |
setWriter(Writer writer,
SAXVisitor visitor)
Set the writer to which this element should be writen to. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, 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.| Method Detail |
|---|
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 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 Object getCache()
public void setCache(Object cache)
cache - The element cache Object.public SAXElement getParent()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||