Problem with DTD declaration

S

Simon Brooke

I have a DTD. If I declare it at the top of my XML file, as so:

<!DOCTYPE application PUBLIC "-//CYGNETS//DTD ADL 0.1//EN"
"http://libs.cygnets.co.uk/adl/unstable/ADL/schemas/adl-0.dtd">

then editors such as emacs (PSGML), Oxygen and Microsoft Visual Studio
parse the DTD and offer me context sensitive menus to insert the right
elements and the right attributes in the right places. So the DTD
really is there and really can be parsed. The top-level element in my
document structure is the element 'application', which is declared as
follows:

<!--
the application that the document describes: required top level
element

name: the name of this application
version: the version number of this application
revision: the revision of the ADL document
xmlns: XML namespace, in case required
-->
<!ELEMENT application ( specification?, documentation?, content?,
typedef*, group*, entity*)>
<!ATTLIST application
name CDATA #REQUIRED
version CDATA #IMPLIED
revision CDATA #IMPLIED
xmlns CDATA #IMPLIED>

So, everything's fine, you'd think. No problem.

But when I try to transform my document using XSLT, I get:

C:\Projects\ESA-McIntosh-CADLink\ESA-McIntosh-CADLink.build(74,4):
Could not perform XSLT transformation of 'C:\Projects\ESA-McIntosh-
CADLink\ESATool\ESA-McIntosh-CADLink.adl.xml' using stylesheet
'file:///L:/adl/unstable/ADL//transforms/adl2canonical.xslt'.
The 'application' element is not declared.

If I remove - or comment out - the DTD declaration line the transform
works perfectly.

This is not a bug in some particular XSL engine, because MSXSL and
Xalan behave identically (except for the exact text of the error
message). So clearly I've got something wrong. But - what is it?
 
S

Simon Brooke

When I try to loadhttp://libs.cygnets.co.uk/adl/unstable/ADL/schemas/adl-0.dtdwith
Firefox then all I get is a document saying "Virtual host not found on
this server".

Yes, sorry - not visible outside the firewall (intentionally).
 
R

Richard Tobin

I have a DTD. If I declare it at the top of my XML file, as so:

<!DOCTYPE application PUBLIC "-//CYGNETS//DTD ADL 0.1//EN"
"http://libs.cygnets.co.uk/adl/unstable/ADL/schemas/adl-0.dtd">
[/QUOTE]
When I try to load
http://libs.cygnets.co.uk/adl/unstable/ADL/schemas/adl-0.dtd with
Firefox then all I get is a document saying "Virtual host not found on
this server".

Perhaps Simon is using a catalog to resolve the public ID?

Simon: can you post a (small) complete XML document that exhibits
the problem, and ensure that the DTD is at a working URL?

-- Richard
 
S

Simon Brooke

When I try to load
http://libs.cygnets.co.uk/adl/unstable/ADL/schemas/adl-0.dtdwith
Firefox then all I get is a document saying "Virtual host not found on
this server".

Perhaps Simon is using a catalog to resolve the public ID?

Simon: can you post a (small) complete XML document that exhibits
the problem, and ensure that the DTD is at a working URL?[/QUOTE]

Yes - that would obviously be sensible!

<URL:http://www.jasmine.org.uk/~simon/tmp/testapp.adl.xml>

It should be possible to transform it with this XSLT:

<URL:http://www.jasmine.org.uk/~simon/tmp/adl2canonical.xslt>
 
R

Richard Tobin

M

Martin Honnen

Simon said:

Which version of MSXML are you using?
Transformation seems to work fine when using MSXML 3, 4 or 5, only MSXML
6 when you try to validate the XML input document against the DTD
complains: "The element 'application' is used but not declared in the
DTD/Schema.". I am currently not sure why that happens but if you don't
need validation and simply want to load the XML to transform it you can
always switch validation off by setting
document.validateOnParse = false
on the MSXML2.DOMDocument.6.0 you use to load the XML input.
 
M

Martin Honnen

Simon said:

I have no problems applying the stylesheet with Xalan Java. Saxon 6.5.5
complains about the problem already raised:

"Error at xsl:copy on line 348 of
http://www.jasmine.org.uk/~simon/tmp/adl2canonical.xslt:
Cannot write an attribute when there is no open start tag
Transformation failed: Run-time errors were reported"

Both Xalan and Saxon were run with Sun Java 1.5.
 
R

Richard Tobin

Martin Honnen said:
Which version of MSXML are you using?

Didn't there use to be a problem with Microsoft's parser requiring
xmlns attribute declarations to be #FIXED when validating? Or
something like that...

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top