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. Loading various objects simultaneously

Loading various objects simultaneously

Scheduled Pinned Locked Moved XML / XSL
csharpdatabaselinqxml
2 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.
  • A Offline
    A Offline
    AmitDey
    wrote on last edited by
    #1

    I am using LINQ To XSD to parse through an SVG XML file. var s = svg.Load("rect.xml"); In order to select all rect objects i do var q = from x in s.rect select new { x }; In order to select all circle objects i do var q = from x in s.circle select new { x }; Can you tell me a query which would give me both rect and circle objects simultaneously. Thanks in Advance :)

    A 1 Reply Last reply
    0
    • A AmitDey

      I am using LINQ To XSD to parse through an SVG XML file. var s = svg.Load("rect.xml"); In order to select all rect objects i do var q = from x in s.rect select new { x }; In order to select all circle objects i do var q = from x in s.circle select new { x }; Can you tell me a query which would give me both rect and circle objects simultaneously. Thanks in Advance :)

      A Offline
      A Offline
      AmitDey
      wrote on last edited by
      #2

      I got it var s = XDocument.Load("rect.xml"); var q = from x in s.Descendants() select new { x }; XNamespace ns = "http://tempuri.org/svg11-flat-20030114"; foreach (var itm in q) { if (itm.x.Name == ns + "rect") { rect re = (rect)itm.x; Console.WriteLine(itm.x.Name.ToString()); } if (itm.x.Name == ns + "desc") { rect re = (rect)itm.x; Console.WriteLine(itm.x.Name.ToString()); } }

      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