How to define an unique XML-Path

Post Reply
pfischer
Member
Posts: 43
Joined: Tue May 14, 2013 4:57 pm

How to define an unique XML-Path

Post by pfischer »

Hi everybody,

I have a small flow, where the user have to fill out 7 fields with metadata-information (via "Submission point" configurator) in switch client (e.g. document-author of a PDF). This metadata of the PDF is updated with the "Inject XMP" configurator. The updated metadata entries are generated with a "Single-line text with variables" and these variable contains an XML-Path like this:
[Metadata.Text:Path="/field-list/field[7]/value",Dataset="Submit",Model="XML"]

Everything works correct so far.

But if I add a new metadata field at the beginning of my list in the "Submission point" configurator, all following entries get a new number in the field-list. E.g. in my list the former field[1] will get field[2], the former field[3] gets field[4] and so on. So I have to update all XML-path-entries in my complete flow.

How is it possible to set a unique XML-path? I think this should be able with the field-Id but I have no idea how to make it work and I haven't found a hint in the manuals. Please take a look at my screenshot - there you can see that the second entry (id = is @id=spMF_7_3) is the 7th entry that I have added.

Thanks for your support,
Peter
xml_path.PNG
xml_path.PNG (13.76 KiB) Viewed 7359 times
Media asset and production specialist
Group Communications / System Operations
Phoenix Contact GmbH & Co. KG
www.phoenixcontact.com
cstevens
Member
Posts: 103
Joined: Tue Feb 12, 2013 8:42 pm

Re: How to define an unique XML-Path

Post by cstevens »

replace the node index [7] with something unique to that node. For example:

[Metadata.Text:Path="/field-list/field[@Id='spMF_7_3']/value",Dataset="Submit",Model="XML"]

That way the order of the elements doesn't matter.
NEOSA
Member
Posts: 39
Joined: Thu Mar 10, 2016 6:31 pm

Re: How to define an unique XML-Path

Post by NEOSA »

As explained by cstevens, a shorter path can also be used :

//field[@Id='spMF_7_3']/value

"//" means :

//ename selects all ename elements in a document.
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: How to define an unique XML-Path

Post by gabrielp »

Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
pfischer
Member
Posts: 43
Joined: Tue May 14, 2013 4:57 pm

Re: How to define an unique XML-Path

Post by pfischer »

Thanks for your help. It works fine.

It would be great, if it is possible to create the XML-Path by clicking on the different node entries. For me it is only possible to create a XML-Path with the node index first and after that, manually replace the index number with an unique entry with the risk of an typing error. Maybe in a future Switch version...
Media asset and production specialist
Group Communications / System Operations
Phoenix Contact GmbH & Co. KG
www.phoenixcontact.com
Post Reply