xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aleksander Slominski <as...@cs.indiana.edu>
Subject Re: v1: efficient detecting if XML can be mapped to XmlPbject ...
Date Sat, 20 Mar 2004 00:32:02 GMT
Eric Vasilik wrote:

>It is a bit more complicated than this.  Take a look at
>org.apache.xmlbeans.impl.store.Root.autoTypedDocument for the
>implementation which associates the SchemaType with an instance.
>Basically, this function looks for a document type if there is a single
>document element at the root.  If there is a single attribute at the
>root, then an attribute document type is looked up.  If there is an
>xsi:type associated with the root (the container of a document element),
>then a global type is looked up.
>If your document being parsed is not a fragment and is well formed, then
>simply looking for a document type is sufficient:
>    XmlBeans.getContextTypeLoader().findDocumentType( QName )
hi Eric,

thanks for the answer.

however in my case i need to deal with XML fragments as i want to bind 
SOAP Body parts to XmlObjects if the binding can be done. so in this 
case i guess findElement() would work as it find global element names? 
including document types or i should call both?

also AFAIU i an do getFullJavaName() on the result to find what is 
mapped name of Java class implementing XML Schemas type?



>-----Original Message-----
>From: Aleksander Slominski [mailto:aslom@cs.indiana.edu] 
>Sent: Friday, March 19, 2004 3:31 PM
>To: xmlbeans-dev@xml.apache.org
>Subject: v1: efficient detecting if XML can be mapped to XmlPbject ...
>one way to check if XML fragment can be mapped by XmlBeans to known 
>XmlObject is try to do it:
>   try {
>            XmlObject response = XmlObject.Factory.parse(xmlString);
>        } catch (XmlException e) {
>            //not supported
>        }
>is there some better method? (efficiency)?
>if i know QName of top element (or its xsi:type if present) will
>!= null) { ... }
>be the best way to do such check?

The best way to predict the future is to invent it - Alan Kay

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/

View raw message