I already thought about that for the root element, but didn't know I could also do this for the sub-elements. I will give that a shot, thanks for the suggestion.
On 11/8/06,
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
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:[EMAIL PROTECTED]]
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.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]