Skip to main content
rameshp575128
October 11, 2024
Question

xpathdocument()

  • October 11, 2024
  • 6 replies
  • 0 views

Hi All,

 I am trying to fetch data details from an XML file which contains XML code of an Process Model.
When I try to fetch the name , UUID or Pv's data using the following syntax 

for PV's : xpathdocument( docId , "processModelHaul/process_model_port/pm/pvs/pv[1]/name" )

for UUID : xpathdocument( docId , "processModelHaul/process_model_port/pm/meta/uuid" )

for Name : xpathdocument( docId , "processModelHaul/process_model_port/pm/meta/name/string-map/pair[1]/value" )

I am getting no response.
when i checked in Community : https://docs.appian.com/suite/help/24.3/fnc_scripting_xpathdocument.html
there also it was mentioned the similar syntax that i am using.
But still i am not getting why the I am getting null as output.

Thanks in advance.

6 replies

davidj137213
October 11, 2024

You need to add "/" at the beggining of your expression

If that doesn't work, build the expression from scratch and check the results on each iteration.

xpathdocument( docId , "/*" ) --> This will return the whole xml

It it works, go to next level in the xml

xpathdocument( docId , "/processModelHaul/*" ) 

Do this until you have the whole expression...

rameshp575128
October 11, 2024

Hi David,
Thanks for your response,
I have tried the way you suggested,
and its working when i am trying to fetch the rolemap by using 
xpathdocument(
docId: docId,
expression: "/processModelHaul/roleMap/*"
)

davidj137213
October 11, 2024

process_model_port is not a valid element or the namespace is incorrect.

Could you paste here the xml please?

October 11, 2024

The following is working:

xpathdocument(12345, "/processModelHaul//*[local-name()='pvs']")

Hope this will help.

somasundaram.d
October 12, 2024

Can you please share the XML data