0

I have an Element object with records in XML like this:

<DIMENSION NAME="Depth_Inches" SRC_TYPE="INTERNAL">
    <DIMENSION_ID ID="5013678"/>
    <DIMENSION_NODE>
      <DVAL TYPE="EXACT">
        <DVAL_ID ID="5013678"/>
        <SYN CLASSIFY="FALSE" DISPLAY="TRUE" SEARCH="FALSE">Depth_Inches</SYN>
        <PROP NAME="display_name">
          <PVAL>Dryer Depth (Inches)</PVAL>
        </PROP>
      </DVAL>
      <DIMENSION_NODE>
        <DVAL TYPE="RANGE">
          <DVAL_ID ID="5013679"/>
          <SYN CLASSIFY="TRUE" DISPLAY="TRUE" SEARCH="TRUE">0 - 14.9999</SYN>
          <LBOUND>
            <BOUND CLOSURE="CLOSED" TYPE="FLOAT" VALUE="0 "/>
          </LBOUND>
          <UBOUND>
            <BOUND CLOSURE="CLOSED" TYPE="FLOAT" VALUE=" 14.9999"/>
          </UBOUND>
          <PROP NAME="DISPLAY_ORDER">
            <PVAL>6</PVAL>
          </PROP>
        </DVAL>
      </DIMENSION_NODE>
      <DIMENSION_NODE>
        <DVAL TYPE="RANGE">
          <DVAL_ID ID="5013680"/>
          <SYN CLASSIFY="TRUE" DISPLAY="TRUE" SEARCH="TRUE"> 15 - 25.9999</SYN>
          <LBOUND>
            <BOUND CLOSURE="CLOSED" TYPE="FLOAT" VALUE=" 15 "/>
          </LBOUND>
          <UBOUND>
            <BOUND CLOSURE="CLOSED" TYPE="FLOAT" VALUE=" 25.9999"/>
          </UBOUND>
          <PROP NAME="DISPLAY_ORDER">
            <PVAL>5</PVAL>
          </PROP>
        </DVAL>
      </DIMENSION_NODE>
    </DIMENSION_NODE>
  </DIMENSION>

I want to get the DVAL_ID's attribute ID's value (Example- 5013679) as a string, print it and update it to a new ID number (say 12345). How do I do it in XPath. There are similar questions here but none that addresses Attribute values and updating them. Any help is appreciated.

subhatt
  • 3
  • 4
  • 1
    I tried using setNodeValue but I'm unable to come up with an accurate XPath expression. Hence getting a null for Element object. @Tunaki – subhatt Oct 18 '15 at 15:57

1 Answers1

0

Here is how you can get all ID values.

//DVAL_ID/@ID
Dmytro Pastovenskyi
  • 5,240
  • 5
  • 37
  • 56