Highlighted

Getting Incorrect result--XPATH to Get Number of Pages

jb1809

20-05-2008

Hello Developers,

I'm getting incorrect results when using Livecycle XPath to get the number of Page node in
the following xml(Got the xml document by invoking DDX): (in test data getting value 0 instead of 3)

[1] the xml
[PID:-1] /process_data/xtextinfo - XML Document:


Document starting Clause - 1 this is clause 1 . clause - 2 this is clause 2 clause - 3 this is clause 3 clause - 4 form 1
PHFORM1PH this is clause 4
clause - 5 this is clause 5 clause 7 This is clause 7 document All done .



[2] the process variable
xtextinfo : xml

[3] the xpath to set the variable (variable is xnrpages : int ) to the number of Page elements in the xml document

count( /process_data/xtextinfo/DocText/TextPerPage/Page )

[4] value in the log

[PID:-1] /process_data/@xnrpages - java.lang.Integer: 0
2008-05-20 14:24:27,029 INFO [com.adobe.idp.dsc.variablelogger.VariableLoggerService]
2008-05-20 14:24:27,029 INFO [com.adobe.idp.dsc.variablelogger.VariableLoggerService]

[5] I am getting a value of 0; I expected to get a value of 3 (three Page element in the XML document).

Let me know if you see the error I'm making.

Thanks,
Jesse

Replies

Highlighted

Jasmin_Charbonn

20-05-2008

It's because you have a namespace in your xml and all the nodes inherit that default namespace.



Here's what you need to do:



- Add that namespace to the properties of your process (under Properties/Advanced from the processes view). You can use any prefix i.e. tmp.



- Add that prefix to your xPath expression. Your xPath will look like:

count( /process_data/xtextinfo/tmp:DocText/tmp:TextPerPage/tmp:Page )



Jasmin