xml - How do I check if an ID is a number? -


i have if statement need modify checks if statute id number (123654) etc.

if statute id not number error message should "statute id value not number"

vb.net code

 'check see if got statuteid , make sure id string length > 0         if not objxmlgetstatuterequestnode.selectsinglenode("ss:statute/ss:statuteid/ss:id[string-length(.)>0]", objxmlnamespacemanager) nothing 

sample xml document

<?xml version="1.0" encoding="utf-8"?> <getstatuterequest>     <statute>         <statuteid>             <id>15499</id>         </statuteid>     </statute> </getstatuterequest> 

as can see question , steve's answer, need/want this...

dim node xmlnode = objxmlgetstatuterequestnode.selectsinglenode("ss:statute/ss:statuteid/ss:id[string-length(.)>0]", objxmlnamespacemanager) if node isnot nothing     if isnumeric(node.innertext)         //...do stuff     else         throw new exception("statute id value not number")     end if else     //... else end if 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -