Karr, David wrote:
>This seems like it would be simple, but I can't figure out how to get
>the attributes of the XML elements that were unmarshalled into JAXB
>objects, but which were not necessarily specified in the schema. The
>unmarshalled objects contain the complete element hierarchy, but I need
>to be able to see some attributes also.
>
>For instance, my sample XML file has a root element with attributes
>"xsmlns:xsi" and "xsi:noNamespaceSchemaLocation". These are not
>specified in the schema (logically), but I need to have my JAXB objects
>contain everything from the XML file, so I can reproduce it later. Is
>JAXB not good for completely reproducing the original XML file? How
>does it deal with comments, for instance?
>
>
It was a specific non-goal of JAXB 1.0 specification did not require
preservation of
the entire XML infoset. A JAXB implementation is allowed to preserve
comments, but
not required to. Doing so would have required that all implementations
would have
to be as bulky as DOM representation of a document. Instead, JAXB 1.0
allowed for binding XML data content to a Java data
representation. It was the intent of the binding to preserve the data
semantics of the document, w/o requiring that
each lexical character be preserved exactly as it was in the original
document. Since comments are not considered
data within an xml document, it is okay for a databinding product to not
preserve them. This tradeoff allows
an implementation to make its own decision on whether a lightweight
databinding (as JAXB 1.0 RI is)
is preferable to a databinding that preserves the original document in a
Java access layer over
a DOM that preserves the entire document.
-Joe Fialli, Sun Microsystems
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net