Fede wrote:
How can I replace a DocumentType Declaration in a XML file using XMLDocument
and XPath?
No help from XPath here. Doctype is out of XPath data model. But after
all it's easy to select Doctype - its placement is fixed and
DocumentType property of XmlDocument class returns it. So you can remove
it and insert a new one.
Here is a sample:
doc.RemoveChild(doc.DocumentType);
XmlDocumentType doctype = doc.CreateDocumentType("root",
null, "foo.dtd", null);
doc.InsertBefore(doctype, doc.DocumentElement);
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog