|
|
Rank: Aficionado
Joined: 7/23/2006 Posts: 172
|
I'm trying to make a class in c# where I get info from a xml doc.
the structure is like <DeliveryOrderline> <orderline country="Danmark"> <productId>ID</productId> <productName>name</productName> <price>40</price> <quantity>1</quantity> </orderline >
<orderline country="Greenland"> <productId>ID</productId> <productName>name</productName> <price>125</price> <quantity>1</quantity> </orderline> </DeliveryOrderline>
I want the class to lookup the contry and write the price.
I'm stuck - what do I do.
Søren Linaa Level 1 & 2 Certified Professional
|
|
 Rank: Fanatic
Joined: 7/22/2006 Posts: 255 Location: Randers, Denmark
|
Hi Søren, This is probably a generic C# programming question than Umbraco-specific .. It's actually simpler than you might think.. Try to look at this page: http://support.microsoft.com/kb/307548
Best Regards Simon Simm.dk - My base on the web - proud Umbracian since 2.0 Beta
|
|
Rank: Aficionado
Joined: 7/23/2006 Posts: 172
|
Well yes I think so too. But with so many clever brains in here I took the chance on posting
Søren Linaa Level 1 & 2 Certified Professional
|
|
 Rank: Fanatic
Joined: 7/22/2006 Posts: 255 Location: Randers, Denmark
|
I hope the above-mentioned link can help you, otherwise we can take a look at your problem again later ;)
Best Regards Simon Simm.dk - My base on the web - proud Umbracian since 2.0 Beta
|
|
 Rank: Umbracoholic
Joined: 7/20/2006 Posts: 1,074 Location: Charleston, West Virginia, United States
|
Soren, How are you planning on getting the country in the first place? Is it a value set from the user, or is it determined via a different means? Beyond that, you could read the XML file into an XSLT, pull the country setting, and xpath the value you are wanting easily. Give me some more details, and I will try to guide you through some options. Case
• 2007/2008 MVP • 2008/2009 MVP • Certified • Licensing • Support • Development • Hosting •
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 597 Location: Bad Homburg, Germany
|
If you have a xsd you can let the xsd.exe create classes for you. Then you can get the structure via de/serialization: Code: _Ser = New XmlSerializer(GetType(YOUROBJECTTYPE)) Dim fs As FileStream = New FileStream(FILEPATH, FileMode.Open) YOUROBJECT = CType(_Ser.Deserialize(fs), YOUROBJECTTYPE)
Thomas
• 2007/2008 MVP • www.thoehler.com • Bad Homburg, Germany
|
|
Rank: Aficionado
Joined: 7/23/2006 Posts: 172
|
I use the ecommerce project for Umbraco. I have made some modifacations and I have a usercontrol where I get the country from a dropdown. So I need to make the control in a c# class. Not XSLT in umbraco and I don't use VB.
Søren Linaa Level 1 & 2 Certified Professional
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 597 Location: Bad Homburg, Germany
|
Sorry for posting VB code, but it is simply to convert. If you don't get into it send me your schema or the structure of the file (th AT famhoehler dot de). I will then generate you the code. Thomas
• 2007/2008 MVP • www.thoehler.com • Bad Homburg, Germany
|
|
|
Guest |