| com.nabhinc.portal.config.impl.runtime.XMLSerializer
All known Subclasses: com.nabhinc.portal.config.impl.runtime.SAXMarshaller, com.nabhinc.portal.config.impl.runtime.MSVValidator,
XMLSerializer | public interface XMLSerializer (Code) | | Receives XML serialization event
This object coordinates the overall marshalling efforts across different
content-tree objects and different target formats.
The following CFG gives the proper sequence of method invocation.
MARSHALLING := ELEMENT
ELEMENT := "startElement" NSDECL* "endNamespaceDecls"
ATTRIBUTE* "endAttributes" BODY "endElement"
NSDECL := "declareNamespace"
ATTRIBUTE := "startAttribute" ATTVALUES "endAttribute"
ATTVALUES := "text"*
BODY := ( "text" | ELEMENT )*
A marshalling of one element consists of two stages. The first stage is
for marshalling attributes and collecting namespace declarations.
The second stage is for marshalling characters/child elements of that element.
Observe that multiple invocation of "text" is allowed.
Also observe that the namespace declarations are allowed only between
"startElement" and "endAttributes".
author: Kohsuke Kawaguchi |
Method Summary | |
void | childAsAttributes(JAXBObject o, String fieldName) This method is called when an JAXBObject object is found
while the marshaller is in the "attribute" mode (i.e. | void | childAsBody(JAXBObject o, String fieldName) This method is called when an JAXBObject object is found
while the marshaller is in the "element" mode (i.e. | void | childAsURIs(JAXBObject o, String fieldName) This method is called when an JAXBObject object is found
while the marshaller is in the "URI" mode.
Parameters: fieldName - property name of the parent objeect from which 'o' comes.Used as a part of the error message in case anything goes wrongwith 'o'. | void | endAttribute() | void | endAttributes() Switches to the mode to marshal child texts/elements. | void | endElement() Ends marshalling of an element. | void | endNamespaceDecls() Switches to the mode to marshal attribute values. | NamespaceContext2 | getNamespaceContext() Obtains a namespace context object, which is used to
declare/obtain namespace bindings. | String | onID(IdentifiableObject owner, String value) Notifies the serializer that an ID value has just marshalled. | String | onIDREF(IdentifiableObject obj) Notifies the serializer that an IDREF value has just marshalled. | void | reportError(ValidationEvent e) Errors detected by the XMLSerializable should be either thrown
as
SAXException or reported through this method. | void | startAttribute(String uri, String local) Starts marshalling of an attribute. | void | startElement(String uri, String local) Starts marshalling of an element. | void | text(String text, String fieldName) Marshalls text.
This method can be called (i) after the startAttribute method
and (ii) before the endAttribute method, to marshal attribute values.
If the method is called more than once, those texts are considered
as separated by whitespaces. |
childAsAttributes | void childAsAttributes(JAXBObject o, String fieldName) throws SAXException(Code) | | This method is called when an JAXBObject object is found
while the marshaller is in the "attribute" mode (i.e. marshalling
attributes of an element)
Parameters: fieldName - property name of the parent objeect from which 'o' comes.Used as a part of the error message in case anything goes wrongwith 'o'. |
childAsBody | void childAsBody(JAXBObject o, String fieldName) throws SAXException(Code) | | This method is called when an JAXBObject object is found
while the marshaller is in the "element" mode (i.e. marshalling
a content model of an element)
Parameters: fieldName - property name of the parent objeect from which 'o' comes.Used as a part of the error message in case anything goes wrongwith 'o'. |
childAsURIs | void childAsURIs(JAXBObject o, String fieldName) throws SAXException(Code) | | This method is called when an JAXBObject object is found
while the marshaller is in the "URI" mode.
Parameters: fieldName - property name of the parent objeect from which 'o' comes.Used as a part of the error message in case anything goes wrongwith 'o'. |
endAttributes | void endAttributes() throws SAXException(Code) | | Switches to the mode to marshal child texts/elements.
This method has to be called after the 2nd pass is completed.
|
endElement | void endElement() throws SAXException(Code) | | Ends marshalling of an element.
Pops the internal stack.
|
endNamespaceDecls | void endNamespaceDecls() throws SAXException(Code) | | Switches to the mode to marshal attribute values.
This method has to be called after the 1st pass is completed.
|
getNamespaceContext | NamespaceContext2 getNamespaceContext()(Code) | | Obtains a namespace context object, which is used to
declare/obtain namespace bindings.
|
onID | String onID(IdentifiableObject owner, String value) throws SAXException(Code) | | Notifies the serializer that an ID value has just marshalled.
The serializer may or may not check the consistency of ID/IDREFs
and may throw a SAXException.
Parameters: owner - JAXB content object that posesses the ID. Parameters: value - The value of the ID.Return the value parameter without any modification,so that the invocation of this method can be done transparentlyby a transducer. |
onIDREF | String onIDREF(IdentifiableObject obj) throws SAXException(Code) | | Notifies the serializer that an IDREF value has just marshalled.
The serializer may or may not check the consistency of ID/IDREFs
and may throw a SAXException.
Return the value parameter without any modification.so that the invocation of this method can be done transparentlyby a transducer. |
reportError | void reportError(ValidationEvent e) throws AbortSerializationException(Code) | | Errors detected by the XMLSerializable should be either thrown
as
SAXException or reported through this method.
The callee should report an error to the client application
and
|
startAttribute | void startAttribute(String uri, String local) throws SAXException(Code) | | Starts marshalling of an attribute.
The marshalling of an attribute will be done by
- call the startAttribute method
- call the text method (several times if necessary)
- call the endAttribute method
No two attributes can be marshalled at the same time.
Note that the whole attribute marshalling must be happened
after the startElement method and before the endAttributes method.
|
startElement | void startElement(String uri, String local) throws SAXException(Code) | | Starts marshalling of an element.
Calling this method will push the internal state into the
internal stack.
|
text | void text(String text, String fieldName) throws SAXException(Code) | | Marshalls text.
This method can be called (i) after the startAttribute method
and (ii) before the endAttribute method, to marshal attribute values.
If the method is called more than once, those texts are considered
as separated by whitespaces. For example,
c.startAttribute();
c.text("abc");
c.text("def");
c.endAttribute("","foo");
will generate foo="abc def".
Similarly, this method can be called after the endAttributes
method to marshal texts inside elements. The same rule about
multiple invokations apply to this case, too. For example,
c.startElement("","foo");
c.endNamespaceDecls();
c.endAttributes();
c.text("abc");
c.text("def");
c.startElement("","bar");
c.endAttributes();
c.endElement();
c.text("ghi");
c.endElement();
will generate <foo>abc def<bar/>ghi</foo> .
|
|
|