3 Replies Latest reply: Jan 9, 2007 11:50 AM by 807607 RSS

    XML node name matching with regular expressions

    807607
      Hello,

      If i have an xml file that has the following:

      <parameter>
      <name>M2-WIDTH</name>
      <value column="09" date="2004-10-31T19:56:30" row="03" waferID="PUK444150-20">10.4518</value>
      </parameter>
      <parameter>
      <name>M2-GAP</name>
      <value column="29" date="2004-10-31T19:56:30" row="06" waferID="PUK444150-03">2.864</value>
      </parameter>
      <parameter>
      <name>RES-LENGTH</name>
      <value column="29" date="2004-10-31T19:56:30" row="06" waferID="PUK444150-03">2.864</value>
      </parameter>

      Is there anyway i can get a list of nodes that match a certain pattern say where name=M2* ?

      I cant seem to find any information where i can match a regular expression. I see how you can do:
      String expression=/parameter[@name='M2-LENG']/value/text()";
      NodeList nodes = (NodeList) xPath.evaluate(expression, inputSource, XPathConstants.NODESET);

      But i want to be able to say:
      String expression=/parameter[@name='M2-*']/value/text()";

      Is this possible? if so how can i do this?

      Thanks!