xsl-list
[Top] [All Lists]

RE: DTD Element problem

2003-11-06 07:13:10
You are confusing DTDs with XML/XSLT. This is not surprising given their close 
relationship and the similarity between "PCDATA" and "CDATA". When you instruct 
a DTD  <!ELEMENT SQL (#PCDATA)>, you are saying that this element will contain 
PCDATA and not XML elements.

When you place the <![CDATA[ ]]> markup around text in an XML document, you are 
telling the processor not to treat it as if it were markup to be parsed, rather 
that it should be pass through without parsing.

When you say, "It seems a bit redundant to define SQL as PCDATA in the DTD and 
then explicitly define the contents of the SQL tag to be CDATA in the XML 
file.", you are right in that it *seems* redundant, but it really isn't. In 
fact, that is what you must do.
-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     Flemming Jønsson <flj(_at_)systematic(_dot_)dk>
Sent:     Thu, 6 Nov 2003 11:06:33 +0100
To:       <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject:  [xsl] DTD Element problem

I have some xml files containing source code (or SQL queries) inside a 
particular tag.

In my DTD I wanted to define the element SQL to contain #CDATA, but this is not 
allowed.

<!ELEMENT SQL (#CDATA)> is illegal,  <!ELEMENT SQL (#PCDATA)> is legal.

In my XML files I have <![CDATA[{SQL_HERE}]> around my SQL queries - which 
works fine, when SQL is defined as PCDATA in the DTD.

Is there another way I can define SQL to be CDATA instead of PCDATA in the DTD? 
It seems a bit redundant to define SQL as PCDATA in the DTD and then explicitly 
define the contents of the SQL tag to be CDATA in the XML file.

Regards,
Flemming

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>