Get value using xpath

Avatar

Avatar
Validate 1
Level 3
alukyro
Level 3

Likes

0 likes

Total Posts

61 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 3
alukyro
Level 3

Likes

0 likes

Total Posts

61 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
alukyro
Level 3

01-12-2008

Hi,



I'm prepopulating my form with xml. I need to access some elements in this xml (get the value of) using javascript and xpath.



Anybody know how that can be done, please?



Kind regars



Lars

Replies

Avatar

Avatar
Boost 1
Level 4
aoatak
Level 4

Like

1 like

Total Posts

105 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 4
aoatak
Level 4

Like

1 like

Total Posts

105 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
aoatak
Level 4

02-12-2008

Hi Lars,

Would you like to get the field values within your process? If so, it depends on your process variable type:



-If it xfaform, you can directly use xpath (you should know the xml schema if you did not embedded in the form)



-If it is a DocumentForm then you can extract its data into XML using Form Data Integration services. From the XML data you can still get the values using XPATH



Oguz

http://www.kgc.com.tr

Avatar

Avatar
Validate 1
Level 3
alukyro
Level 3

Likes

0 likes

Total Posts

61 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 3
alukyro
Level 3

Likes

0 likes

Total Posts

61 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
alukyro
Level 3

03-12-2008

Hi Oguz,



Thanks for your reply. What I need to do is make the xpath calls in Designer on my dataconnection, rather than in Workbench.



In the LiveCycle Designer I have attached an xsd as datasource. I would like to implement some logic in this form using xpath and javascript. For example make an xpath that counts the number of a given element or extract values from the incoming xml.



Thanks



Lars

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

04-12-2008

You do not need xpath .....you have access to the data dom that is loaded in the form. To access it use xfa.datasets.data. This will give you access to the root node. You can path through al nodes to get to the one you want from there. I like to see the structure I am working with so I create a multiline field on the form and use this command to see the DOM Fieldname.rawValue = xaf.datasets.data.saveXML("pretty");



This will dump the DOM into that field so you can visually see it. Then you can simply path your way to the node that you want.



If you want the value of a node use the value command and not rawValue. There is also a nodes command that will return multiple nodes as well. Play with it and see if it does what you want.

Avatar

Avatar
Validate 1
Level 3
alukyro
Level 3

Likes

0 likes

Total Posts

61 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 3
alukyro
Level 3

Likes

0 likes

Total Posts

61 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
alukyro
Level 3

05-12-2008

Thanks Paul,



I tried creating the multiline field to see the DOM - worked great 🙂



In regards to the path to nodes, I do this right from xfa.datasets.data? Like for example: "xfa.datasets.data.Application.Applicant.value" (If I wanted the value under Applicant)



Thanks again

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

05-12-2008

yes .....notice that it will follow the heirarchy of the form or the schema if there is one present.

Avatar

Avatar
Validate 1
Level 3
alukyro
Level 3

Likes

0 likes

Total Posts

61 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 3
alukyro
Level 3

Likes

0 likes

Total Posts

61 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
alukyro
Level 3

08-12-2008

Thanks 🙂