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.

1
  • 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 Commented Oct 18, 2015 at 15:57

1 Answer 1

0

Here is how you can get all ID values.

//DVAL_ID/@ID
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.