How to access the node in xml

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mariyana
    New Member
    • Mar 2007
    • 11

    How to access the node in xml

    I have an xml file named Trees.xml.
    now the xml file is as below
    <////////xml///////>
    <report xmlns="http://developer.cogno s.com/schemas/impromptu/report/1.0/" timeStamp="4652 E450" schemaVersion=" 1.0" fileFormat="3E7 A">

    +<header>
    +<layoutSpec>
    -<queries>
    -<query isTemplate="no" type="power">
    <name/>
    +<columns>
    - <filters>
    - <detail>
    - <expression>
    <name>New Expression</name>
    <type>detail_fi lter</type>
    <dataType>boole an</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.Lo ad App.path & "Trees.xml"



    How can i access the filter expression(Colu mnRef["GOS"."PRODUCT_ MULTILINGUAL"." PRODUCT_NAME"] starts with "I" ) using the object xml_document. I gave it as
    <************** *************** *******>
    Set getFilterNode = xml_document.se lectNodes("/report/queries/query/filter/detail/expression")
    MsgBox "filter" & getFilterNode.I tem(0).Text
    <************** *************** *******>

    but nothing is getting displayed
  • dorinbogdan
    Recognized Expert Contributor
    • Feb 2007
    • 839

    #2
    Welcome to TheScripts TSDN....

    If I see correctly the XML (filters instead of filter), try:
    "/report/queries/query/filters/detail/expression"

    Comment

    • tosachinji
      New Member
      • Jul 2007
      • 2

      #3
      Hi,

      I am also new to xslt. I am also facing the same issue.

      I have a xml file.

      <?xml version="1.0" encoding="iso-8859-1" ?>
      <report xmlns="http://developer.cogno s.com/schemas/impromptu/report/1.0/" timeStamp="46A8 8410" schemaVersion=" 1.0" fileFormat="3E7 1"><header><typ e>template</type>
      <name>/apps/dw/devl/pscognosr4/ReportStore/F_FM/apps/fm_dev.imr</name>
      <catalog><nam e>/apps/dw/devl/pscognosr4/ReportStore/F_FM/apps/fmdev.cat</name>
      <database>fmdwr 4d</database>
      </catalog>
      <appVersion>7.1 .821.0 UDA-SX-ML-7.5-WIP-23912-0.23912</appVersion>
      </header>

      xml file is having report tag with attributes. when i try to match report tag it does not matches.

      Here is the syntax:

      <?xml version="1.0"?>
      <xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" xmlns="http://developer.cogno s.com/schemas/impromptu/report/1.0
      /" version="1.0">
      <xsl:output method="xml"/>

      <xsl:template match="report">

      But when I remove attributes from report tag from xml file and then run xslt it matches.

      Please tell me, how can i match report tag with attributes through xslt.

      Thanks,
      Sachin






      Originally posted by mariyana
      I have an xml file named Trees.xml.
      now the xml file is as below
      <////////xml///////>
      <report xmlns="http://developer.cogno s.com/schemas/impromptu/report/1.0/" timeStamp="4652 E450" schemaVersion=" 1.0" fileFormat="3E7 A">

      +<header>
      +<layoutSpec>
      -<queries>
      -<query isTemplate="no" type="power">
      <name/>
      +<columns>
      - <filters>
      - <detail>
      - <expression>
      <name>New Expression</name>
      <type>detail_fi lter</type>
      <dataType>boole an</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.Lo ad App.path & "Trees.xml"



      How can i access the filter expression(Colu mnRef["GOS"."PRODUCT_ MULTILINGUAL"." PRODUCT_NAME"] starts with "I" ) using the object xml_document. I gave it as
      <************** *************** *******>
      Set getFilterNode = xml_document.se lectNodes("/report/queries/query/filter/detail/expression")
      MsgBox "filter" & getFilterNode.I tem(0).Text
      <************** *************** *******>

      but nothing is getting displayed

      Comment

      • jkmyoung
        Recognized Expert Top Contributor
        • Mar 2006
        • 2057

        #4
        Namespace problem:
        <xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" xmlns="http://developer.cogno s.com/schemas/impromptu/report/1.0/" xmlns:rep="http ://developer.cogno s.com/schemas/impromptu/report/1.0/" version="1.0">
        <xsl:output method="xml"/>

        <xsl:template match="rep:report">

        Comment

        Working...