logo       

How to determine which Document to use: msg#00068

text.xml.xmlbeans.user

Subject: How to determine which Document to use

Hi,

I just switched from JaxMe to XMLBeans and here is my first question already.

 

I have a schema with several global elements.  When compiled I end up with several XXXDocument classes.

 

I have written a client that has a method like this

 

public Object getObject(String xml)

{

}

 

What I want to do here is

1)       determine which XXXDocument class to use to parse this xml.

2)       parse the xml with that XXXDocument.factory and return the XXXDocument

 

I could not find a clean way to do this.

 

2 clumsy solutions come to my mind but I am wondering if any of you have a better solution.

 

In the fist solution I search the xml string for a tag named by my global element.

In the second solution I create a list of available Document.Factory classes and parse the xml using each of them until I receive no XmlException.

 

How else can I determine which Document.Factory to use?

 

Thanks,

 

Dogan Atay

 

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise