Page 1 of 1

Xpath Expression for mining XML tag content

Posted: Thu Nov 19, 2015 6:13 am
by matrix
Fellow Forum Members,
I'm using the latest OxygenXML version and need to know if the Xpath feature will perform a task I need to accomplish. I have 430 separate XML files and my goal is to make a "dmcode" list of all 430 XML files. The dmcode identifies each XML file and looks like the example code shown below. I need help in developing an Xpath Expression that will grab the dmcode tag content located between the

Code: Select all

<dmCode
opening tag and the closing

Code: Select all

/>
terminator. Also I only need this tag content extraction to only apply to dmcode tags that follows the

Code: Select all

<dmIdent>
tag. In other words, any dmcode tag that is not preceded by a

Code: Select all

<dmIdent>
tag does not end up my list. Can the OxygenXML Xpath feature perform such XML tag content mining across 430 XML files and make me a list I could paste into Microsoft Excel?

Code: Select all

<dmIdent>
<dmCode assyCode="00" disassyCode="00" disassyCodeVariant="00" infoCode="042" infoCodeVariant="A" itemLocationCode="O" modelIdentCode="SASA" subSubSystemCode="6" subSystemCode="0" systemCode="A03" systemDiffCode="XY"/>
Any help will be greatly appreciated.

Re: Xpath Expression for mining XML tag content

Posted: Fri Nov 20, 2015 11:09 am
by mihaela
Hi,

I think that you can create an XSLT stylesheet for this kind of tasks.
You can look more to the collection() function:
http://www.saxonica.com/documentation9. ... tions.html
Youc an find here an example:
https://www.safaribooksonline.com/libra ... 08s07.html