aspose file tools*
The moose likes XML and Related Technologies and the fly likes Is there a way to put the Schema in the same java object (like Document) as XML? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Is there a way to put the Schema in the same java object (like Document) as XML?" Watch "Is there a way to put the Schema in the same java object (like Document) as XML?" New topic
Author

Is there a way to put the Schema in the same java object (like Document) as XML?

Dan Bizman
Ranch Hand

Joined: Feb 25, 2003
Posts: 387
Is there a way in the XML APIs to make one Document object that has both the schema and XML in it? Can i then get the XML elements'/attributes' metadata from that object instead of having to do the usual two steps:

* Get schemaTypeInfo
* using schemaTypeInfo (name, namespace) look it up in schema object
Dan Bizman
Ranch Hand

Joined: Feb 25, 2003
Posts: 387
In case anyone's interested, i solved this in Xerces. Simply get the domConfiguration and pass the following parameter:



Then you get an Element from the document root and do the following cast:

XSElementDeclaration elementMetaData = ( ( ElementPSVI ) element ).getElementDeclaration();

From there you're using schema stuff!
[ September 29, 2006: Message edited by: Dan Bizman ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is there a way to put the Schema in the same java object (like Document) as XML?
 
Similar Threads
Unable to validate XML against the schema
null pointer exception
Writer to InputStream or source
Databinding - ADB and none
SAXParser not calling characters()