Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use msxml to parse my treeview node keys? 1

Status
Not open for further replies.

paron

Instructor
Apr 24, 2001
179
US
If I use a treeview control (VBA) with the node keys structured like:

Code:
node.key = & _
&quot;<OrganizationID>1234</OrganizationID>&quot; & _
&quot;<PositionID>3456</PositionID>&quot; & _
&quot;<PersonID>5678</PersonID>&quot;

I wondered if I could then use the MSXML to retrieve -- oh, the OrganizationID, say -- out of the node's key? I could write a parser to do that, but it seems like it ought to be possible to use MSXML, somehow.

If I am talking all crazy [dazed] here, please go ahead and say so, and I'll get started writing a parser.

Ron
 
If you have access to an MSXML ActiveX control you can use the loadXML() method to parse a string of &quot;Valid&quot; XML. What you have in your post is not valid XML.

-pete

 
Thanks for the quick answer! How about:

Code:
node.key = &quot;<keydata>&quot; & _
&quot;<OrganizationID>1234</OrganizationID>&quot; & _
&quot;<PositionID>3456</PositionID>&quot; & _
&quot;<PersonID>5678</PersonID>&quot; & _
&quot;</keydata>&quot;

Should I assume from your answer that I could just put that whole string in the ()s, like:

loadXML(
Code:
&quot;<keydata>&quot; & _
&quot;<OrganizationID>1234</OrganizationID>&quot; & _
&quot;<PositionID>3456</PositionID>&quot; & _
&quot;<PersonID>5678</PersonID>&quot; & _
&quot;</keydata>&quot;
)
?

Or even loadXML(node.key)?

Ron
 
Ron,

Yes your XML appears to be “well formed”. A simple way to test it is to save it to a file with a .xml extension and open it in MS Internet Explorer. It will use the MSXML parser for you and report any errors during parsing in the browser window.

Code:
loadXML(node.key)

would be preferable if it works. Your question at this point is really a VBA question and I won’t even go there. I have a major aversion to VB and it’s hell spawn children VBA, VBS LOL

-pete


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top