Hi Dan

I'm not sure on this, but it may be worth a try. If you've got the
namespaces you may be able to construct something like this:

<xml-fragment xmlns:xsd="http://www.w3.org/2001/XMLSchema";
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >
    <Foo xsi:type="xsd:string" xmlns="http://foo.com/bar"; > ... </Foo>
</xml-fragment>

And then get XmlBeans to parse it. I think there's special code in there
to parse <xml-fragment>.

Don't know much more about it than that, but hope that helps.

Cheers,

Lawrence

> -----Original Message-----
> From: Dan Diephouse [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 16, 2005 12:51 PM
> To: [email protected]
> Subject: Parsing Document Fragments with StAX
> 
> We're having an issue using XmlBeans to parse portions of a StAX
stream.
> Take for instance a request like so:
> 
> <soapenv:Envelope
>    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
>    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>    <soapenv:Body>
>                    <Foo
> xsi:type="xsd:string"xmlns="http://foo.com/bar";>T</RefNum>
>            </Header>
>        </Request>
>    </soapenv:Body>
> 
> If we're using XmlBeans to only parse the Foo element, this causes an
> issue. When XmlBeans generates the document that represents Foo it
> doesn't pull the xsd namespace from Envelope (which makes sense). But
> XmlBeans doesn't want to parse the document unless there is that xsd
> declaration. An example exception:
> 
> org.apache.xmlbeans.XmlRuntimeException: error: cvc-elt.4.1: Invalid
> xsi:type qname: 'xsd:string' in element
>
[EMAIL PROTECTED]://www.paraware.com/2005/PriceAndAvailabilityCheckRequest
>       at
>
com.paraware.webservice.selfservice.PriceAndAvailabilityServiceImpl.chec
kP
> riceAndAvailability(PriceAndAvailabilityServiceImpl.java:94)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 
> Any ideas on solutions for this issue? If we saved the namespace
> declarations, is it possible to redeclare the namespaces somewhere
> before validation?
> 
> Thanks,
> 
> - Dan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



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

Reply via email to