473,626 Members | 3,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting [] appended to my Doctype when I save xmlDocument.sav e()


I have a simple little project open a xml file change a few nodes save the
file, no big deal.

The problem is that the doctype is getting modified when I save the file.

So it looks like this: <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
But when I save it : <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"[]>

You can see at the end it appends the [] which invalidates the file. No
where in the code do I specifically modify the doctype. Is there a way to
prevent the doctype from getting modified , this appears to be a bug. As a
workaround I¹ve replaced the Doctype node. But this is a kluge.

Snippet
XmlNodeList myList;
XmlDocument myDoc = new XmlDocument();

myDoc.Load("c:\ \inetpub\\wwwro ot\\template.mo bileconfig");

myList= myDoc.GetElemen tsByTagName("ke y");

do some stuff .....
XmlTextWriter w = new XmlTextWriter(" C:\\xmlFiles\\" + username +
".mobileconfig" ,new UTF8Encoding(fa lse));

myDoc.Save(w);

Aug 7 '08 #1
0 1075

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

Similar topics

3
2723
by: Dr. Laurence Leff | last post by:
I am having trouble doing the basics with xmlto on Redhat to convert DocBook XML into the various files. I believe the problem is the first line on the files: Here is starter file (notes.xml): <!DOCTYPE Book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"> <!ENTITY chap1 SYSTEM "chap1.xml"> <Book><title>CS310 notes</title></BOOK>
1
15443
by: George W. | last post by:
Okay, I'm a C#/XML newbie, and I've been wrestling with this for a while now, checked dotnet sites, articles, MSDN Library, etc. and haven't been able to determine why this is happening. I have an xml file that I am loading into an XmlDocument and then trying to add a child element to the root element. I keep getting: System.ArgumentException: The reference node is not a child of this node. This occurs at the line where I'm using...
6
9641
by: Nat | last post by:
I am reading data from an XML document with xmlDoc.load(fullname). Unfortunately, in my xml file there is the definition of a doctype file that is not available and so, it buggs. I would like to ignore it, to remove this line, or I don’t know… my language is Visual C#. Thanks in advance for your help. Nathalie *** Sent via Developersdex http://www.developersdex.com ***
1
4099
by: Chris Fink | last post by:
I am receiving xml documents from a customer without a reference to a doctype. I know what the Doctype DTD should be need to insert the declaration as follows <?xml version="1.0" encoding="UTF-8"?> <!-- start of add validation tag --> <!DOCTYPE D1XML SYSTEM "http://url/myDTD.DTD"> <!-- end of add validation tag --> <XML.....>
1
3961
by: st | last post by:
Hi, I'm using xmlDocument.Save(xmlTextWriter) to create an Excel-readable file. All works well, except where I've replaced the carriage return chars in the .innertext to XML-compliant " "; It gets changed to "&amp;#10" and doesn't render new lines in the Excel sheet. Can anyone help? Many thanks,
1
2891
by: John Wilhelm | last post by:
I'm having a problem in by VB.net 2005 application. When i try to get a node from my app.config file the node come back with "nothing". The xmldocment loads OK, but I can't retrive a node. The app.config file is listed below and the code is listed below that, the line with "-->>" is where i try to get the node. Can anyone see where I'm going wrong. A dump of the xmlDocument is listed below the code. Note: "MyKey" is set to "Reports"
4
1658
by: thenewuser | last post by:
Hi all, I am working on windows 2000 and using php 5.0 and apache 2.0.59. I am facing a problem while parsing a text file.Actually I am using a pop server for parsing an email.I am downloading new mails from that server using php and parsing the attachments.I want to parse text files as well. BUt when i save the attached .txt file on my machine, "=20" gets appended at the end of every line. If the file is an xml file, sometimes "=90" gets...
2
3229
by: =?iso-8859-1?Q?Norbert_P=FCrringer?= | last post by:
Hello there, is it possible to write an XML document into a file, which has a readable structure by using indents? By doubleclicking the xml file, you see a readable XML structure in IE, but if you open the file in a text editor, you get an unformatted structure of the XML. Furthermore I would like to show a formatted XML text in a text box: txtResponse.Text = xDoc.OuterXml
1
6402
by: Elliot | last post by:
When decrypt the xml, output "Unable to retrieve the decryption key." Can anyone help me solve the problem? I got the code from http://msdn.microsoft.com/en-us/library/ms229746.aspx using System; using System.Xml; using System.Security.Cryptography; using System.Security.Cryptography.Xml;
0
8262
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8701
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7192
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1507
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.