Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Problem with DTD declaration

Reply
Thread Tools

Problem with DTD declaration

 
 
Simon Brooke
Guest
Posts: n/a
 
      08-07-2008
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?
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      08-07-2008
Simon Brooke wrote:
> 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">


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


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
Simon Brooke
Guest
Posts: n/a
 
      08-07-2008
On Aug 7, 1:24*pm, Martin Honnen <mahotr...@yahoo.de> wrote:
> Simon Brooke wrote:
> > 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">

>
> 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).
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      08-07-2008
In article <489ae963$0$11740$>,
Martin Honnen <> wrote:

>> 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">


>When I try to load
>http://libs.cygnets.co.uk/adl/unstab...emas/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
--
Please remember to mention me / in tapes you leave behind.
 
Reply With Quote
 
Simon Brooke
Guest
Posts: n/a
 
      08-07-2008
On Aug 7, 2:25*pm, rich...@cogsci.ed.ac.uk (Richard Tobin) wrote:
> In article <489ae963$0$11740$9b4e6...@newsspool1.arcor-online.net>,
> Martin Honnen *<Martin.Hon...@gmx.de> wrote:
>
> >> 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">

> >When I try to load
> >http://libs.cygnets.co.uk/adl/unstab.../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?


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>
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      08-07-2008
In article <1ec57c37-983b-4267-a43f->,
Simon Brooke <> wrote:

><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>


No problem with the file when running lxt or saxon, but your XSLT has
at least one error: the template for adl:application outputs a
comment, then calls <xsl:apply-templates select="@* | node()"/> which
results in attributes being copied too late.

-- Richard
--
Please remember to mention me / in tapes you leave behind.
 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      08-07-2008
Simon Brooke wrote:

> <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>


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.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
Martin Honnen
Guest
Posts: n/a
 
      08-07-2008
Simon Brooke wrote:

> <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>


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...anonical.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.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      08-07-2008
In article <489b03c8$0$11736$>,
Martin Honnen <> wrote:

>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
--
Please remember to mention me / in tapes you leave behind.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML file from one DTD to another DTD test Java 2 07-28-2006 08:48 PM
How to specify DTD to DTD.getDTD for DocumentParser? Ronald Fischer Java 4 03-17-2005 09:37 AM
Removing the dtd name when using print(...) on the dtd generated class Joseph Tilian Java 0 12-21-2004 02:58 PM
Including a dtd into another dtd... possible? Asfand Yar Qazi XML 1 09-19-2003 12:10 PM
Effect of DTD declaration on XSL processing? Simon Brooke XML 5 07-25-2003 10:35 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57