Re: [xml] embedded comments in DTD



Hello Miles,

Op 11-9-2008 2:00 heeft miles mccoo het volgende geschreven:
Hi,

I'm trying to parse an XML file with an associated DTD file.

I get an error that looks like this:
parser error : ContentDecl : Name or '(' expected
instances_chop*, <!-- chop_enum with an atrribute for which insta



The problem appears to be an comment embedded in a !ELEMENT

<!ELEMENT xyz (instances_chop*, <!-- chop_enum with an atrribute for which instance is removed -->
                          group,
                          .... more stuff


looking in the code, the problem appears to be in the function: xmlParseElementChildrenContentDecl which uses the define SKIP_BLANKS which in turn does not filter out comments.

So I guess the question is: is my DTD really invalid? Comments are allowed in other parts of the DTD (like between elements)
If I remember correctly, the way to embed comments within DTD elements is using just the '--'. A stand-alone comment (like you can use between elements) is a actually a DTD element without any other content.

So I think the following should work:

<!ELEMENT xyz (instances_chop*, -- chop_enum with an atrribute for which instance is removed --
                         group,
                         .... more stuff

but I'm afraid I cannot test this right now...

Seems it'd be easy to make the change required to allow these comments, but I'm surprised it's not already supported.
As far as I know, this is not a libxml error, so it does not have to be supported.

Kris Breuker



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]