-
May 21st, 2009, 10:47 AM
#1
XML Validation - DTD on the web
I need to read a xhtml document into my program. The xhtml doc is generated by OpenOffice Writer and starts with this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
... and so on
Im trying this code:
XmlDocument ^doc = gcnew XmlDocument();
XmlReaderSettings ^settings = gcnew XmlReaderSettings();
settings->ProhibitDtd = false;
settings->ValidationType = ValidationType:TD;
XmlReader ^reader = XmlReader::Create("xhtml.html");
doc->Load(reader);
When executing the last line (doc->Load(reader)) it throws an exception:
"An unhandled exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Additional information: The ':' character, hexadecimal value 0x3A, cannot be included in a name. Line 239, position 10."
If I try to read it without the XmlReaderSettings (without validating) it throws this exception:
"An unhandled exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
Additional information: For security reasons DTD is prohibited in this XML document. Toenable DTD processing set the ProhibitDtd property on XmlReaderSettings to false and pass the settings into XmlReader.Create method."
I sure could do with some help, please.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|