473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Replacing a DocumentType Declaration usin XPATH

Hi to all!
How can I replace a DocumentType Declaration in a XML file using XMLDocument
and XPath?

Thanks in advance.
Fede.
Nov 12 '05 #1
1 2007
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

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bdinmstig | last post by:
I refined my attempt a little further, and the following code does seem to work, however it has 2 major problems: 1. Very limited support for XPath features Basic paths are supported for...
1
by: Ken Larson | last post by:
I have a question about using XSL to extract information from an SVG (XML) file that has a DOCTYPE/DTD declaration. I am able to do this successfully if I write my own SVG files without such a...
4
by: Helmut Dirtinger | last post by:
Hi Compontents of an xml file are mapped to the different node types of the xpath data model. An element is mapped to an element node, an attribute node represents an attribute and its value...
2
by: Daniel Frohberg | last post by:
Hello, does anybody have an example of how to create a simple "DOCTYPE" declaration such as: <!DOCTYPE BMECAT SYSTEM "bmecat_new_catalog_1_2.dtd"> I have an DataSet (dsCatalog), created...
1
by: George1776 | last post by:
Background: I have taken an excel spreadsheet with the formatting I want, saved it as XML, then converted it to an XSL document to use it as a sort of template. Added some for-each select...
2
by: AllenM | last post by:
I have a project that requires an XML webservice that will receive an xml file. The webservice will need to read the XML file, download a pdf file from a URL stored in the XML file then store the...
2
by: intrepidca | last post by:
When I try to translate an XML file (using org.apache.xalan.xslt.Process) that has a DOCTYPE declaration, I only get the <?xml ...?> processing instruction in the output file. I get no error...
1
by: Andrew Poulos | last post by:
Say I have some CSS, which is several hundred lines long, with the contents in this format: ..foo { blah color:#000; blah } ..bar { blah
29
by: Nick | last post by:
I've seen a few frameworks use the following: function $(id) { return document.getElementById(id); } Then to use: $('something').innerHTML = 'blah'; I'm just trying to roll this out to my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.