VB.NET:Extract Xml attribute related to symbol

toytoy

Well-known member
Joined
Jul 16, 2004
Messages
46
Programming Experience
1-3
Say i have these Xml tag...
VB.NET:
<book title=”Harry Porter  page="1_9”>
	<new id=”100”>China News</new>
	<new id=”101”>Street paper</new>
	<new id=”0”>none</it>
	…….
	<new>….</new>
  </book>

how do i exactly extract the 1 and 10 separately from "1_9"

Now i am using substring to extract 1 and 9, it works well...

But if the 9 becomes 10 (double digits), it will have exception if i have to loop the Xml and send the maxpage to the server...

VB.NET:
page = xdoc.SelectSingleNode("[url=""]//book/@page").Value.Substring(0[/url], 1)
maxPage = xdoc.SelectSingleNode("[url=""]//book/@page").Value.Substring(2[/url], 1)

Thanks
 
You can't extract them seperatly (at least I don't think you can) probably the best solution would be to split the string using the _

TPM
 
Back
Top