Hi, I'll start this by saying "I'm new to XBeans" :-)

I have a large .xsd file and I've successfully created a jar from it (pojos,
document impl stuff, etc). The xsd represents a protocol for sending and
receiving messages. But now that I've started trying to use it I have got
stuck and not (yet) figured out answers via the getting started guide.

1) There are numerous examples of how to (eg) load an xml from disk:
[code]PurchaseOrderDocument poDoc =
PurchaseOrderDocument.Factory.parse(purchaseOrder);[/code]
But this assumes you know what type of xml needs parsing (in this case a
PurchaseOrder). What happens when you need to handle different types of xml
message? I could parse the xml into a org.w3c.dom.Document object, then is
there an XBeans-generated factory method which will examine that document
and return me the correct pojo (eg a PurchaseOrder) for the document?

2) A lot of the documentation I've seen so far seems to involve the parsing
of xml. But because I am implementing a request/response protocol, I also
want to create pojos (from the generated jar) and convert to a
org.w3c.dom.Document (or xml) for sending. How do I do this? Eg I am trying:
[code]RequestItemDocument rid = RequestItemDocument.Factory.newInstance();
or
impl.RequestedItemDocumentImpl ridi = new
impl.RequestedItemDocumentImpl(SchemaType);[/code]
and guess I need to then call setters on these objects, but I'm not getting
very far before I hit NPEs or similar (probably because my approach is
wrong).
Anyway, is this the correct approach? And what next - get the Document via
getDomNode(), etc?

Any suggestions (or pointers to the appropriate docs) welcome!
Thanks, Phil

Reply via email to