Ok, here goes semi-minimalized example:
--- Document.xsd ---
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:eanucc="urn:ean.ucc:2"
targetNamespace="urn:ean.ucc:2"
elementFormDefault="unqualified"
attributeFormDefault="unqualified"
version="2.2">
<xsd:element name="document" type="eanucc:DocumentType" abstract="true"/>
<xsd:complexType name="DocumentType" abstract="true">
<xsd:sequence>
<xsd:element name="contentVersion" type="eanucc:VersionType"
minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="VersionType">
<xsd:sequence>
<xsd:element name="versionIdentification" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
--- ---
--- CatalogueItemNotification.xsd ---
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:gdsn="urn:ean.ucc:gdsn:2"
xmlns:eanucc="urn:ean.ucc:2"
targetNamespace="urn:ean.ucc:gdsn:2"
elementFormDefault="unqualified"
attributeFormDefault="unqualified"
version="2.2">
<xsd:import namespace="urn:ean.ucc:2" schemaLocation="Document.xsd"/>
<xsd:element name="catalogueItemNotification"
type="gdsn:CatalogueItemNotificationType"
substitutionGroup="eanucc:document"/>
<xsd:complexType name="CatalogueItemNotificationType">
<xsd:complexContent>
<xsd:extension base="eanucc:DocumentType">
<xsd:sequence>
<xsd:element name="catalogueItem" type="gdsn:CatalogueItemType"/>
</xsd:sequence>
<xsd:attribute name="isReload" type="xsd:boolean" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="CatalogueItemStateType">
<xsd:attribute name="cancelDate" type="xsd:dateTime"/>
</xsd:complexType>
<xsd:complexType name="CatalogueItemType">
<xsd:sequence>
<xsd:element name="catalogueItemState"
type="gdsn:CatalogueItemStateType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
--- ---
--- binding file ---
<?xml version="1.0" encoding="UTF-8"?>
<cbf:binding xmlns:cbf="http://www.castor.org/SourceGenerator/Binding"
defaultBindingType="type">
<cbf:package>
<cbf:name>se.exder.external.gs1.gdsn2p2</cbf:name>
<cbf:namespace>urn:ean.ucc:2</cbf:namespace>
</cbf:package>
<cbf:package>
<cbf:name>se.exder.external.gs1.gdsn2p2</cbf:name>
<cbf:namespace>urn:ean.ucc:gdsn:2</cbf:namespace>
</cbf:package>
</cbf:binding>
--- ---
--- Java code ---
CatalogueItemNotificationType catalogueItemNotification = new
CatalogueItemNotificationType();
final VersionType version = new VersionType();
version.setVersionIdentification("1.0");
catalogueItemNotification.setContentVersion(version);
catalogueItemNotification.setIsReload(false);
final CatalogueItemType catalogueItem = new CatalogueItemType();
catalogueItem.setCatalogueItemState(new CatalogueItemStateType());
catalogueItemNotification.setCatalogueItem(catalogueItem);
Marshaller marshaller = new Marshaller(new PrintWriter(System.out));
marshaller.setNamespaceMapping("gdsn", "urn:ean.ucc:gdsn:2");
marshaller.setNamespaceMapping("eanucc", "urn:ean.ucc:2");
marshaller.marshal(catalogueItemNotification);
--- ---
--- Expected (unmarshallable) output, formatted ---
<gdsn:CatalogueItemNotificationType xmlns:gdsn="urn:ean.ucc:gdsn:2"
xmlns:eanucc="urn:ean.ucc:2" isReload="false">
<contentVersion>
<versionIdentification>2.0</versionIdentification>
</contentVersion>
<catalogueItem>
<catalogueItemState/>
</catalogueItem>
</gdsn:CatalogueItemNotificationType>
--- ---
--- Actual (non-unmarshallable) output, formatted ---
<gdsn:CatalogueItemNotificationType xmlns:gdsn="urn:ean.ucc:gdsn:2"
xmlns:eanucc="urn:ean.ucc:2" isReload="false">
<eanucc:contentVersion>
<versionIdentification>1.0</versionIdentification>
</eanucc:contentVersion>
<gdsn:catalogueItem>
<gdsn:catalogueItemState/>
</gdsn:catalogueItem>
</gdsn:CatalogueItemNotificationType>
--- ---
/Mattias
Werner Guttmann wrote (2008-03-11 21:49):
Matthias,
rather than looking for a solution/reply to your first question, I'd
like to know more about what the problem is with the incorrect namespace.
Werner
Mattias Jiderhamn wrote:
Should I be able to use an elementBinding/java-class to map an
element to a class, while having defaultBindingType="type" for the
mapping file???
What I want to do is generate classes for all complex type plus one
particular element...
((This, in turn, is because the complex type class do not marshall
namespaces correctly when the schema is
elementFormDefault="unqualified"))
/Mattias
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email