Yes it is possible to use namespaces within a DTD though it is not quite the
same as for schemas.
Xerces 1.2.3 and beyond understand namespaces though this can be switched
off by setting the appropriate feature.
parser.setFeature("http://xml.org/sax/features/namespaces",false);
Yes namespaces do work with Xerces as our software uses this feature
extensively.
An simple example of a DTD (called all-tests.dtd) would be:
<!ELEMENT test:top-element
(test:simple-structure | test:complex-structure | test:complex-structure2 |
test:complex-structure3 | test:complex-structure4)+>
<!ATTLIST test:top-element
xmlns:test CDATA #FIXED "http://deltaxml.com/docs/dtds/test/test-co1>
....
and the xml document would be:
<?xml version="1.0"?>
<!DOCTYPE test:top-element SYSTEM "all-tests.dtd">
<test:top-element ><test:complex-structure/>
</test:top-element>
Internet Explorer does not like displaying the xml file but Xerces can parse
it quite happily. The DTD must contain the prefix of the namespace.
Hope this helps.
Hilary
----- Original Message -----
From: Julian Templeman <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 31 March 2001 18:01
Subject: Using Namespaces and DTDs...
A question for the collected wisdom of the list...
Can anyone tell me whether it's possible to use a DTD with a document
that uses namespaces when you're using Xerces-J as the parser?
I know that DTDs and namespaces don't really mix, and I know the
suggested work-around of putting the xmlns: in the ATTLIST as a #FIXED
attribute. The problem is that it doesn't work with Xerces, which
throws a parser exception telling me that the root element 'must be
defined'.
Does anyone know whether this can be done?
Thanks,
julian
Templeman Consulting Limited
London and North Wales
http://www.templeman-consulting.co.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]