Xpath Expression for mining XML tag content

Questions about XML that are not covered by the other forums should go here.
matrix
Posts: 5
Joined: Fri Sep 27, 2013 7:14 am

Xpath Expression for mining XML tag content

Post 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.
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Xpath Expression for mining XML tag content

Post 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
Mihaela Calotescu
http://www.oxygenxml.com
Post Reply