Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. create a xml child node

create a xml child node

Scheduled Pinned Locked Moved ASP.NET
questionhtmlxml
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    miss786
    wrote on last edited by
    #1

    Dear all, With my current code, I am getting output as shown in output1:

    string autoDate = uriBuilder.activateMethod();
            XElement xeRoot = new XElement("mailjob");
    
            XElement xeSendDate = new XElement("send\_datetime", autoDate);
            xeRoot.Add(xeSendDate);
    
            XElement xeStatus = new XElement("subject", "Draft");
            xeRoot.Add(xeStatus);
    
            XElement xeDisplayDate = new XElement("from\_name", "MCI");
            xeRoot.Add(xeDisplayDate);
    
            XElement xeFormat = new XElement("format", "HTML");
            xeRoot.Add(xeFormat);
    
            XElement xeSendTo = new XElement("to");
            xeSendTo.Add(new XAttribute("target\_type", "###"));
            xeSendTo.Add(new XAttribute("targets", "####"));
            xeRoot.Add(xeSendTo);
    
            XDocument xDoc = new XDocument(xeRoot);
            return xDoc.ToString();
    

    output1:

    		12-09-2014 15:20:31 
    		Draft 
    		MCI 
    		<format>HTML</format>  
    

    However, I would create sub child for node, such as shown below:

    		12-09-2014 15:20:31 
    		Draft 
    		MCI 
    		<format>HTML</format> 
    		
    		####
    		#####
    

    How can I achieve this? Please advice further. Thanks

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups