I’m not quite fully understanding your situation.  When your exception happens, are you loading an XMLInputStream, or parsing XML text?  If XML text, where does this text come from?  Is it well formed (are all the namespaces defined)?


-----Original Message-----
From: Alexander Paransky [mailto:Alexander.Paransky@Overture.com]
Tuesday, March 09, 2004 10:12 AM
To: xmlbeans-user@xml.apache.org
Cc: Eric Vasilik
Subject: RE: XmlOptions.setLoadAdditionalNamespaces does not appear to work



That is exactly what I am trying to do, so then I have this problem.  The Weblogic AbstractCodec.deserialize() is called and I am required to decode the XMLInputStream.  Weblogic has already parsed out the SOAP header and I am only given the document (DOCUMENT/LITERAL encoding) which I now need to parse. 

Since Weblogic already parsed out the header, I can get at the namespaces defined in the <soapenv:Envelope by using various javax.xml APIs.  The parameter which I am trying to parse however, does not explicitly re-declare the namespaces, but does make references to them, such as xsi:type="...".

The overall XML starting with <soapenv:Envelope is valid.  However, the subset which makes up the parameter, does not have enough namespace definitions to be parsed in isolation.  I was hoping that setting additional namespaces on load would act as if those namespaces have been defined previously and help the "resolver" resolve the namespaces correctly in the XML fragment which is the parameter.

Without this working, I am thinking I would have to "inject" the namespaces into the StringBuffer containing the XML to be parsed, prior to parsing it.  It's not all that pretty.  I have to search for an insertion point, and then insert the namespace declarations that I can retrieve from the headers.  It is a solution, but I was hoping that XmlOptions.setLoadAdditionalNamespaces() would accomplish this task.

Is this not a common problem when using DOCUMENT/LITERAL encoding and having XMLBeans parse out a sub-xml-document fragment?


Content-Type: text/plain;
Subject: XmlOptions.setLoadAdditionalNamespaces does not appear to work
Date: Tue, 9 Mar 2004 09:53:56 -0800
From: Eric Vasilik <ericvas@bea.com>

Your description is not entirely clear to me, but the option to load
additional namespaces does not affect parsing.  It simply adds the given
namespaces after parsing.  If the incoming xml to be parsed depends on
those namespaces to be correct, you will get a parse error, which seems
to be what you are getting.

- Eric

-----Original Message-----
From: Alex Paransky [mailto:apara@standardset.com]
Sent: Tuesday, March 09, 2004 4:04 AM
To: xmlbeans-user@xml.apache.org
Subject: XmlOptions.setLoadAdditionalNamespaces does not appear to work

I am using Document Literal form of argument passing in my weblogic
webservice.  An Axis client is creating a soap message such that the xsi

schema declaration is in the <soapenv:Envelope tag.  Prior to parsing of

my document, I configure XmlOptions.setLoadAdditionalNamespaces to add a

proper reference to the xsi namespace.  Even after doing this, I still
get an exception indicating that xsi is not a bound namespace.

Here is an example of the XML that the client is sending:

  <requestArray xmlns="http://www.overture.com/service/display">
..... document that uses xsi......

As you can see, the document it's self does not define the xsi schema. 
It is defined in the <soapenv:Envelope tag.

The particular exception occurs in the following code from Root.load
(xmlbeans v1):

           catch ( SAXParseException e )

                XmlError err =
                        (String) XmlOptions.safeGet( options,
                        e.getLineNumber(), e.getColumnNumber(), -1 );

                throw new XmlException( err.toString(), e, err );

Any ideas?



(crossposted to xmlbeans-user@xml.apache.org)
(crossposted to weblogic.developer.interest.xmlbeans)