Kourier uses XPath expressions to map the elements and attributes of an XML document into the fields entered into an Import Specification.
Kourier supports the following XPath syntax:
Parameter |
Description |
---|---|
nodename |
Selectsall elements with nodename |
@ |
Selectsattributes of an element |
/ |
Nodepath divider |
, |
Nodepath divider. [need a better explanation of its use] |
[n] |
Used to indicate which occurrence of a nodename to process |
<?xml version=”1.0” ?> < ADDRBOOK > < ENTRY ID =" id1 "> < NAME > Name One </ NAME > < ADDRESS > 101 Some Way </ ADDRESS > < PHONENUM DESC =" Work1 "> 303-111-1111 </ PHONENUM > < PHONENUM DESC =" Fax1 "> 303-111-2222 </ PHONENUM > < PHONENUM DESC =" Pager1 "> 303-111-3333 </ PHONENUM > < EMAIL > name.one@some.com </ EMAIL > </ ENTRY > < ENTRY ID =" id2 "> < NAME > Name Two </ NAME > < ADDRESS > 202 Some Way </ ADDRESS > < PHONENUM DESC =" Work2 "> 303-222-1111 </ PHONENUM > < PHONENUM DESC =" Fax2 "> 303-222-2222 </ PHONENUM > < PHONENUM DESC =" Home2 "> 303-222-3333 </ PHONENUM > </ ENTRY > < ENTRY ID =" id3 "> < NAME > Name Three </ NAME > < ADDRESS > 203 Some Way </ ADDRESS > < PHONENUM DESC =" Work3 "> 303-333-1111 </ PHONENUM > < PHONENUM DESC =" Fax3 "> 303-333-2222 </ PHONENUM > < PHONENUM DESC =" Home3 "> 303-333-3333 </ PHONENUM > < EMAIL > name.three@some.com </ EMAIL > </ ENTRY > </ ADDRBOOK >
The following XPath expressions would yield the following
data:
XPath Expression |
Returns (| is used as a delimiter to improve readability) |
---|---|
NAME |
Name One | Name Two | Name Three |
ENTRY@ID |
id1 | id2 | id3 |
ADDRBOOK/ENTRY[1]/ADDRESS |
101 Some Way |
ADDRBOOK/ENTRY[2]/PHONENUM[1] |
303-222-1111 |
ADDRBOOK/ENTRY/EMAIL |
name.one@some.com | name.three@some.com |