S
Sudip_inn
Guest
suppose below master detail xml is stored in string variable. now how to write class as a result i can deserialize the below xml to my class and also serialize my class to xml which will be stored in string variable. looking for example code.
when to use xml array attribute ?
<Root>
<Orders>
<OrderID>10248</OrderID>
<CustomerID>VINET</CustomerID>
<EmployeeID>5</EmployeeID>
<OrderDate>1996-07-04T00:00:00</OrderDate>
<RequiredDate>1996-08-01T00:00:00</RequiredDate>
<ShippedDate>1996-07-16T00:00:00</ShippedDate>
<ShipVia>3</ShipVia>
<Freight>32.3800</Freight>
<ShipName>Vins et alcools Chevalier</ShipName>
<ShipAddress>59 rue de l'Abbaye</ShipAddress>
<ShipCity>Reims</ShipCity>
<ShipPostalCode>51100</ShipPostalCode>
<ShipCountry>France</ShipCountry>
<OrderDetails>
<OrderID>10248</OrderID>
<ProductID>11</ProductID>
<UnitPrice>14.0000</UnitPrice>
<Quantity>12</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
<OrderDetails>
<OrderID>10248</OrderID>
<ProductID>42</ProductID>
<UnitPrice>9.8000</UnitPrice>
<Quantity>10</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
<OrderDetails>
<OrderID>10248</OrderID>
<ProductID>72</ProductID>
<UnitPrice>34.8000</UnitPrice>
<Quantity>5</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
</Orders>
<Orders>
<OrderID>10249</OrderID>
<CustomerID>TOMSP</CustomerID>
<EmployeeID>6</EmployeeID>
<OrderDate>1996-07-05T00:00:00</OrderDate>
<RequiredDate>1996-08-16T00:00:00</RequiredDate>
<ShippedDate>1996-07-10T00:00:00</ShippedDate>
<ShipVia>1</ShipVia>
<Freight>11.6100</Freight>
<ShipName>Toms Spezialitäten</ShipName>
<ShipAddress>Luisenstr. 48</ShipAddress>
<ShipCity>Münster</ShipCity>
<ShipPostalCode>44087</ShipPostalCode>
<ShipCountry>Germany</ShipCountry>
<OrderDetails>
<OrderID>10249</OrderID>
<ProductID>14</ProductID>
<UnitPrice>18.6000</UnitPrice>
<Quantity>9</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
<OrderDetails>
<OrderID>10249</OrderID>
<ProductID>51</ProductID>
<UnitPrice>42.4000</UnitPrice>
<Quantity>40</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
</Orders>
<Orders>
<OrderID>10250</OrderID>
<CustomerID>HANAR</CustomerID>
<EmployeeID>4</EmployeeID>
<OrderDate>1996-07-08T00:00:00</OrderDate>
<RequiredDate>1996-08-05T00:00:00</RequiredDate>
<ShippedDate>1996-07-12T00:00:00</ShippedDate>
<ShipVia>2</ShipVia>
<Freight>65.8300</Freight>
<ShipName>Hanari Carnes</ShipName>
<ShipAddress>Rua do Paço, 67</ShipAddress>
<ShipCity>Rio de Janeiro</ShipCity>
<ShipRegion>RJ</ShipRegion>
<ShipPostalCode>05454-876</ShipPostalCode>
<ShipCountry>Brazil</ShipCountry>
<OrderDetails>
<OrderID>10250</OrderID>
<ProductID>41</ProductID>
<UnitPrice>7.7000</UnitPrice>
<Quantity>10</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
<OrderDetails>
<OrderID>10250</OrderID>
<ProductID>51</ProductID>
<UnitPrice>42.4000</UnitPrice>
<Quantity>35</Quantity>
<Discount>1.5000001e-001</Discount>
</OrderDetails>
<OrderDetails>
<OrderID>10250</OrderID>
<ProductID>65</ProductID>
<UnitPrice>16.8000</UnitPrice>
<Quantity>15</Quantity>
<Discount>1.5000001e-001</Discount>
</OrderDetails>
</Orders>
</Root>
Continue reading...
when to use xml array attribute ?
<Root>
<Orders>
<OrderID>10248</OrderID>
<CustomerID>VINET</CustomerID>
<EmployeeID>5</EmployeeID>
<OrderDate>1996-07-04T00:00:00</OrderDate>
<RequiredDate>1996-08-01T00:00:00</RequiredDate>
<ShippedDate>1996-07-16T00:00:00</ShippedDate>
<ShipVia>3</ShipVia>
<Freight>32.3800</Freight>
<ShipName>Vins et alcools Chevalier</ShipName>
<ShipAddress>59 rue de l'Abbaye</ShipAddress>
<ShipCity>Reims</ShipCity>
<ShipPostalCode>51100</ShipPostalCode>
<ShipCountry>France</ShipCountry>
<OrderDetails>
<OrderID>10248</OrderID>
<ProductID>11</ProductID>
<UnitPrice>14.0000</UnitPrice>
<Quantity>12</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
<OrderDetails>
<OrderID>10248</OrderID>
<ProductID>42</ProductID>
<UnitPrice>9.8000</UnitPrice>
<Quantity>10</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
<OrderDetails>
<OrderID>10248</OrderID>
<ProductID>72</ProductID>
<UnitPrice>34.8000</UnitPrice>
<Quantity>5</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
</Orders>
<Orders>
<OrderID>10249</OrderID>
<CustomerID>TOMSP</CustomerID>
<EmployeeID>6</EmployeeID>
<OrderDate>1996-07-05T00:00:00</OrderDate>
<RequiredDate>1996-08-16T00:00:00</RequiredDate>
<ShippedDate>1996-07-10T00:00:00</ShippedDate>
<ShipVia>1</ShipVia>
<Freight>11.6100</Freight>
<ShipName>Toms Spezialitäten</ShipName>
<ShipAddress>Luisenstr. 48</ShipAddress>
<ShipCity>Münster</ShipCity>
<ShipPostalCode>44087</ShipPostalCode>
<ShipCountry>Germany</ShipCountry>
<OrderDetails>
<OrderID>10249</OrderID>
<ProductID>14</ProductID>
<UnitPrice>18.6000</UnitPrice>
<Quantity>9</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
<OrderDetails>
<OrderID>10249</OrderID>
<ProductID>51</ProductID>
<UnitPrice>42.4000</UnitPrice>
<Quantity>40</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
</Orders>
<Orders>
<OrderID>10250</OrderID>
<CustomerID>HANAR</CustomerID>
<EmployeeID>4</EmployeeID>
<OrderDate>1996-07-08T00:00:00</OrderDate>
<RequiredDate>1996-08-05T00:00:00</RequiredDate>
<ShippedDate>1996-07-12T00:00:00</ShippedDate>
<ShipVia>2</ShipVia>
<Freight>65.8300</Freight>
<ShipName>Hanari Carnes</ShipName>
<ShipAddress>Rua do Paço, 67</ShipAddress>
<ShipCity>Rio de Janeiro</ShipCity>
<ShipRegion>RJ</ShipRegion>
<ShipPostalCode>05454-876</ShipPostalCode>
<ShipCountry>Brazil</ShipCountry>
<OrderDetails>
<OrderID>10250</OrderID>
<ProductID>41</ProductID>
<UnitPrice>7.7000</UnitPrice>
<Quantity>10</Quantity>
<Discount>0.0000000e+000</Discount>
</OrderDetails>
<OrderDetails>
<OrderID>10250</OrderID>
<ProductID>51</ProductID>
<UnitPrice>42.4000</UnitPrice>
<Quantity>35</Quantity>
<Discount>1.5000001e-001</Discount>
</OrderDetails>
<OrderDetails>
<OrderID>10250</OrderID>
<ProductID>65</ProductID>
<UnitPrice>16.8000</UnitPrice>
<Quantity>15</Quantity>
<Discount>1.5000001e-001</Discount>
</OrderDetails>
</Orders>
</Root>
Continue reading...