Yes, it is possible. Assuming that xmlObject represents the document that you have built and schemaType the Schema type that you determined the document conforms to, call
 
XmlObject newObject = xmlObject.changeType(schemaType).
 
Then, call newObject.validate() normally.
 
Notes:
1. newObject is a new object and you can't use the old one anymore (because in general you may get a different Java impl class) but the process is efficient, there is no copying/reparsing or anything of the kind going on
2. you need to make sure that if the object refers to a document (xmlObject.newCursor().isStartdoc() returns true) then the type also refers to a document type (schemaType.isDocumentType() also returns true)
 
Radu


From: Asaf Lahav [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 19, 2006 6:25 AM
To: [email protected]
Subject: Bind a schema to an XmlObject

I have an xml document which is dynamically built.

It is impossible for me to know what schema the xml document will conform to until it is entirely built.

 

Is it possible to Parse the xml document into an XmlObject, bind a schema to it and validate?

If possible, How?

 

Thanks in advance,

Asaf

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Reply via email to