From: Kenneth Pronovici (pronovic@skyjammer.com)
Date: Mon Oct 16 2000 - 16:22:30 EDT
I think that this issue is probably related to a thread from earlier
in the month entitled "Whitespace problem with external DTD validation".
From what I read in the mailing list archives, I had expected it to be
fixed in the 2.2.5 release, but I'm still having problems.
Suppose I am trying to build a very simple document using libxml. The
DTD for this document looks like:
<!ELEMENT document (doc_pcdata, doc_cdata) >
<!ELEMENT doc_pcdata (#PCDATA)>
<!ELEMENT doc_cdata (CDATA)>
I have used the following code to build what I think is a valid document:
doc = xmlNewDoc((xmlChar *)"1.0");
xmlCreateIntSubset(doc, (xmlChar *)"document", NULL, (xmlChar *)"ken.dtd");
doc->children->next = xmlNewDocNode(doc, NULL, (xmlChar *)"document", NULL);
pcdata_node = xmlNewChild(doc->children->next, NULL,
(xmlChar *)"doc_pcdata",
(xmlChar *)"one");
cdata_node = xmlNewChild(doc->children->next, NULL,
(xmlChar *)"doc_cdata", NULL);
data_node = xmlNewCDataBlock(doc, (xmlChar *)"two", strlen("two"));
xmlAddChild(cdata_node, data_node);
xmlDocDumpMemory(doc, &xml_buf, &xml_size);
This is the string I get in xml_buf after calling xmlDocDumpMemory:
<?xml version="1.0"?>
<!DOCTYPE document SYSTEM "ken.dtd">
<document>
<doc_pcdata>one</doc_pcdata>
<doc_cdata>
<![CDATA[two]]>
</doc_cdata>
</document>
However, xmllint does not agree that this document is valid:
fntest2> xmllint ken.xml --postvalid --noblanks --debug
DOCUMENT
version=1.0
URL=ken.xml
standalone=true
DTD(document), SYSTEM ken.dtd
ELEMENT document
ELEMENT doc_pcdata
TEXT
content=one
ELEMENT doc_cdata
CDATA_SECTION
content=two
Element doc_cdata content doesn't follow the Dtd
Expecting (CDATA), got (CDATA)
Document ken.xml does not validate
Using --valid rather than --postvalid gives similar results.
This sounds like the whitespace issue discussed under the other
thread, but I'm not positive. Is there something else I'm missing?
Let me know what other information I can provide...
Thanks...
KEN
-- Kenneth J. Pronovici <pronovic@ieee.org> Alliance of Computer Professionals, Inc. (http://www.acpros.com/) Personal Homepage: http://www.skyjammer.com/~pronovic/ "Hell hath no fury like the weather when I'm camping..."---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net
This archive was generated by hypermail 2b29 : Mon Oct 16 2000 - 16:43:34 EDT