EDN Admin
Well-known member
Hello,
Feel like I should apologize as similar questions have been asked but I cannot seem to get the idea to work for my applicaiton.
I am working in vb.net 2008
I have an xml file that is storing informastion in attributes. I unfortunately cannot change the structure of the xml file.
<pre class="prettyprint <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TeamNames>
<Team AlternateTeamName="Alabama St." StandardizedTeamName="Alabama State"/>
<Team AlternateTeamName="Alaska - Anchorage" StandardizedTeamName="Alaska-Anchorage"/>
<Team AlternateTeamName="St. Josephs" StandardizedTeamName="Saint Josephs"/>
... </TeamNames> [/code]
In my code I need to find teams with a given AlternateTeamName
I am trying to use the following but it is not selecting through the apostrophe correctly.
<pre class="prettyprint Dim xpath As String = "//Team[@AlternateTeamName=""" + sIndex + """]"
Return GetNCAAName(xmlDoc.DocumentElement.SelectNodes(xpath), 0, sIndex[/code]
The xmlDocumentElement is not selecting any apostrophe containing teams.
What syntax do I want for my xpath string?
Also am I correct that in no way will I be able to have an ampersand bare in the xml file? The current xml file DOES escape the amersands with & in the team names, but the apostrophes are plaintext.
Thanks in advance for the help.
View the full article
Feel like I should apologize as similar questions have been asked but I cannot seem to get the idea to work for my applicaiton.
I am working in vb.net 2008
I have an xml file that is storing informastion in attributes. I unfortunately cannot change the structure of the xml file.
<pre class="prettyprint <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TeamNames>
<Team AlternateTeamName="Alabama St." StandardizedTeamName="Alabama State"/>
<Team AlternateTeamName="Alaska - Anchorage" StandardizedTeamName="Alaska-Anchorage"/>
<Team AlternateTeamName="St. Josephs" StandardizedTeamName="Saint Josephs"/>
... </TeamNames> [/code]
In my code I need to find teams with a given AlternateTeamName
I am trying to use the following but it is not selecting through the apostrophe correctly.
<pre class="prettyprint Dim xpath As String = "//Team[@AlternateTeamName=""" + sIndex + """]"
Return GetNCAAName(xmlDoc.DocumentElement.SelectNodes(xpath), 0, sIndex[/code]
The xmlDocumentElement is not selecting any apostrophe containing teams.
What syntax do I want for my xpath string?
Also am I correct that in no way will I be able to have an ampersand bare in the xml file? The current xml file DOES escape the amersands with & in the team names, but the apostrophes are plaintext.
Thanks in advance for the help.
View the full article