Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XML DTD Validation, namespaces and best practices

From: "johnmack@-----.---" <--------@-----.--->
To: NULL
Date: 11/2/2005 11:09:00 AM
In my XML instances I want to use the XLink namespace for attributes on
certain elements.  I'm having quite a hard time determining how to
reflect this properly in my DTD and XML instances.

In my instance, to declare the namespace, I have this on my root
element:
     <root xmlns:xlink="http://www.w3.org/1999/xlink">
     ...
     <mylink xlink:href="http://foo.com">
     ....

Declaring things as I've done on the <root> element here, is this
proper?  Do I have to declare 'xmlns:xlink' as an attribute on <root>
in my DTD?  Or do attributes starting with 'xmlns:' trigger an innate
XML processing command and therefore do not need to be defined in a
DTD?

In my DTD I have explicitly defined "xlink:href" as attribute like so:
<!ELEMENT mylink        (#PCDATA)>
<!ATTLIST mylink
     xlink:href CDATA #REQUIRED>

Is this an acceptable approach or is the following a better way to do
it in the DTD?:
<!ATTLIST mylink
     xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">


I'm using the XML validator at:
"http://www.stg.brown.edu/service/xmlvalid/", and when I have 'Relax
namespace checks' selected, my XML documents validate. To clarify
further they only validate when I have the namespace in <root> ( as
noted above) *and* declaring explicitly 'xlink:href' as an attribute
(<!ATTLIST mylink xlink:href CDATA #REQUIRED>) on 'mylink' in my DTD.
Since the validator says this is OK, I'm using what I've done is OK?
It seems weird to have to explicitly declare 'xlink:href' as an
attribute in my DTD so I'm thinking this may not be proper.  Are there
other options for me to pursue?  Is there a suggested best practice?
It's been tough to find clear solutions for this matter.

Thanks for any insight,

John Mack



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent