Hi,
I've had the following problem in both PHP and C++, and can't find any
relevant information about this. It should be quite simple actually.
I am trying to parse an xml file, and my code works perfectly for all
node types except DOCTYPE nodes. But I can't find any information about
how to extract the information from it. Here is an example (my goal is
to retrieve the strings "PublicIdentifier" and "URIreference"):
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE test PUBLIC "PublicIdentifier" "URIreference">
<test>
</test>
Here is some code that illustrates my approach, using an xmlTextReader
<http://www.xmlsoft.org/html/libxml-xmlreader.html#xmlTextReader>:
*while*(xmlTextReaderRead(myXmlReader) == 1) {
// Why does xmlTextReaderNodeType() return an int and not an enum?
xmlReaderTypes nodeType =
(xmlReaderTypes)xmlTextReaderNodeType(myXmlReader);
*switch*(nodeType) {
*case *XML_READER_TYPE_ELEMENT: /* Do something */ *break*;
*case *XML_READER_TYPE_END_ELEMENT: /* Do something */ *break*;
*case *XML_READER_TYPE_TEXT: /* Do something */ *break*;
*case *XML_READER_TYPE_CDATA: /* Do something */ *break*;
*case *XML_READER_TYPE_PROCESSING_INSTRUCTION: /* Do something */ *break*;
*case *XML_READER_TYPE_COMMENT: /* Do something */ *break*;
// ...
*case *XML_READER_TYPE_DOCUMENT_TYPE: {
// What do I do here?
} *break*;
}
}
Thank's in advance!
Best regards,
Alexander
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml@gnome.org
http://mail.gnome.org/mailman/listinfo/xml