Click here to Skip to main content
15,920,633 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: xsl:for-each question Pin
Dewald4-Jun-08 21:32
Dewald4-Jun-08 21:32 
QuestionXSD:PATTERN question Pin
Andy H3-Jun-08 22:49
Andy H3-Jun-08 22:49 
QuestionGenerating XML Schema of SQL Server 2005 Database Pin
Rocky#2-Jun-08 18:51
Rocky#2-Jun-08 18:51 
AnswerRe: Generating XML Schema of SQL Server 2005 Database Pin
led mike3-Jun-08 5:12
led mike3-Jun-08 5:12 
GeneralRe: Generating XML Schema of SQL Server 2005 Database Pin
Rocky#3-Jun-08 5:17
Rocky#3-Jun-08 5:17 
QuestionHow to convert c++ classes into xsd format Pin
cutecutemouse1-Jun-08 22:48
cutecutemouse1-Jun-08 22:48 
QuestionSpecial character for the enum type in DTD Schema Pin
Nacho Chip30-May-08 16:33
Nacho Chip30-May-08 16:33 
QuestionTrouble with VB.NET and XPath Pin
Dominick Marciano29-May-08 6:52
professionalDominick Marciano29-May-08 6:52 
I was told that I may be able to get better help in this forum so I am reposting my question here.

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
George L. Jackson1-Jun-08 15:45
George L. Jackson1-Jun-08 15:45 
QuestionHow to bind Detailsview tmplate field with xml data Pin
nitinsk200826-May-08 20:29
nitinsk200826-May-08 20:29 
QuestionTreeView using XAML Pin
Arijit Manna26-May-08 3:13
Arijit Manna26-May-08 3:13 
Answer[Cross Post]Re: TreeView using XAML Pin
Scott Dorman26-May-08 5:11
professionalScott Dorman26-May-08 5:11 
GeneralRe: [Cross Post]Re: TreeView using XAML Pin
Arijit Manna26-May-08 18:53
Arijit Manna26-May-08 18:53 
GeneralRe: [Cross Post]Re: TreeView using XAML Pin
Scott Dorman27-May-08 1:34
professionalScott Dorman27-May-08 1:34 
QuestionUse a database or XML? Pin
dreamaway82023-May-08 5:01
dreamaway82023-May-08 5:01 
AnswerRe: Use a database or XML? Pin
led mike23-May-08 8:19
led mike23-May-08 8:19 
AnswerRe: Use a database or XML? Pin
Scott Dorman26-May-08 5:03
professionalScott Dorman26-May-08 5:03 
AnswerRe: Use a database or XML? Pin
PIEBALDconsult6-Jun-08 10:34
mvePIEBALDconsult6-Jun-08 10:34 
QuestionHow to Save full path of file in XML file like C:\xyz\patient.bmp Pin
Abhijit D. Babar22-May-08 22:28
Abhijit D. Babar22-May-08 22:28 
AnswerRe: How to Save full path of file in XML file like C:\xyz\patient.bmp Pin
led mike23-May-08 5:13
led mike23-May-08 5:13 
AnswerRe: How to Save full path of file in XML file like C:\xyz\patient.bmp Pin
PIEBALDconsult6-Jun-08 10:35
mvePIEBALDconsult6-Jun-08 10:35 
QuestionMany-To-Many DataSet as XML document Pin
Miszou22-May-08 11:07
Miszou22-May-08 11:07 
Questionwrite PMML as in XML use Vc++ Pin
Member 365375120-May-08 23:42
Member 365375120-May-08 23:42 
AnswerRe: write PMML as in XML use Vc++ Pin
led mike21-May-08 6:16
led mike21-May-08 6:16 
QuestionModify large XML files [modified] Pin
rzumbado19-May-08 12:37
rzumbado19-May-08 12:37 

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.