开发者

tag in tag empty on .net xml parsing

I'm parsing the xml on my job. I can't change xml creator file untill our other IT group come from holiday. Here is xml file to parse

<workhours>
    <name>x</name>
    <workhours>11:00-23:00</workhours>
    <author>y</author>
</workhours>

I need get "workhours" inside "workhours" but it's coming empty. I don't know tag in tag is wrong or not but i need to get that data now开发者_JAVA技巧. Any idea?

by the way, numbering array is not working because my xml file row numbers are could be different for every "workhours"


Well you haven't given any code, so it's hard to know what's wrong... In LINQ to XML this would be easy:

XDocument doc = XDocument.Load("test.xml");
XElement workHours = doc.Element("workhours").Element("workhours");

There's nothing inherently wrong with an element of a particular name being nested within another element of the same name.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜