« Return to Thread: XML <=> JAVA in real time

Re: XML <=> JAVA in real time

by YelloY :: Rate this Message:

Reply to Author | View in Thread

Srinath C wrote:
Hi,
  Yes it is possible. You can do something like this :
        File schemaFile;
        InputStream xsdFileStream = new FileInputStream(schemaFile);
        XmlOptions options = new XmlOptions();
        options.setCompileDownloadUrls();
        options.setEntityResolver(new MyEntityResolver(schemaFile.getParent
()));
        SchemaTypeLoader stl = XmlBeans.loadXsd(new XmlObject[]{
XmlObject.Factory.parse(xsdFileStream)}, options);

        Using this "stl" variable you can iterate the entire schema
structure.
Thanks for hint Sirnath!
All those data structures used here are bit confusing for me, and I was playing with tem whole evening without any success. But finaly I've found a solution here: http://wiki.apache.org/xmlbeans/XmlBeansFaq#schemaPropertySchemaParticle
After a short analysis, it seems like the code provided there is exactly what I was looking for!

Once again thanks for good direction ;)

Regards, YelloY

 « Return to Thread: XML <=> JAVA in real time