Click here to Skip to main content
15,921,884 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: Dataset.GetXml() problem Pin
Anonymous11-May-05 22:30
Anonymous11-May-05 22:30 
GeneralRe: Dataset.GetXml() problem Pin
Gregory Nozik25-Sep-11 17:56
Gregory Nozik25-Sep-11 17:56 
QuestionAny XSLT editor...? Pin
anderslundsgard20-Apr-05 20:35
anderslundsgard20-Apr-05 20:35 
AnswerRe: Any XSLT editor...? Pin
Christian Graus2-May-05 16:11
protectorChristian Graus2-May-05 16:11 
GeneralWant to create XML element without name spaces definition Pin
z_ahamad20-Apr-05 18:53
z_ahamad20-Apr-05 18:53 
GeneralRe: Want to create XML element without name spaces definition Pin
DavidNohejl21-Apr-05 3:22
DavidNohejl21-Apr-05 3:22 
GeneralRe: Want to create XML element without name spaces definition Pin
hp10811-May-05 3:36
hp10811-May-05 3:36 
Generalproblem updating a xml doc with AppendChild Pin
dratcha18-Apr-05 13:43
dratcha18-Apr-05 13:43 
I am trying to insert new nodes within an existing XML document. The insert that I am having problems with is a few nodes deep.

I can insert a new node just below the root node with the following with no problems:
<br />
XmlDocument doc = new XmlDocument();<br />
doc.Load(strXMLPath);<br />
<br />
XmlNode tasks = doc.SelectSingleNode("/tasks");<br />
doc.AppendChild(tasks);<br />
<br />
// The rest of the AddElement and AddAttribute stuff has been omitted.<br />


Now, here is the code which tries to write a little deeper down and is breaking:
<br />
XmlDocument doc = new XmlDocument();<br />
doc.Load(strXMLPath);<br />
<br />
XmlNode checks = doc.SelectSingleNode("/tasks/task[@id='1001']/checks");<br />
doc.AppendChild(checks);<br />
<br />
// The rest of the AddElement and AddAttribute stuff has been omitted.<br />


The error the second code snippet gives is: This document already has a DocumentElement node. It gives this error on the doc.AppendChild(checks); line

I just can't figure it out. I did a quick watch on XmlNode checks = doc.SelectSingleNode("/tasks/task[@id='1001']/checks"); and it did put me in the correct node.

I have no idea why I can not append into this node. Anyone have any ideas?

Here is my XML doc if you want to see it for reference:
<br />
<?xml version="1.0" encoding="utf-8"?><br />
<tasks><br />
   <task id="1000"><br />
      <name>Task Name</name><br />
     <checks><br />
         <check id="1000_1"><br />
            <time>14:00</time><br />
         </check><br />
         <check id="1000_2"><br />
            <time>23:00</time><br />
         </check><br />
      </checks><br />
   </task><br />
</tasks>

GeneralRe: problem updating a xml doc with AppendChild Pin
rudy.net21-Apr-05 19:12
rudy.net21-Apr-05 19:12 
GeneralUpdaing an XML file Pin
Anonymous17-Apr-05 3:10
Anonymous17-Apr-05 3:10 
GeneralRe: Updaing an XML file Pin
DavidNohejl17-Apr-05 3:19
DavidNohejl17-Apr-05 3:19 
Generalproblem with invalid characters in strings Pin
Anonymous16-Apr-05 17:26
Anonymous16-Apr-05 17:26 
GeneralRe: problem with invalid characters in strings Pin
DavidNohejl16-Apr-05 22:59
DavidNohejl16-Apr-05 22:59 
GeneralCannot run quiz found on this site Pin
gamerz4life16-Apr-05 14:48
gamerz4life16-Apr-05 14:48 
GeneralRe: Cannot run quiz found on this site Pin
DavidNohejl16-Apr-05 23:09
DavidNohejl16-Apr-05 23:09 
GeneralEditing XML Pin
Member 114461716-Apr-05 7:53
Member 114461716-Apr-05 7:53 
GeneralRe: Editing XML Pin
DavidNohejl16-Apr-05 8:08
DavidNohejl16-Apr-05 8:08 
GeneralPrinting Screen Pin
Member 168150415-Apr-05 0:28
Member 168150415-Apr-05 0:28 
GeneralRe: Printing Screen Pin
Javier Lozano15-Apr-05 18:54
Javier Lozano15-Apr-05 18:54 
QuestionHow to display all xml fields and values using ASP Pin
Boy7514-Apr-05 9:30
sussBoy7514-Apr-05 9:30 
AnswerRe: How to display all xml fields and values using ASP Pin
Hrashita Triapthi22-Apr-05 0:50
Hrashita Triapthi22-Apr-05 0:50 
GeneralXML generation using DTD in VC++ Pin
guru*p13-Apr-05 9:58
guru*p13-Apr-05 9:58 
GeneralWeb Service Consuming VB 60 Pin
Anonymous13-Apr-05 8:00
Anonymous13-Apr-05 8:00 
GeneralValidate XML file with DTD Pin
Nusrat.Khan13-Apr-05 5:36
Nusrat.Khan13-Apr-05 5:36 
GeneralConvert SQLServer dataset into XML using XSD Pin
SarunMK13-Apr-05 5:04
SarunMK13-Apr-05 5:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.