Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Getting Incorrect result--XPATH to Get Number of Pages

Avatar

Avatar
Validate 1
Level 3
jb1809
Level 3

Like

1 like

Total Posts

55 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 3
jb1809
Level 3

Like

1 like

Total Posts

55 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jb1809
Level 3

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

Avatar

Avatar
Coach
Level 10
Jasmin_Charbonn
Level 10

Likes

149 likes

Total Posts

2,154 posts

Correct Reply

97 solutions
Top badges earned
Coach
Give Back 1000
Give back 900
Give Back 800
Give back 600
View profile

Avatar
Coach
Level 10
Jasmin_Charbonn
Level 10

Likes

149 likes

Total Posts

2,154 posts

Correct Reply

97 solutions
Top badges earned
Coach
Give Back 1000
Give back 900
Give Back 800
Give back 600
View profile
Jasmin_Charbonn
Level 10

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

Avatar

Avatar
Validate 1
Level 3
jb1809
Level 3

Like

1 like

Total Posts

55 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 3
jb1809
Level 3

Like

1 like

Total Posts

55 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
jb1809
Level 3

20-05-2008

Hello Jasmin,



Will do. Thank you.



Jesse