Xpath Expression for mining XML tag content

Questions about XML that are not covered by the other forums should go here.
matrix
Posts: 5

Xpath Expression for mining XML tag content

Thu Nov 19, 2015 6:13 am

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: 189

Re: Xpath Expression for mining XML tag content

Fri Nov 20, 2015 11:09 am

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.5/sourcedocs/collections.html
Youc an find here an example:
https://www.safaribooksonline.com/library/view/xslt-2nd-edition/9780596527211/ch08s07.html
Mihaela Calotescu
http://www.oxygenxml.com

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 1 guest