logo       

SV: Is there a way to instantiate a root element and have all sub-elements : msg#00012

text.xml.xmlbeans.user

Subject: SV: Is there a way to instantiate a root element and have all sub-elements also created?


If the newInstance would create instances of all subelements, this could
potentially create very large objects depending on your xsd. (Emagine creating
an instance from an ordernary HTML definition, this would produce a lot of
empty tags in the result)
As far as I know there is no such functionality, and I'm not sure that's what
you normally would need to have.

A suggestion to solve your issue is to create xml-files with the subelements
you want instansiated and create your instance with the parse method.

Perhaps you could create different default xml's for different situations. This
way you could also fill your instance with default values or mandatory values.

/Mikael


________________________________

Från: Beet [mailto:btrang@xxxxxxxxx]
Skickat: on 2006-11-08 16:27
Till: user
Ämne: Is there a way to instantiate a root element and have all sub-elements
also created?


When I do a Root.Factory.newInstance(), the Root object is created, but all the
sub-elements of Root are not. So when I try root.getSubelementA().whatever(),
I get a null error because subelementA is not instantiated. Is there a way to
call a new instance but have it create deeply all the sub-elements of Root so
that this doesn't occur? Likewise, when I call root.addSubelement(), the new
Subelement does not instantiate its constituent parts.

So I guess my question is, is there an easy way to instantiate all the
constituent parts of an object instead of just the bare object itself? Thanks.

B.

<<winmail.dat>>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: user-help@xxxxxxxxxxxxxxxxxxx
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise