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. General Programming
  3. XML / XSL
  4. Skip root elements for sub classes when serializing complex object

Skip root elements for sub classes when serializing complex object

Scheduled Pinned Locked Moved XML / XSL
csharpxmlquestion
2 Posts 2 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.
  • U Offline
    U Offline
    User 1835979
    wrote on last edited by
    #1

    how do we skip root elements for sub classes when serailizing comlex object? my requirement is Assume we have a complex class public class employee { private string _name; private string empcode; private list

    addresses; //Assume we have created public properties also } public class Address { private string street; private string city; private string state; //Assume we have created public properties also } if we serialize above employee collection class in XML the output would be ABC 1/EmpCode>

    XXX xxx yyy

    XXX xxx yyy

    but i want the above xml as ABC 1/EmpCode>

    XXX xxx yyy

    XXX xxx yyy

    i just removed means removing root element for inner classes. how do we achieve this using .NET Thanks inadvance Regards Ravi

    S 1 Reply Last reply
    0
    • U User 1835979

      how do we skip root elements for sub classes when serailizing comlex object? my requirement is Assume we have a complex class public class employee { private string _name; private string empcode; private list

      addresses; //Assume we have created public properties also } public class Address { private string street; private string city; private string state; //Assume we have created public properties also } if we serialize above employee collection class in XML the output would be ABC 1/EmpCode>

      XXX xxx yyy

      XXX xxx yyy

      but i want the above xml as ABC 1/EmpCode>

      XXX xxx yyy

      XXX xxx yyy

      i just removed means removing root element for inner classes. how do we achieve this using .NET Thanks inadvance Regards Ravi

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      Can I suggest you select the 'Encode HTML tags when pasting' tickbox when pasting XML code into a post - most of your content has disappeared! Also, it helps to put it in a code block, using the 'code block' link below when the code is selected.

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      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