xpath - Look for a defined sequence-pattern in XML -



xpath - Look for a defined sequence-pattern in XML -

i thinking how/if xquery can used check whether specific pattern exists in xml file.

example: think of (simplified) xml representing process flow (startevent > usertask > autotask > endevent).

<process> <startevent id="start1"> <outgoing>flow1</outgoing> </startevent> <usertask id="user1"> <incoming>flow1</incoming> <outgoing>flow2</outgoing> </usertask> <autotask id="auto1"> <incoming>flow2</incoming> <outgoing>flow3</outgoing> </autotask> <endevent id="end1"> <incoming>flow3</incoming> </endevent> <flow id="flow1" source="start1" target="user1"/> <flow id="flow2" source="user1" target="auto1"/> <flow id="flow3" source="auto1" target="end1"/> </process>

now want check whether somewhere in file element of type "usertask" followed element of type "autotask". please note sequence needs checked going along incoming/outgoing flow definitions , cannot derived ordering in document.

is there way xquery/xpath?

thanks in advance ideas!

the next xpath 1.0 query lists flows source user task , target auto task:

//flow[@source=//usertask/@id , @target=//autotask/@id]

or, without descendants:

/process/flow[@source=/process/usertask/@id , @target=/process/autotask/@id]

or, info in xml redundant, can inquire other way round.

//usertask[outgoing=//autotask/incoming]

it lists user tasks outgoing flow incoming auto task (again, can replace // /process/.

xml xpath xml-parsing xquery bpmn

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -