DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: AppendChild xml

  1. #1
    Join Date
    Feb 2007
    Posts
    49

    AppendChild xml

    I can't quite get it to work. I can append an element but not a whole section.

    here is the xml

    Code:
    - <InstrumentSession>
        <gas>UNK</gas> 
        <alarmLow>2</alarmLow> 
         - <readings>
           - <SensorReading>
               <time>12:45</time> 
               <temperature>27</temperature> 
               <rawReading>4</rawReading> 
             </SensorReading>
           </readings>
        <customResponsename /> 
        <customResponseValue>0</customResponseValue> 
        <status>OK</status> 
      </InstrumentSession>
    Code:
    Dim Docz As New System.Xml.XmlDocument
    Dim Nodez As System.Xml.XmlNode
    Docz.Load("C:\file.xml")
    Nodez = Docz.CreateNodeSystem.Xml.XmlNodeType.Element, "SensorReading", "")
            Docz.SelectSingleNode("//readings").AppendChild(Nodez)
            Docz.Save("C:\file.xml")
    That will add the element "SensorReading" but I want to add the whole "SensorReading" section inside of "readings". There has to be an easier way than where I am going. Please help.

  2. #2
    Join Date
    Feb 2007
    Posts
    49
    I got it. I had to create a node with an element, then appendchild, then add child element, then add text, then add the whole child to the document, then save.

Similar Threads

  1. Try XML Junction
    By Tim in forum xml.announcements
    Replies: 0
    Last Post: 10-11-2001, 04:00 PM
  2. XML Startkabel Updates
    By xmlstartkabel in forum XML
    Replies: 0
    Last Post: 10-10-2001, 04:07 AM
  3. Data Junction Announces XML Junction 7.51
    By Tim Frost in forum xml.announcements
    Replies: 0
    Last Post: 04-02-2001, 10:53 AM
  4. Check out Turbo XML: Free trial download
    By Extensibility in forum web.announcements
    Replies: 0
    Last Post: 07-20-2000, 06:20 PM
  5. Check out Turbo XML
    By Sales in forum xml.announcements
    Replies: 0
    Last Post: 07-20-2000, 06:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links