users@jaxb.java.net

Re: xjc 2.2 and the hash character

From: Wolfgang Laun <wolfgang.laun_at_gmail.com>
Date: Mon, 4 Jan 2010 10:31:30 +0100

On Mon, Jan 4, 2010 at 9:59 AM, Pavel Bucek <Pavel.Bucek_at_sun.com> wrote:

> 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.
>

Hmm, I'd say it's a valid URI (at least as far as I understand the RFC), and
the Spec doesn't prohibit using the segment part; it's just that JAXB has to
convert '#' as it can't be in a package name.

(Whether or not using a segment part should/could/might result in a
subpackage would
be interesting to discuss, but that's perhaps a rather philosphical issue.)

-W


>
> 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>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>