Reading XML file

  • Thread starter Thread starter Atchoum
  • Start date Start date
A

Atchoum

Sorry for the double posting.

Here is an XML file I need to read:
<?xml version="1.0"?>
<Settings>
<AppSettings Key="Width" Value="1000" />
<AppSettings Key="Height" Value="2000" />
</Settings>

I have not been successful in retrieving the node with the key set at
Width to access the value of the width. I tried
xNodes = m_xIniDoc.SelectNodes("/Settings/AppSettings/@Width") but
that does not seem to work.

Can someone help,

TIA,

Atchoum
 
Try this: ("/Settings/AppSettings[@Key=""Width""]")

Sorry for the double posting.

Here is an XML file I need to read:
<?xml version="1.0"?>
<Settings>
<AppSettings Key="Width" Value="1000" />
<AppSettings Key="Height" Value="2000" />
</Settings>

I have not been successful in retrieving the node with the key set at
Width to access the value of the width. I tried
xNodes = m_xIniDoc.SelectNodes("/Settings/AppSettings/@Width") but
that does not seem to work.

Can someone help,

TIA,

Atchoum
 
Try this: ("/Settings/AppSettings[@Key=""Width""]")

Shiva's correct here, but I thought I'd mention that I usually find it
more readable to use single quotes inside xpaths in vb.net, so that you
don't have to deal with escaping (or doubling) the quote character

("/Settings/AppSettings[@Key='Width']")

Both will work, though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top