users@jaxb.java.net

RE: jxb:bindings with DTD

From: Jacob Zwiers <Jacob.Zwiers_at_tpsgc-pwgsc.gc.ca>
Date: Mon, 14 Jun 2010 08:03:54 -0400

Michael ... I recently posted with what sounds like a similar issue (see https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgNo=9767).

The solution was to change the @XmlAttribute mapping to include a namespace parameter:

   @XmlAttribute( name="space", namespace="http://www.w3.org/XML/1998/namespace" )

That is, breaking up the name="xml:space" into a name + namespace combination.

Since posting, I discovered this in the "unofficial user's guide":

   DTD long predates XML namespace, although people since
   then developed various techniques to use XML namespaces
   in conjunction with DTD. Because of this, XJC is
   currently unable to reverse-engineer the use of XML
   namespace from DTD. If you compile DTDs that use those
   techniques, you'd either manuallly modify the generated code,
   or you can try a tool like Trang that can convert DTD into
   XML Schema in ways that better preserves XML namespaces.
      (https://jaxb.dev.java.net/guide/Compiling_DTD.html)
        

Be aware that playing with the "xml:" namespace could give you trouble on unmarsalling. See the javadoc for the XMLStreamReader.getNamespaceURI(String) method: http://java.sun.com/javase/6/docs/api/javax/xml/stream/XMLStreamReader.html#getNamespaceURI%28java.lang.String%29

Hope that helps ...
jz

-----Original Message-----
From: Michael Jurke [mailto:jurke_at_zedat.fu-berlin.de]
Sent: Friday, June 11, 2010 4:35 PM
To: users_at_jaxb.dev.java.net
Subject: jxb:bindings with DTD

Hi,

with some bindings.xjb I can resolve name conflicts appearing in an XSD schema.
In the nodes attribute of xjb:bindings tag uses xPath to distinguish the node. But how can I apply it to an DTD? Is this possible?

Clearly spoken, I have

<!ATTLIST %SVG.style.qname;
     xml:space ( preserve ) #FIXED 'preserve'
     %SVG.Core.attrib;
     type %ContentType.datatype; #REQUIRED
     media %MediaDesc.datatype; #IMPLIED
     title %Text.datatype; #IMPLIED
>

How to define an alternative name for xml:space?

Thanks a lot
Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net