xml-xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksander Slominski <as...@cs.indiana.edu>
Subject Re: is it possible to create disjoint xml elements?
Date Tue, 11 May 2004 18:21:12 GMT
Jonathan A. Chase wrote:

> Is it possible to create disjoint xml elements with xmlbeans?
> That wording probably isn't very clear.  Here's an example:
> my xml document...
> <resume>
>   <name>value</name>
>   <address>value</address>
> <resume>
> Say my program doesn't care about the <resume> element..it only cares 
> about <name> and its child elements.  My question is, can I use xml 
> beans to create a <name> object w/o attaching it to a <resume> object 
> in the code (even though the xml schema says "a name must belong to a 
> resume")?
> Also, if the above is possible, what's the effect of it when it comes 
> to outputting the elements as text?  For instance, if a program wants 
> to print only the following:
> <name>value</name>
> without the surrounding parent elements (as dictated by the schema), 
> is that possible?

i think this could be rephrased as: if i have some XML infoset 
representation of my data (such as DOM Element with resume/name) can i 
create XmlBeans view on it? maybe by doing something like this:

    Element resumeElement = ...
    Name name = Name.bindViewTo(resumeElement);

in that case i think that what would be really good (and is implied by 
calling it a view) is that you could keep modifying your DOM 
resumeElement and changes will be visible to Name and vice versa!

this saves memory but even more importantly it prevents bugs common when 
maintaining two (or more) separate representations of data. if you have 
multiple views it should allow you to use a XML API (DOM, XmlBeans, ...) 
that best suits need of particular part of your app.

AFAIK this is not possible in XmlBeans v1 or v2.

what is possible? the way i was doing it is to reparse DOM element and 
have XmlBeans create its own internal infoset representation 
(cursor/store API):


you get /almost/ the same result but you no longer have view but 
disparate copies of infoset (DOM and XmlBeans internal store).

that approach which is similar in spirit to Name.Factory.newInstance (as 
David pointed out 
which is prohibitively memory expensive if you try to do 
binding/building from bottom-up.

did i miss something?



The best way to predict the future is to invent it - Alan Kay

View raw message