Advertisement

05.23.2008 at 12:09PM PDT, ID: 23428649
[x]
Attachment Details

Edit XML file with ASP.NET

Asked by LordSM in Extensible Markup Language (XML), Programming for ASP.NET

Tags: , ,

I have an XML file of the format attached below

I would like to edit values of these field and add new elements in ascending order. How can I program such a parser in ASP.NET?

ex: I could edit SubCategory "Industrial" under "Generators" (Category).
I could add Manufacturer "BG" under "Generators" and it shall be inserted between "Altorfer" and "Caterpillar"
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
<?xml version="1.0" encoding="utf-8" ?>
<Lookup>
  <Item>
    <Categories>
      <Category Name="Generators">
        <SubCategories>
          <SubCategory Value="Industrial" />
          <SubCategory Value="Marine" />
          <SubCategory Value="Natural Gas" />
        </SubCategories>
        <Manufacturers>
          <Manufacturer Value="Altorfer" />
          <Manufacturer Value="Caterpillar" />
          <Manufacturer Value="Cooper Superior" />
          <Manufacturer Value="Cummins" />
          <Manufacturer Value="Cummins Wartsila" />
        </Manufacturers>
      </Category>
      <Category Name="Engines">
        <SubCategories>
          <SubCategory Value="Industrial" />
          <SubCategory Value="Marine" />
          <SubCategory Value="Power Unit" />
        </SubCategories>
        <Manufacturers>
          <Manufacturer Value="Caterpillar" />
          <Manufacturer Value="Cummins" />
          <Manufacturer Value="Detroit Diesel" />
        </Manufacturers>
      </Category>
      <Category Name="Power Plants">
        <SubCategories>
          <SubCategory Value="Reciprocating" />
          <SubCategory Value="Turbine" />
        </SubCategories>
        <Manufacturers>
          <Manufacturer Value="Allison" />
          <Manufacturer Value="Caterpillar" />
          <Manufacturer Value="Deutz" />
          <Manufacturer Value="Fairbanks Morse" />
          <Manufacturer Value="Leroy Somer" />
        </Manufacturers>
      </Category>
      <Category Name="Turbines">
        <SubCategories>
          <SubCategory Value="Natural Gas" />
          <SubCategory Value="Industrial" />
        </SubCategories>
        <Manufacturers>
          <Manufacturer Value="Caterpillar" />
          <Manufacturer Value="GE" />
          <Manufacturer Value="Fairbanks Morse" />
        </Manufacturers>
      </Category>
      <Category Name="Accessories">
        <SubCategories>
          <SubCategory Value="Compressor" />
          <SubCategory Value="Enclosure" />
          <SubCategory Value="Transmission" />
          <SubCategory Value="Radiator" />
        </SubCategories>
        <Manufacturers>
          <Manufacturer Value="Reintjes" />
          <Manufacturer Value="Silex" />
          <Manufacturer Value="Young" />
          <Manufacturer Value="ZF Marine" />
        </Manufacturers>
      </Category>
    </Categories>
    <Hours>
      <Hour Value="Since New" />
      <Hour Value="Since Rebuilt" />
    </Hours>
    <Availability>
      <AvailableType Value="Sale Pending" />
    </Availability>
  </Item>
  <Expense Name="Expense Types">
    <Type Value="Rental Credit" />
    <Type Value="Credit" />
  </Expense>
  <Note Name="Note Types">
    <Type Value="Delivery" />
    <Type Value="Accessories" />
    <Type Value="Location" />
  </Note>
  <Contacts>
    <Phones>
      <Phone Value="Business" />
      <Phone Value="Mobile" />
      <Phone Value="Fax" />
    </Phones>
    <Addresses>
      <AddressType Value="Billing" />
      <AddressType Value="Business" />
      <AddressType Value="Home" />
      <AddressType Value="Mailing" />
    </Addresses>
  </Contacts>
  <Lead>
    <Sources>
      <Source Value="Returning Customer" />
      <Source Value="IMP Website Inquiry" />
      <Source Value="Industry Trader" />
    </Sources>
    <Reminders>
      <Remind Text="Day(s)" Value="Day" />
      <Remind Text="Week(s)" Value="Week" />
      <Remind Text="Month(s)" Value="Month" />
    </Reminders>
    <Statuses>
      <Status Value="Open" />
      <Status Value="Closed" />
    </Statuses>
  </Lead>
</Lookup>
[+][-]05.23.2008 at 01:04PM PDT, ID: 21635391

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.23.2008 at 10:19PM PDT, ID: 21637930

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.29.2008 at 04:27PM PDT, ID: 21674171

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Extensible Markup Language (XML), Programming for ASP.NET
Tags: Microsoft, ASP.NET, 2.0
Sign Up Now!
Solution Provided By: LordSM
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628