Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / May 2008

Tip: Looking for answers? Try searching our database.

c# xml processing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gigs - 28 May 2008 19:23 GMT
hi!

generic xml:
<obrazac>
<odjeljak sifra="G.5">
    <red num="1">
      <text id="1">neki text</text>
    </red>
    <red num="2">
      <stupac>
        <checkbox id="5-1">text koji ide sa checkboxom</checkbox>
      </stupac>
      <stupac>
        <text id="5-2">sfdgygasg</text>
        <br />
        <unos id="5-3" />
      </stupac>
    </red>
  </odjeljak>
  <odjeljak sifra="G.6" />
</obrazac>

other xml:, i have 20 xml like this. structure is sabe, but elements are in
different order
<obrazac>
  <odjeljak>
    <text>sudjelovanje</text>
    <br />
    <text>Datum: </text>
    <unos id="29" />
    <text>vrijeme: </text>
    <unos id="30" />
  </odjeljak>
  <odjeljak sifra="G.5" />
  <odjeljak>
    <text>Ostali: </text>
    <unos id=".31" />
  </odjeljak>
  <odjeljak>
    <text>ponuda</text>
    <br />
    <text>Datum: </text>
    <unos id="32" />
    <br />
    <checkbox id="C.14">Da</checkbox>
    <checkbox id="C.15">Ne</checkbox>
    <br />
    <unos id="35" />
  </odjeljak>
  <odjeljak sifra="I.1">
    <redovi od="1" do="7" />
  </odjeljak>
</obrazac>

all i just want is to go trough other xml and check <odjeljak> for attribute.
if there is attribute, but no child i write from generic xml <odjeljak> with
same attribute to third xml, if there is child i do some processing and than
write it to third xml. if <odjeljak> from other xml doesnt have attribute i
write him to third xml.

what is the best approach to do that?

i have tried with XPath and XmlTextWriter
Daniel Cigic - 30 May 2008 16:14 GMT
In the past I used XmlDocument and XmlTextWriter for such things, BUT since
.NET 3.5 I just stick with LINQ To XML.  It is really easy to use and it
provides both DOM and XQuery/XPath like functionality . Here is link that
you could start with http://msdn.microsoft.com/en-us/library/bb308960.aspx.
Hope that helps.

> hi!
>
[quoted text clipped - 60 lines]
>
> i have tried with XPath and XmlTextWriter

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.