Hi,

When we marshal Java objects created using Castor's source generator,
each element is prefixed with "ns1" in the resultant XML.  Could this be
a problem with our namespace declaration in the XML schema, or is there
some way to force Castor to assume the default namespace when
marshalling?

We've tried specifying a default namespace
(xmlns="http://www.w3.org/2001/XMLSchema";) to no avail.  Any ideas?

Here's an example of an XML schema that causes this behavior:

<xsd:schema targetNamespace="http://www.geobot.com/namespace";
xmlns:gbt="http://www.geobot.com/namespace";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
elementFormDefault="qualified" version="1.0.0">
    <xsd:element name="person">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="name" type="xsd:string"/>
                <xsd:element name="address" type="xsd:string"/>
                <xsd:element name="ID" type="gbt:PersonIDType"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:simpleType name="PersonIDType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="EMPLOYEE"/>
            <xsd:enumeration value="CUSTOMER"/>
            <xsd:enumeration value="MANAGER"/>
        </xsd:restriction>
    </xsd:simpleType>
</xsd:schema>

------------

The resultant XML would look like:

<ns1:person>
    <ns1:name>John Doe</ns1:name>
    <ns1:address>John Doe</ns1:address>
    <ns1:ID>EMPLOYEE</ns1:ID>
</ns1:person>

------------

Scott Brown
Geobot

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to