Quite simple, (as soon the answer is found :)

  XmlOptions opts = new XmlOptions();
  opts.setDocumentType(MyXMLBeansDocument.type);
  MyXMLBeansDocument dok = MyXMLBeansDocument.Factory.parse(myXmlAsString,
opts);

Yes, the parse method can have more tha one argument. 

(I think the turorials jump over the most basic examples.)

    Juha


Juha Mäkeläinen wrote:
> 
> How about parsing an XML document which I can't change? How I can tell the
> right xmlns namespace to the parser, if the input message doesn't have an
> "xmlns=" attribute? 
> 
> (Of course I could edit my input string and insert an "xmlns=..." clause
> ;)
> 
>            Juha
> 
> 
> Edward Frederick wrote:
>> 
>> Hi Ramesh,
>> 
>> Although I don't have a copy of your schema, it appears you're
>> namespace qualified.
>> 
>> Depending on if you have elementFormDefault="unqualified" (the
>> default) or "qualified", you may also have to qualify the elements
>> within your document element.
>> 
>> In short, one these should work:
>> 
>> 
>> <WFHMEnvelope xmlns="http://service.wellsfargo.com/provider/emf/";>
>> <eMFContext>
>> <sessionid>9bd99e77-8ddd-11da-9be1-b7656329eea5</sessionid>
>> ... etc..
>>  </WFHMEnvelope>
>> 
>> or ...
>> 
>> Let me know how it goes!
>> 
>> Ed
>> 
>> 
>> On 2/2/06, [EMAIL PROTECTED]
>> <[EMAIL PROTECTED]> wrote:
>>> Hi Edward,
>>>
>>>   This is the string I am parsing...I am trying to print the service
>>> element value...
>>>
>>> <WFHMEnvelope>
>>>   <eMFContext>
>>>   <sessionid>9bd99e77-8ddd-11da-9be1-b7656329eea5</sessionid>
>>>   ...
>>>   </eMFContext>
>>> </WFHMEnvelope>
>>>
>>> Thanks
>>> Ramesh.
>>>
>>> -----Original Message-----
>>> From: Edward Frederick [mailto:[EMAIL PROTECTED]
>>> Sent: Thursday, February 02, 2006 2:09 PM
>>> To: dev@xmlbeans.apache.org
>>> Subject: Re: Hi Issue with Parsing....
>>>
>>> Can you provide the XML String? I think there are a couple
>>> possibilities.
>>>
>>> On 2/2/06, [EMAIL PROTECTED]
>>> <[EMAIL PROTECTED]> wrote:
>>> >
>>> >   I am new to XmlBeans I got this exception while parsing the xml
>>> String.
>>> >
>>> > org.apache.xmlbeans.XmlException:
>>> > c:\ramesh\ResponseSample.xml:0: error: The document is not a
>>> > [EMAIL PROTECTED]://service.wellsfargo.com/provider/emf/:
>>> > document element namespace mismatch expected
>>> > "http://service.wellsfargo.com/provider/emf/"; got ""
>>> > ...
>>> >
>>> > Thanks
>>> > Ramesh.
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Hi-Issue-with-Parsing....-tf1048876.html#a8427529
Sent from the Xml Beans - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to