IF ChildNode EXIST?

irade92

Registered User.
Local time
Today, 17:40
Joined
Dec 26, 2010
Messages
229
Hi
I want to check if this ChildNodes exirst...(fund_code) in the example ...prescription.SelectSingleNode("./issued_drug/fund_code")
Thanks
 
Not much to go on there.

Sample of the code / tables / forms / uploaded zipped copy of stripped-down database all might help.
Assuming it's a Tree-View then perhaps which tree view are you using?
 
Not much to go on there.

Sample of the code / tables / forms / uploaded zipped copy of stripped-down database all might help.
Assuming it's a Tree-View then perhaps which tree view are you using?
I am parsing an XML file..and this XML file sometimes has ChildNodes (fund_code)..and sometimes hasn't..I want to check when has and when has not..because if there is not ChiledNodes (fund_code) I have message End..Debug..and so
 
As soon as you get a battery recharger you will see that I have posted my code.. but in case you are shortsighted please take a close look at this..
..prescription.SelectSingleNode("./issued_drug/fund_code") and check does "fund_code" exits as a childnodes or not..if not do something else..
that is..
 
I am not checking the MSXML library but isn't there a .hasChildNodes property for a node. There must be something of that nature.
Without being critical I don't think a half line of code is what was meant by the request "can you post some code please?"
It's not clear whether your code fragment is correct syntactically or not. Does it work? What does it return? Does it return a single node or does it return a set of all of the nodes in the XML file with that prefix? Are you walking a tree, or trying to extract data? It's all germane. Hence it would be useful to see the context of the code fragment.
 
Well I've cleaned my glasses and I can't see any more than I saw before.
I can't see any attempt on how you are checking for a node and do something based on it being there or not.

Luckily, now that we have determined that you are attempting to parse an XML file and I can see more clearly, I found a thing called google, and it found this;


Which recursively will list child nodes until you are bored.
 
Maybe you need more than a cleared glasses...hm..
Maybe this can help you...this is just a line of a code that works perfectly...for example in an XML file with 5 nodes of "prescription" and 5 childnodes of "issued_drug" and 4 childnodes of "fund_code"...so ..one childnode "fund_code" is missing. Doing parsing with for..next..there is no value of one childnodes ie "fund_code" ..There is .hasChildNodes yes...but i need to specify the name of child node..
 
Maybe you need more than a cleared glasses...hm..
Maybe this can help you...this is just a line of a code that works perfectly...for example in an XML file with 5 nodes of "prescription" and 5 childnodes of "issued_drug" and 4 childnodes of "fund_code"...so ..one childnode "fund_code" is missing. Doing parsing with for..next..there is no value of one childnodes ie "fund_code" ..There is .hasChildNodes yes...but i need to specify the name of child node..
in the meantime i solved this with a little trick...since I store value od each childnodes("fund_code") in a variable and then in a table, after storing in a table I initialize variabile to null...so if there is no value of "fund_code" I did Resume Next and go on for next loop..That is
 
Bizarrely, unless I'm mistaken, it wasn't me asking for help in the first place.

I'm sure the omnipotent other members of the forum will appreciate the inciteful solution to your problem...
 
@Minty,
I have an issue with my car, can you tell me exactly what is wrong? Just asking.
 
@MajP Yes of course - it's the long weight. It's too short.
And your throttle widget needs realigning.
 
Thanks. I see you crystal ball is up and working again.
 
can you upload a sample xml file?
 

Users who are viewing this thread

Back
Top Bottom