I don't exactly know the answer but check out the Factory methods. I'm
new to XMLBeans, too.
For example, I'm using this code below, it seems to work but I don't
know if I'm doing anything wrong:
--- example ----
ModsDocument modsDoc = ModsDocument.Factory.newInstance();
ModsType mods = modsDoc.addNewMods();
TitleInfoType titleInfo = TitleInfoType.Factory.newInstance();
titleInfo.addTitle(imageTitle);
mods.setTitleInfoArray(new TitleInfoType[] {titleInfo});
NameType name = NameType.Factory.newInstance();
NamePartType namePart = name.addNewNamePart();
namePart.setStringValue(creator);
mods.setNameArray(new NameType[] {name});
...
Waswani, Yuvraj wrote:
MyObjectDocument.save(OutputStream);
Will output the XML from "already instantiated" XMLBeans. Issue here is
- how to instantiate XMLBeans without an XML and not how to output XML
once they are instantiated and populated.
Thanks
-----Original Message-----
From: Amaury DeCazanove [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 16, 2007 3:40 AM
To: user
Subject: Re:How to instantiate and populate XMLBeans without an XML
---------- Initial Header -----------
From : "Waswani, Yuvraj " [EMAIL PROTECTED]
To : [email protected]
Cc :
Date : Tue, 15 May 2007 18:05:55 -0400
Subject : How to instantiate and populate XMLBeans without an XML
Hi,
In my project, I have an existing technology which instantiates
JavaBeans and populates them using usual Bean introspection (eg. Like
in Struts - construction of Struts Form objects from http request
parameters .....)
The requirement is now to generate XML of our entire javabean data
model. So at runtime, I should be able to invoke the tool to
instantiate our Value objects (JavaBeans) and get an XML
representation out of them.. ( XML of entire VO object hierarchy) to
be sent to other systems.
I decided to explore XMLBeans but looks like the starting point for
any XMLBeans runtime (not compile time-I am not worried abt XSD)
operation is an existing XML (instance of XSD). So for instantiating
any XMLBean objects that are generated from scomp, you have to supply
an XML.
MyObjectDocument.parse(xml)...
In my case, it's the opposite. It's the XML which I have to finally
get my hands on, from Java objects. Is XMLBeans the right choice?
Basically, I did a simple Class.forName("MyObjectDocument") and it
threw a java.lang.InstatiationException.
==> MyObjectDocument.save(OutputStream);
Please suggest.
Thanks
Yuvraj
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This message contains information that may be privileged or confidential
and is the property of the Capgemini Group. It is intended only for the
person to whom it is addressed. If you are not the intended recipient,
you are not authorized to read, print, retain, copy, disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all
copies of this message.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]