axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Melgar" <dmel...@us.ibm.com>
Subject Re: GetAsDOM
Date Fri, 10 Aug 2001 19:29:28 GMT
I agree. It carries a big performance penalty, but seems most
straightforward as you said and is only incurred if someone asks for the
message as a DOM. Can't think if a reasonably simple way around it.

If someone really does ask for a conversion to DOM, convert the whole
message and maintain that DOM related to the entire message, in the same
way that the SAX event recording is always associated with the entire
message.

Each object within the message knows or can get to its element within the
message's DOM. The object should use the DOM as its representation until
the message form switches to something else. So, changes made to the DOM
after a getAsDOM call are reflected within the object, ie the returned
element is not a copy, but a reference to the appropriate element within
the message's DOM representation.

David Melgar
Web Services Toolkit Development
Emerging Technologies
dmelgar@us.ibm.com


Glen Daniels <gdaniels@macromedia.com> on 08/10/2001 12:16:38 PM

Please respond to axis-dev@xml.apache.org

To:   "'axis-dev@xml.apache.org'" <axis-dev@xml.apache.org>
cc:
Subject:  GetAsDOM




So getAsDOM works by serializing the element out to a string, then parsing
that as a mini-document.  There's a problem with this, though - it doesn't
work if there are are namespaced attributes... If we originally had the
"xsi" prefix declared at the top level (i.e. <Envelope>), and then ask for
this header as DOM:

<someHeader xsi:type="fooType"/>

The parser will complain because we're trying to parse exactly that string,
which doesn't contain a namespace declaration for the xsi:type element, and
thus this is bad XML.

If we change the serializer to add the namespace declaration, we alter the
structure of the document and, although the parse will work then, we lose
the correctness of the DOM representation.

Any suggestions?  All I can think of at the moment is to serialize the
entire envelope, parse it as DOM, and then find the element we're looking
for in the tree.... (keeping a cached copy of the DOM around, probably)

Glen Daniels
Macromedia
http://www.macromedia.com/
                                Building cool stuff for web developers




Mime
View raw message