users@jaxb.java.net

Re: xjc 2.2 and the hash character

From: Pavel Bucek <Pavel.Bucek_at_Sun.COM>
Date: Mon, 04 Jan 2010 09:59:19 +0100

Hello,

actually, I remember committing this change and as Wolfgang wrote, this
was made to align reference implementation with specification - this is
a bug in versions <2.2.

So that means you use invalid (from JAXB perspective) namespace declaration.

Pavel

Wolfgang Laun wrote:
> Hi Adam,
>
> please check the results as you posted them in relation to the
> xjc version. Your post would indicate that the newest xjc drops
> the URI fragment part entirely, as opposed to 2.1.12.
>
> There is indeed a difference between 2.2 and earlier versions,
> but I find that 2.2 does the right thing, i.e., according to the
> JAXB specification, section D.5.
>
> -W
>
> On Tue, Dec 29, 2009 at 6:23 PM, Adam Zell <zellster_at_gmail.com
> <mailto:zellster_at_gmail.com>> wrote:
>
> Hello,
>
> I have two basic schema files. The second schema file imports the
> first, and uses the hash character in its target namespace.
>
> foo.xsd:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema elementFormDefault="qualified"
> attributeFormDefault="unqualified"
> targetNamespace="http://www.foo.com/ns"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:foo="http://www.foo.com/ns">
> <xs:element name="Foo">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="foo" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> bar.xsd:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema elementFormDefault="qualified"
> attributeFormDefault="unqualified"
> targetNamespace="http://www.foo.com/ns#bar"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:bar="http://www.foo.com/ns#bar">
> <xs:import namespace="http://www.foo.com/ns"
> schemaLocation="foo.xsd"/>
> <xs:element name="Bar">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="bar" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> xjc 2.1.12 reports the following:
>
> $ ./jaxb-ri-20090708/bin/xjc.bat -d build/classes -verbose *.xsd
> parsing a schema...
> compiling a schema...
> [INFO] generating code
> unknown location
>
> com\foo\ns\Foo.java
> com\foo\ns\ObjectFactory.java
> com\foo\ns\package-info.java
> com\foo\ns_bar\Bar.java
> com\foo\ns_bar\ObjectFactory.java
> com\foo\ns_bar\package-info.java
>
> xjc 2.2 however reports:
>
> $ ./jaxb-ri-20091104/bin/xjc.bat -d build/classes -verbose *.xsd
> parsing a schema...
> compiling a schema...
> [INFO] generating code
> unknown location
>
> com\foo\ns\Bar.java
> com\foo\ns\Foo.java
> com\foo\ns\ObjectFactory.java
> com\foo\ns\package-info.java
>
> Is the difference in xjc behavior due to the hash character in
> bar's target namespace?
>
> Thanks!
>
> --
> Adam
> zellster_at_gmail.com <mailto:zellster_at_gmail.com>
>
>