I have the following DTD which declares an xmlns attribute to handle the default namespace (the DTD comes from RosettaNet):
<!ENTITY % common-attributes "id CDATA #IMPLIED" >
<!ELEMENT Preamble (
standardName ,
standardVersion ) >
<!ATTLIST Preamble xmlns CDATA #FIXED
"http://www.rosettanet.org/RNIF/V02.00" >
<!ELEMENT standardName
( GlobalAdministeringAuthorityCode ) >
<!ELEMENT GlobalAdministeringAuthorityCode
( #PCDATA ) >
<!ELEMENT standardVersion
( VersionIdentifier ) >
<!ELEMENT VersionIdentifier
( #PCDATA ) >
When I attempt to validate the following XML against the DTD above using the MSXML parser, I get an error indicating that a default namespace declaration in the DTD is not supported. When I attempt to validate the XML below using .NET, I get, "The 'x' character, hexadecimal value 0x78, cannot be included in a name."
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Preamble SYSTEM "Preamble_MS_V02_00.dtd">
<Preamble>
<standardName>
<GlobalAdministeringAuthorityCode>RosettaNet</GlobalAdministeringAuthorityCode>
</standardName>
<standardVersion>
<VersionIdentifier>V02.00</VersionIdentifier>
</standardVersion>
</Preamble>
To work around this in my code, I change the <Preamble> root element above to:
<Preamble xmlns="http://www.rosettanet.org/RNIF/V02.00">
Then, MSXML is happy.
My question is: Is the default namepace declaration in the DTD above in conjunction with the XML above considered valid? Or, would the valid form be the root element containing the xmlns attribute?
J. Keith Wedinger
Senior Software Developer
Sterling Commerce
keith_wedinger@stercomm.com