Thanks for the help
Sorry for the typo with the namespace thing, however I am still getting
this error forgot to include the bindings.xjc file I
am using
So the command I am running is:
C:\PROGRA~1\Java\jdk1.6.0_06\bin\xjc.exe reply.xsd request.xsd -d src -b
bindings.xjb -extension
bindings.xjb
<jxb:bindings version="2.1" xmlns:jxb="
http://java.sun.com/xml/ns/jaxb"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns:xjc="
http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc">
<jxb:globalBindings>
<xjc:simple/>
</jxb:globalBindings>
<jxb:bindings schemaLocation="reply.xsd">
<jxb:schemaBindings>
<jxb:package name="com.mycomp.ordo.sched.reply"/>
</jxb:schemaBindings>
</jxb:bindings>
<jxb:bindings schemaLocation="request.xsd">
<jxb:schemaBindings>
<jxb:package name="com.mycomp.ordo.sched.request"/>
</jxb:schemaBindings>
</jxb:bindings>
base.xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema targetNamespace="
http://www.mycomp.com/ns/tf/agw
<
http://www.mycomp.com/ns/tf/agw> " attributeFormDefault="unqualified"
elementFormDefault="unqualified"
xmlns:agw="
http://www.mycomp.com/ns/tf/agw
<
http://www.mycomp.com/ns/tf/agw> "
xmlns:xs="
http://www.w3.org/2001/XMLSchema
<
http://www.w3.org/2001/XMLSchema> " >
<!-- *** Document content *** -->
<xs:element type="agw:Module" name="module"/>
<xs:element type="xs:string" name="origin-addr"/>
<xs:element type="xs:string" name="user"/>
<!-- *** Types *** -->
<xs:simpleType name="Module">
<xs:restriction base="xs:string">
<xs:enumeration value="dymo"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="body">
<xs:complexType>
<xs:sequence>
<xs:element type="agw:AnyContent" name="any-xing"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="AnyContent">
<xs:sequence>
<xs:any minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
reply.xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="unqualified"
xmlns:xs="
http://www.w3.org/2001/XMLSchema
<
http://www.w3.org/2001/XMLSchema> "
xmlns:agw="
http://www.mycomp.com/ns/tf/agw
<
http://www.mycomp.com/ns/tf/agw> ">
<!-- *** Import schemas *** -->
<xs:import schemaLocation="base.xsd"
namespace="
http://www.mycomp.com/ns/tf/agw"/
<
http://www.mycomp.com/ns/tf/agw"/> >
<!-- *** Document content *** -->
<xs:element type="AnyPotentiallyEmptyContent" name="reply"/>
<xs:element type="agw:AnyContent" name="error"/>
<!-- *** Types *** -->
<xs:complexType name="AnyPotentiallyEmptyContent">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
request.xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema targetNamespace="
http://www.mycomp.com/ns/tf/agw"
attributeFormDefault="unqualified"
elementFormDefault="unqualified"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns:agw="
http://www.mycomp.com/ns/tf/agw">
<!-- *** Import schemas *** -->
<xs:include schemaLocation="base.xsd"/>
<!-- *** Document content *** -->
<xs:element name="request">
<xs:complexType>
<xs:all>
<xs:element ref="agw:module"/>
<xs:element ref="agw:origin-addr"/>
<xs:element ref="agw:user"/>
<xs:element ref="agw:body"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
________________________________
From: Wolfgang Laun [mailto:wolfgang.laun_at_gmail.com]
Sent: den 11 mars 2009 13:30
To: users_at_jaxb.dev.java.net
Subject: Re: Any to Anies
This compiles OK if the agw namespace URL is corrected (www.mycomp.com
in all places)
and the missing '>' is added.
==========
public class Body {
@XmlElement(name = "any-xing", namespace = "", required = true)
protected AnyContent anyXing;
=========
I've been using xjc from jdk1.6.0_04.
-W
On Wed, Mar 11, 2009 at 12:23 PM, <christer.larsson_at_seb.se> wrote:
Hi.
Been using the <xjc:simple/> tag to generate my classes and am
experiencing strange behaviour
not sure if it is because of this tag or some error in my
schemata
I have the following schemata
base.xsd
See fixed version above:
request.xsd
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema targetNamespace="
http://www.pantor.com/ns/tf/agw"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
xmlns:xs="
http://www.w3.org/2001/XMLSchema"
xmlns:agw="
http://www.mycomp.com/ns/tf/agw"
<!-- *** Import schemas *** -->
<xs:include schemaLocation="base.xsd"/>
<!-- *** Document content *** -->
<xs:element name="request">
<xs:complexType>
<xs:all>
<xs:element ref="agw:module"/>
<xs:element ref="agw:origin-addr"/>
<xs:element ref="agw:user"/>
<xs:element ref="agw:body"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
reply.xsd
See fixed version above
The problem I am having is that the Body element (in base.xsd)
is being given the child element Error instead of
child element Any-xing and I don't understand how this could
happen. So the corresponding generated Body class looks like this:
<snip>
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"anyXing"
})
@XmlRootElement(name = "body")
public class Body {
@XmlElement(name = "any-xing", namespace = "", required =
true)
protected Error anyXing;
/**
* Gets the value of the anyXing property.
*
* @return
* possible object is
* {_at_link Error }
*
*/
public Error getAnyXing() {
return anyXing;
}
</snip>
/Christer