Hi Yogesh,

I'd be very surprised if this is an error in the XPP code, since it's a situation that comes up fairly often.

It looks like you're using the same XML and schema as in your previous email. Here's that XML:

<testJibx:Response xmlns:testJibx="http://test.jibx.namespace";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://test.jibx.namespace JibxTestNamespace.xsd ">
 <testJibx:ResponseData>
   <ID>ID</ID>
   ...

In this document the Response and ResponseData elements are in the http://test.jibx.namespace namespace, but ID (and the other child elements that follow it) are not in any namespace. This is the way namespaces are defined, irrespective of schema.

Your schema definition (again from the earlier email) starts like this:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://test.jibx.namespace";
xmlns="http://test.jibx.namespace";>
        <xsd:element name="Response" type="ResponseType"></xsd:element>
        <xsd:element name="ResponseError"
type="ResponseErrorType"></xsd:element>
        <xsd:element name="ResponseData"
type="ResponseDataType"></xsd:element>
        
        <xsd:complexType name="ResponseType">
                <xsd:sequence>
                                <xsd:element ref="ResponseData"
minOccurs="0" maxOccurs="1"></xsd:element>
                                <xsd:element ref="ResponseError"
minOccurs="0" maxOccurs="unbounded"></xsd:element>
                </xsd:sequence>
        </xsd:complexType>
        
        <xsd:complexType name="ResponseDataType">
                <xsd:sequence>
                        <xsd:element name="ID" type="xsd:string"
minOccurs="0" maxOccurs="1"></xsd:element>
                        <xsd:element name="lastname" type="xsd:string"
minOccurs="0" maxOccurs="1"></xsd:element>
                       ...

Because the schema element does not specify a value for the elementFormDefault attribute you're using the namespace only for the global elements in the schema, not for nested elements. So the XML actually matches your schema, and the problem appears to be in your binding definition. I know Cameron intends to look into this issue (don't you, Cameron :-) ), but in the meantime you may be able to just correct your binding definition yourself. If the namespace element has the attribute default="elements" you need to eliminate this attribute and instead just specify the namespace URI using the ns attribute on each mapping that corresponds to a global name in your schema (Response, ResponseError, ResponseData).

Hope that helps, and sorry for the long delay on getting you help on this.

 - Dennis

Arora, Yogesh wrote:

I ran into problem with XPP and namespaces. I was able to trace the problem
and possible fix in XPP code (latest source I downloaded from xpp site).
Details are below, but my question to Dennis is here: What version of XPP is
included in jibx and where I can get source code for that?

Thanks,
Yogesh

Details of problem:
We have document where root element declares the namespace and also has the
prefix of the namespace. Other elements(child elements) in the xml don't
have prefix. According to the XSD specification child element in this case
inherit the namespace from the parent.
http://www.w3.org/TR/xmlschema-0/#UnqualLocals But I was getting error from
Jibx. verifyNamespace in the MarshallingContext was failing because MFParser
was returning the NO_NAMESPACE for child element.

Here is the code fragment in the MXParser.parseStartTag

               if(prefix == null) { // no prefix and no uri => use default
namespace
                            uri = NO_NAMESPACE;
                }

Here is the possible fix :

               if(prefix == null) { // no prefix and no uri => use default
namespace
                if (depth  > 1 && elUri[ depth - 1] !=  null &&
!elUri[ depth - 1].equals(NO_NAMESPACE) ) {
                        uri = elUri[ depth - 1];
                } else {
                            uri = NO_NAMESPACE;
                }



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to