You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by Ra...@wellsfargo.com on 2006/02/02 20:09:49 UTC

Hi Issue with Parsing....

Hi 

  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
WFHMEnvelope@http://service.wellsfargo.com/provider/emf/: document
element namespace mismatch expected
"http://service.wellsfargo.com/provider/emf/" got ""
	at
org.apache.xmlbeans.impl.store.Root.verifyDocumentType(Root.java:510)
	at
org.apache.xmlbeans.impl.store.Root.autoTypedDocument(Root.java:426)
	at org.apache.xmlbeans.impl.store.Root.loadXml(Root.java:1049)
	at org.apache.xmlbeans.impl.store.Root.loadXml(Root.java:1033)
	at
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoa
derBase.java:333)
	at
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoa
derBase.java:244)
	at
com.wellsfargo.service.provider.emf.WFHMEnvelopeDocument$Factory.parse(U
nknown Source)
	at
com.wellsfargo.ilonline.shared.service.credit.Test.main(Test.java:35)
Exception in thread "main" 

Thanks
Ramesh.

Re: Hi Issue with Parsing....

Posted by Juha Mäkeläinen <ju...@op.fi>.
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, Ramesh.Chitturi@wellsfargo.com
>> <Ra...@wellsfargo.com> 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:epfrederick@gmail.com]
>>> 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, Ramesh.Chitturi@wellsfargo.com
>>> <Ra...@wellsfargo.com> 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
>>> > WFHMEnvelope@http://service.wellsfargo.com/provider/emf/:
>>> > document element namespace mismatch expected
>>> > "http://service.wellsfargo.com/provider/emf/" got ""
>>> > ...
>>> >
>>> > Thanks
>>> > Ramesh.
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
>> For additional commands, e-mail: dev-help@xmlbeans.apache.org
>> 
>> 
> 
> 

-- 
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: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


Re: Hi Issue with Parsing....

Posted by jpek <ju...@op.fi>.
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, Ramesh.Chitturi@wellsfargo.com
> <Ra...@wellsfargo.com> 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:epfrederick@gmail.com]
>> 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, Ramesh.Chitturi@wellsfargo.com
>> <Ra...@wellsfargo.com> 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
>> > WFHMEnvelope@http://service.wellsfargo.com/provider/emf/:
>> > document element namespace mismatch expected
>> > "http://service.wellsfargo.com/provider/emf/" got ""
>> > ...
>> >
>> > Thanks
>> > Ramesh.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: dev-help@xmlbeans.apache.org
> 
> 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org


Re: Hi Issue with Parsing....

Posted by Edward Frederick <ep...@gmail.com>.
Can you provide the XML String? I think there are a couple possibilities.

On 2/2/06, Ramesh.Chitturi@wellsfargo.com
<Ra...@wellsfargo.com> wrote:
>
>
> Hi
>
>   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
> WFHMEnvelope@http://service.wellsfargo.com/provider/emf/:
> document element namespace mismatch expected
> "http://service.wellsfargo.com/provider/emf/" got ""
>
>         at
> org.apache.xmlbeans.impl.store.Root.verifyDocumentType(Root.java:510)
>         at
> org.apache.xmlbeans.impl.store.Root.autoTypedDocument(Root.java:426)
>         at
> org.apache.xmlbeans.impl.store.Root.loadXml(Root.java:1049)
>         at
> org.apache.xmlbeans.impl.store.Root.loadXml(Root.java:1033)
>         at
> org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:333)
>         at
> org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:244)
>         at
> com.wellsfargo.service.provider.emf.WFHMEnvelopeDocument$Factory.parse(Unknown
> Source)
>         at
> com.wellsfargo.ilonline.shared.service.credit.Test.main(Test.java:35)
> Exception in thread "main"
>
> Thanks
> Ramesh.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org