Click here to Skip to main content
15,897,891 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Need help with a project, I am really stumped! Pin
Chinners29-May-08 4:57
Chinners29-May-08 4:57 
GeneralRe: Need help with a project, I am really stumped! Pin
Ogre72229-May-08 5:22
Ogre72229-May-08 5:22 
GeneralRe: Need help with a project, I am really stumped! Pin
Ogre72229-May-08 15:47
Ogre72229-May-08 15:47 
GeneralRe: Need help with a project, I am really stumped! Pin
Chinners29-May-08 22:35
Chinners29-May-08 22:35 
GeneralRe: Need help with a project, I am really stumped! Pin
Steven J Jowett29-May-08 4:07
Steven J Jowett29-May-08 4:07 
QuestionCheck tinytext column in MySQL Database with VB.NET Pin
drexler_kk28-May-08 15:17
drexler_kk28-May-08 15:17 
AnswerRe: Check tinytext column in MySQL Database with VB.NET Pin
jzonthemtn29-May-08 2:36
jzonthemtn29-May-08 2:36 
QuestionTrouble with VB.NET and XPath Pin
Dominick Marciano28-May-08 9:45
professionalDominick Marciano28-May-08 9:45 
I'm trying to write a program that navigates an XML file with XPath but I'm having trouble if the XML file is structured a certain way. For example here is the code that navigates the XML file:
Dim XDoc as XPathDocument
Dim xmlNav as XPathNavigator
Dim xmlNI as XPathNodeIterator

XDoc = new XPathDocument("C:\sop.xml")
xmlNav = XDoc.CreateNavigator
xmlNI = xmlNav.Select("/SOP_FILE/QuestionList/Question")

While xmlNI.MoveNext
    MsgBox(xmlNI.Current.Name & " - " & xmlNI.Current.Value)
End While

This was just a test function I wrote to try out because this is my first time using XPath; hence it doesn't do much. Now, if I the XML is formated as follows, a message box is never displayed because the xmlNI count is zero:
<?xml version="1.0" encoding="utf-8"?>
<SOP_FILE xmlns="http://schemas.mycompany.com/SOP" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<QuestionList>
<Question Number="1">
<Text>Has a risk assessment been conducted?</Text><Choice Text="Yes" Index="1" PointsTo="2" />
</Question>
<Question Number="2">
<Text>Has an inspection been conducted?</Text><Choice Text="Yes" Index="1" PointsTo="3" />
<Choice Text="No" Index="2" PointsTo="4" />
</Question>
<Question Number="3">
<Text>Is the property lead-based paint free?</Text>
</Question>
</QuestionList>
</SOP_FILE>

However if the second line of the XML file is changed to:
<SOP_FILE>

Instead of:
<SOP_FILE xmlns="http://schemas.mycompany.com/SOP" xmlns:xs="http://www.w3.org/2001/XMLSchema">

Then the test function works properly and loops through all the questions. Can someone please explain to me why this is happening and how to modify the test function so it will work properly. Thanks in advance for any help.
AnswerRe: Trouble with VB.NET and XPath Pin
MidwestLimey28-May-08 13:26
professionalMidwestLimey28-May-08 13:26 
GeneralRe: Trouble with VB.NET and XPath Pin
Dominick Marciano29-May-08 6:43
professionalDominick Marciano29-May-08 6:43 
GeneralRe: Trouble with VB.NET and XPath Pin
MidwestLimey29-May-08 8:19
professionalMidwestLimey29-May-08 8:19 
QuestionbackgroundWorker Help Pin
Cory Kimble28-May-08 7:35
Cory Kimble28-May-08 7:35 
AnswerRe: backgroundWorker Help Pin
Kschuler28-May-08 8:30
Kschuler28-May-08 8:30 
GeneralRe: backgroundWorker Help Pin
Cory Kimble28-May-08 10:47
Cory Kimble28-May-08 10:47 
GeneralRe: backgroundWorker Help Pin
Kschuler28-May-08 10:57
Kschuler28-May-08 10:57 
AnswerRe: backgroundWorker Help Pin
Chinners28-May-08 23:05
Chinners28-May-08 23:05 
QuestionGraphics question Pin
sa_runner28-May-08 5:27
sa_runner28-May-08 5:27 
AnswerRe: Graphics question Pin
Chinners28-May-08 5:57
Chinners28-May-08 5:57 
GeneralRe: Graphics question Pin
sa_runner28-May-08 11:41
sa_runner28-May-08 11:41 
QuestionTurning a functional (not object-oriented) program into a .dll Pin
Eric Burns28-May-08 4:52
Eric Burns28-May-08 4:52 
AnswerRe: Turning a functional (not object-oriented) program into a .dll Pin
Steven J Jowett28-May-08 5:54
Steven J Jowett28-May-08 5:54 
GeneralRe: Turning a functional (not object-oriented) program into a .dll Pin
Eric Burns28-May-08 9:36
Eric Burns28-May-08 9:36 
Questionhow to apply style for anchor tag by using vb.net? Pin
subbu.sk28-May-08 3:24
subbu.sk28-May-08 3:24 
QuestionWhat is the difference between VB and VB.NET? Pin
Sarfraz Munna28-May-08 2:16
Sarfraz Munna28-May-08 2:16 
AnswerRe: What is the difference between VB and VB.NET? Pin
Vasudevan Deepak Kumar28-May-08 2:45
Vasudevan Deepak Kumar28-May-08 2:45 

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.