Click here to Skip to main content
16,014,392 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Concept Clarification Pin
AliAmjad12-Sep-08 11:19
AliAmjad12-Sep-08 11:19 
GeneralRe: Concept Clarification Pin
Dave Kreskowiak12-Sep-08 12:18
mveDave Kreskowiak12-Sep-08 12:18 
AnswerRe: Concept Clarification Pin
Guffa12-Sep-08 11:28
Guffa12-Sep-08 11:28 
QuestionPrinter showing Spoling status after printing through VB application Pin
praveenhathwar11-Sep-08 21:11
praveenhathwar11-Sep-08 21:11 
AnswerRe: Printer showing Spoling status after printing through VB application Pin
Paul Conrad12-Sep-08 5:45
professionalPaul Conrad12-Sep-08 5:45 
QuestionCalculating the CPU usage of ONE process with VB.NET 2003 Pin
Chaos Machine11-Sep-08 20:09
Chaos Machine11-Sep-08 20:09 
AnswerRe: Calculating the CPU usage of ONE process with VB.NET 2003 Pin
Dave Kreskowiak12-Sep-08 1:45
mveDave Kreskowiak12-Sep-08 1:45 
QuestionXML XPath search in vb.net Pin
japel11-Sep-08 12:10
japel11-Sep-08 12:10 
Hi All,

I posted this under XML but after reading some of the other posts, it was probably the wrong message board so here it is.

OK I have worked out the below code to return the 'EN' string if I supply the string code, say "1000" of the below XML file but what I need to know is how to search for the string and return the string code. If I could use a wildcard in this it would be great.

Any Thoughts???

Private Sub XPathSearch(ByVal XMLPath As String)

Dim xmlNI As XPathNodeIterator
Dim xpathDoc As XPathDocument
Dim xmlNav As XPathNavigator
Try
xpathDoc = New XPathDocument(XMLPath)
xmlNav = xpathDoc.CreateNavigator()
xmlNI = xmlNav.Select("/MOMLANG/STRING[@code='" & stringValue & "']/LANG[@code='EN']")
While (xmlNI.MoveNext())
'Me.RichTextBox1.AppendText(xmlNI.Current.Name + " : " + xmlNI.Current.Value & vbCrLf)
Me.RichTextBox1.AppendText("String value: " + xmlNI.Current.Value & vbCrLf)
End While

Catch ex As XPathException
System.Console.WriteLine("XMLException: " + ex.Message)
Catch ex As Exception
System.Console.WriteLine("Exception: " + ex.Message)
End Try

End Sub

I have worked with reading simple XML elements but have not worked with atributes and the like. I am also new to both XML and Dev in general.

I have read several articles but most give me examples for reading simple XML e.g.

<person>
<firstname>John</firstname>
<lastname>Smith</lastname>
</person>

The file I am trying to read is below, any help would be great and examples are very much welcome. My goal for the GUI in VB.NET will be to have a textbox to enter string number I am searching for and a dropdown but to select the language.

Regards
Jason


<momlang>
<string code="2000">
<lang code="AR">Access Allowed List</lang>
<lang code="CZ">Access Allowed List</lang>
<lang code="DE">Access Allowed List</lang>
<lang code="DK">Access Allowed List</lang>
<lang code="EE">Access Allowed List</lang>
<lang code="EN">Access Allowed List</lang>
<lang code="ES">Lista de accesos permitidos</lang>
<lang code="FI">Pääsylista sallitut</lang>
<lang code="FR">Liste des accès autorisés</lang>
<lang code="GB">Access Allowed List</lang>
<lang code="HU">Hozzáférés Engedély Lista</lang>
<lang code="IT">Elenco accessi consentiti</lang>
<lang code="NL">Access Allowed List</lang>
<lang code="NO">Liste over systemtilgang</lang>
<lang code="PL">Access Allowed List</lang>
<lang code="RU">Access Allowed List</lang>
<lang code="SE">Använda tillåten lista</lang>
</string>
<string code="10000">
<lang code="AR">المطبوعة:</lang>
<lang code="CZ">Vytisknuto:</lang>
<lang code="DE">Gedruckt:</lang>
<lang code="DK">Printed:</lang>
<lang code="EE">Prinditud:</lang>
<lang code="EN">Printed:</lang>
<lang code="ES">Impreso:</lang>
<lang code="FI">Tulostettu:</lang>
<lang code="FR">Imprimé:</lang>
<lang code="GB">Printed:</lang>
<lang code="HU">Nyomtatott:</lang>
<lang code="IS">Printed:</lang>
<lang code="IT">Stampato:</lang>
<lang code="NL">Afgedrukt:</lang>
<lang code="NO">Skrevet ut</lang>
<lang code="PL">Wydrukowano:</lang>
<lang code="RU">Напечатано:</lang>
<lang code="SE">Utskrivet:</lang>
</string>
</momlang>

When people make you see red, be thankful your not colour blind.
QuestionControl master/wave/mic of soundcard Pin
Me kiter11-Sep-08 8:01
Me kiter11-Sep-08 8:01 
AnswerRe: Control master/wave/mic of soundcard Pin
jzonthemtn11-Sep-08 10:05
jzonthemtn11-Sep-08 10:05 
Questionmetaphones Pin
lawasso11-Sep-08 4:16
lawasso11-Sep-08 4:16 
AnswerRe: metaphones Pin
leppie11-Sep-08 4:34
leppie11-Sep-08 4:34 
QuestionVBScript - View Source Pin
Reelix11-Sep-08 3:55
Reelix11-Sep-08 3:55 
AnswerRe: VBScript - View Source Pin
jzonthemtn11-Sep-08 6:24
jzonthemtn11-Sep-08 6:24 
GeneralRe: VBScript - View Source Pin
Reelix11-Sep-08 20:11
Reelix11-Sep-08 20:11 
QuestionVB.net Searching File for string Pin
Maffyx11-Sep-08 3:29
Maffyx11-Sep-08 3:29 
AnswerRe: VB.net Searching File for string Pin
jzonthemtn11-Sep-08 6:28
jzonthemtn11-Sep-08 6:28 
GeneralRe: VB.net Searching File for string Pin
Maffyx11-Sep-08 10:31
Maffyx11-Sep-08 10:31 
GeneralRe: VB.net Searching File for string Pin
Maffyx13-Sep-08 18:58
Maffyx13-Sep-08 18:58 
GeneralRe: VB.net Searching File for string Pin
Maffyx13-Sep-08 20:05
Maffyx13-Sep-08 20:05 
GeneralRe: VB.net Searching File for string Pin
Maffyx13-Sep-08 20:42
Maffyx13-Sep-08 20:42 
QuestionVBA Quicky Pin
harveyhanson11-Sep-08 0:51
harveyhanson11-Sep-08 0:51 
AnswerRe: VBA Quicky Pin
ChandraRam11-Sep-08 1:20
ChandraRam11-Sep-08 1:20 
QuestionInternet Explorer Toolbar Pin
Gagan.2011-Sep-08 0:38
Gagan.2011-Sep-08 0:38 
AnswerRe: Internet Explorer Toolbar Pin
harveyhanson11-Sep-08 0:52
harveyhanson11-Sep-08 0:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.