Although the repercussions of this approach haven't been fully explored yet,
when working on the Singularity System (plug:
<
http://singularity-sys.sourceforge.net/>
http://singularity-sys.sourceforge.net/ and
<
http://sourceforge.net/projects/singularity-sys/>
http://sourceforge.net/projects/singularity-sys/ ), we created our own
datatypes that map to URI and URL. Here is an excerpt from the schema:
Note that the default namespace is the XMLSchema namespace, while "this" is
the namespace prefix for the targetNamespace of this schema.
-- begin excerpt --
<simpleType name="URI">
<annotation>
<appinfo>
<jaxb:javaType name="java.net.URI" parseMethod="new"
printMethod="toString" />
</appinfo>
</annotation>
<restriction base="anyURI">
</restriction>
</simpleType>
<simpleType name="URL">
<annotation>
<appinfo>
<jaxb:javaType name="java.net.URL" parseMethod="new"
printMethod="toString" />
</appinfo>
</annotation>
<restriction base="this:URI">
</restriction>
</simpleType>
-- end excerpt --
There are a few reasons why we took this approach, but let me know if you
have any opinions (positive or negative), or what your experiences are with
any different approaches.
Brian Franklin
-----Original Message-----
From: Gary Gregory [mailto:ggregory_at_seagullsw.com]
Sent: Monday, June 23, 2003 4:36 PM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: xs:anyURI and java.net.URL
Hello,
Has any one encountered any issues using JAXB to map xs:anyURI to
java.net.URL? Good idea, bad idea?
Thanks,
Gary