Click to See Complete Forum and Search --> : To access a node in xml


mariyana
05-23-2007, 12:51 AM
I have an xml file named Trees.xml.
now the xml file is as below
<////////xml///////>
<report xmlns="http://developer.cognos.com/schemas/impromptu/report/1.0/" timeStamp="4652E450" schemaVersion="1.0" fileFormat="3E7A">

+<header>
+<layoutSpec>
-<queries>
-<query isTemplate="no" type="power">
<name/>
+<columns>
- <filters>
- <detail>
- <expression>
<name>New Expression</name>
<type>detail_filter</type>
<dataType>boolean</dataType>
ColumnRef["GOS"."PRODUCT_MULTILINGUAL"."PRODUCT_NAME"] starts with "I"
</expression>
</detail>
</filters>

<////////////xml////////////>


I have loaded the file into an object xml_document as declared below.

</////////code/////////////>
Dim xml_document As DOMDocument30

Set xml_document = New DOMDocument30
xml_document.Load App.path & "Trees.xml"



How can i access the filter expression(ColumnRef["GOS"."PRODUCT_MULTILINGUAL"."PRODUCT_NAME"] starts with "I" ) using the object xml_document. I gave it as
<************************************>
Set getFilterNode = xml_document.selectNodes("/report/queries/query/filter/detail/expression/name/type/datatype")
MsgBox "filter" & getFilterNode.Item(0).Text
<************************************>

but nothing is getting displayed

jkmyoung
05-23-2007, 10:06 AM
The text is a child of the expression node. The other children elements are not part of it's xpath. Would need to see all of the xml to be sure, but it's probably:
Set getFilterNode = xml_document.selectNodes("/report/queries/query/filters/detail/expression")