0

I am having an xml file as follows:

########################
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE form (View Source for full doctype...)>
- <form name="Test_Form" xmlns="http://www.lotus.com/dxl" version="6.5" replicaid="652573B0001EDB3B" publicaccess="false" designerversion="6.5" noreplace="false" useapplet="false" treatashtml="false" default="false" private="false" readingorder="lefttoright" inherit="false" mailable="false" type="document" recalc="false" storeform="false" editonopen="false" anonymous="false" nofieldexchange="false" versions="none" manualversion="false" inheritdoc="none" contextpane="hide" conflictaction="createconflicts" noinitialfocus="false" nofocusonf6="false" signdocuments="false">
+ <noteinfo noteid="132" unid="6164A9F1C6487C01652573B0001EDC9E" sequence="1">
- <created>
<datetime dst="false">20071213T110705,58+0530</datetime>
</created>
- <modified>
<datetime dst="false">20071213T110752,02+0530</datetime>
</modified>
- <revised>
<datetime dst="false">20071213T110751,95+0530</datetime>
</revised>
- <lastaccessed>
<datetime dst="false">20071213T110752,02+0530</datetime>
</lastaccessed>
- <addedtofile>
<datetime dst="false">20071213T110752,02+0530</datetime>
</addedtofile>
</noteinfo>
+ <updatedby>
<name>CN=DominoM1/O=infosys</name>
</updatedby>
+ <wassignedby>
<name>CN=DominoM1/O=infosys</name>
</wassignedby>
- <body>
- <richtext>
<pardef id="1" align="left" linespacing="1" spacebefore="1" spaceafter="1" hide="" newpage="false" list="none" readingorder="lefttoright" />
- <par def="1">
Label
<field type="text" kind="editable" name="Test_field" allowmultivalues="false" protected="false" sign="false" computeaftervalidation="false" defaultfocus="false" showdelimiters="true" allowtabout="false" useappletinbrowser="false" storelocally="false" dataconnectionfield="data" />
</par>
- <par>
<button width="2in" widthtype="maximum" wraptext="true" bgcolor="system" type="normal" default="false" edge="system" readingorder="lefttoright">Submit</button>
</par>
</richtext>
</body>
+ <item name="$$ScriptName" summary="false" sign="true" seal="false" sealed="false" authors="false" names="false" readers="false" placeholder="false">
- <textlist>
<text>Test_Form</text>
</textlist>
</item>
</form>

#####################
In this I want to read the value "type" and name that is there in "/form/body/richtext/par/field

and also the value Submit

I have written the below code to access "type"

################################
Try
Dim m_xmld As XmlDocument
Dim m_nodelist As XmlNodeList
Dim m_node As XmlNode
Dim XML_nodes(5) As String
Dim xml_currnode, value As String
'Dim strWriter As StreamWriter
m_xmld = New XmlDocument
m_xmld.Load("D:\Form Library\Test.xml")

'MsgBox("loaded")
XML_nodes(0) = "/form/body"
XML_nodes(1) = "/form/body/richtext"
XML_nodes(2) = "/form/body/richtext/par"
' XML_nodes(3) = "/form/body/richtext/par/button"
'MsgBox("declared")

For Each xml_currnode In XML_nodes
m_nodelist = m_xmld.SelectNodes(xml_currnode)
For Each m_node In m_nodelist
'MsgBox("m_node")

If xml_currnode = "/form/body/richtext/par/field" Then
value = m_node.Attributes.GetNamedItem("type").Value
'MsgBox("value")
End If

Next
Next

Catch ex As Exception
MsgBox(ex.ToString())
End Try


In throws an exception "System.xml.xpath.xpathexception' is an invalid expression and not entering into For loops

Do help me out in this
Thanks in advance

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by bcm
0

Does your code get the file location properly because I think the problem is with the path
if yes try this
System.AppDomain.CurrentDomain.BaseDirectory()
in place of path

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.