I am new to Xpath and am trying to parse a UML model saved in XML format.
I have some nodes in the form :-
<ModelProfile:create xmi:id='_16_0_1_187c046a_1307545286478_527165_409' base_Element='_16_0_1_187c046a_1307545286478_986851_398'/>
<ModelProfile:get xmi:id='_16_0_1_187c046a_1307545286478_698482_412' base_Element='_16_0_1_187c046a_1307545286478_639036_401'/>
I have the base_Element value and know that the nodes begin with ModelProfile: , but I need to get what the value after the ModelProfile: string is – i.e. the word "get" or "create" in the above 2 examples.
How can I do this in Xpath (in Java)?
Thanks
Sarah
Assuming you have registered the
ModelProfilenamespace URI, you can use:to get all nodes with that particular
base_Elementattribute value.From there on you can use the
nodeNameproperty of the returned nodes.