XML

  • Hi ,

    I would like to know Is there is any way to retrieve XPath of a particular node.

    Below is the XML Input file:

    MENU name="Burger King">

    MENU name="USA">

    MENU name="Alabama">

    MENU name="County A">

    MENU name="Restaurant A">

    MENU name="Reports">

    REPORT report_name="Alerts">

    TABLE table_name="Alerts">

    METADATA>

    FIELDS>

    FIELD attrname="CA_NAME" display_name="Alert Type" />

    FIELD attrname="CA_REFVAL" display_name="Ref Value" />

    /FIELDS>

    /METADATA>

    - ROWDATA>

    ROW CA_NAME="Open/Not Printed" CA_REFVAL="90" />

    ROW CA_NAME="Open/Not Printed" CA_REFVAL="90" />

    /ROWDATA>

    /TABLE>

    /REPORT>

    - REPORT report_name="Session Monitor">

    - TABLE table_name="Session">

    - METADATA>

    - FIELDS>

    FIELD attrname="DESCRIPTION" display_name="Description" />

    FIELD attrname="VALUE" display_name="Value" />

    /FIELDS>

    /METADATA>

    - ROWDATA>

    ROW DESCRIPTION="Sales (Total)" VALUE="732.15" />

    ROW DESCRIPTION="Sales (Closed)" VALUE="508.35" />

    /ROWDATA>

    /TABLE>

    /REPORT>

    /MENU>

    /MENU>

    /MENU>

    /MENU>

    /MENU>

    /MENU>

    In the above XML I know the Node names only from

    "REPORT report_name="Alerts">" to "/REPORT>" that means

    levels inside this portion is pre defined but levels upto "REPORT report_name="Alerts">" is dynamic ie it is not pre defined

    (MENU name="Burger King">

    - MENU name="USA">

    - MENU name="Alabama">

    - MENU name="County A">

    - MENU name="Restaurant A">

    - MENU name="Reports">).The above "menu>" portion is dynamic on each and every Input.

    Some times there is two levels say (MENU name="Burger King">

    - MENU name="USA">),sometimes more than two .I would like to get the Xpath upto "REPORT report_name="Alerts">".

    Thanks

    Jobin Sebastian

  • Please attach your XML as a text file, so people can play around with it.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply