Is there something similar in ASP.NET to PHP's SimpleXML
If I want to convert my PHP application to ASP.NET… what do you recommend and why?
I'm currently using PHP's simplexml_load_string() method because it's, well, …simple.
For example, for PHP to process an http request in the form of XML I just use:
$FILERAWDATA = file_get_contents("php://input");
$xml = simplexml_load_string($FILERAWDATA);
Then grab the values from the xml nodes like such:
@$itemid = $x开发者_运维知识库ml->itemid;
// then use the node value as a PHP var $itemid
So, does ASP.NET have anything similar?
Thanks for reading.
AlejandroConsueloRodriguezMiguel -- also known as Fred :)
Linq to XML
http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx
You'll want to use the .Net XML namespace and XMLDocument class:
http://www.c-sharpcorner.com/uploadfile/mahesh/readwritexmltutmellli2111282005041517am/readwritexmltutmellli21.aspx
is this what you are lookin for ?
Dim xml As New XmlDocument()
xml.LoadXml(SomeXMLString)
Dim itemID as String = xml.GetElementsByTagName("itemID")(0).InnerText
this assumes that there is only one ItemID -> (0) first
精彩评论