Anthony,

 

You'll need to navigate the SchemaTypeSystem yourself. XMLBeans doesn't include 
such an utility a this moment.

Also, if you know the document class, there is a static field an all the 
generated interfaces called type that points to its corresponding SchemaType, 
you can use that one as the stating point of the "path" navigation.

 

Cezar

 

________________________________

From: Anthony Fryer [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 26, 2008 6:42 PM
To: dev@xmlbeans.apache.org
Subject: Can I get a SchemType from an XPath without a document instance?

 

Given a schema document and the xpath of an element in a 'not yet created' xml 
document that is an instance of the schema, can i get the corresponding schema 
type of that element somehow?  I know that if the XmlObject already exists, I 
can just find the XmlObject using selectPath and then get the schemaType from 
the XmlObject, but what can i do if the XmlObject doesn't exist and I only have 
an xpath?  Is this possible?

Regards,

Anthony

> Date: Fri, 22 Aug 2008 12:10:44 -0700
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: [jira] Commented: (XMLBEANS-100) Support of DOM Level 3
> 
> 
> [ 
> https://issues.apache.org/jira/browse/XMLBEANS-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12624957#action_12624957
>  ] 
> 
> Robert H. Pollack commented on XMLBEANS-100:
> --------------------------------------------
> 
> What works for me as a workaround is to copy the DOM tree created by XMLBeans 
> into a Document created by the JDK's DocumentBuilder. In other words, suppose 
> we have a Document that has been obtained by something like this:
> 
> Document doc1 = (Document) myXMLObject.newDomNode();
> 
> Create a DocumentBuilder in the usual way and use it to build a new Document:
> 
> DocumentBuilder builder = 
> DocumentBuilderFactory.newInstance().newDocumentBuilder();
> Document doc2 = builder.newDocument();
> 
> (you'll need exception handlers not shown here). Then import the first 
> Document into the second:
> 
> Element newRoot = (Element) doc2.importNode (doc1.getDocumentElement(), true);
> doc2.appendChild (newRoot);
> 
> Now do your work--transformations or whatever--with doc2, which will be a DOM 
> level 3 Document.
> 
> As I say, this is working fine for me; the JVM has no problem handling two 
> different DOM implementations, a level 2 implementation from XMLBeans and a 
> level 3 implementation from the JDK. And the JDK's implementation seems to 
> have no trouble importing nodes from XMLBeans' implementation. Admittedly, 
> this would not scale to large trees; I have no workaround to suggest when the 
> tree is so large that copying it is expensive.
> 
> If, afterward, you need to turn this back into an XmlObject, it should be 
> possible to do this by using XmlObject.Factory.parse (doc2), although I 
> haven't tested this since my application doesn't need it. 
> 
> > Support of DOM Level 3
> > ----------------------
> >
> > Key: XMLBEANS-100
> > URL: https://issues.apache.org/jira/browse/XMLBEANS-100
> > Project: XMLBeans
> > Issue Type: New Feature
> > Components: DOM
> > Affects Versions: Version 2
> > Reporter: Walter Dorninger
> > Assignee: Jacob Danner
> > Priority: Minor
> > Fix For: TBD
> >
> >
> > Support of DOM Level 3 would be a powerful feature.
> 
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

________________________________

to the movies Shout your Messenger buddies 
<http://www.livelife.ninemsn.com.au/compIntro.aspx?compId=4590%20> 

Reply via email to