XML pickup tool
XML pickup tool
Can someone help me with the tool xml-pickup?
I want to catch a file as defined in an xml.
The flow gives an error: Failed to find asset ''
An xml file (called: testXml.xml) containing:
pad
E:test.txt
And in Powerswtich an Single-line text with variables defined: [Metadata.Text:Path="//field[tag=pad]/value",Dataset="Xml",Model="XML"].
Where do I go wrong?
I want to catch a file as defined in an xml.
The flow gives an error: Failed to find asset ''
An xml file (called: testXml.xml) containing:
pad
E:test.txt
And in Powerswtich an Single-line text with variables defined: [Metadata.Text:Path="//field[tag=pad]/value",Dataset="Xml",Model="XML"].
Where do I go wrong?
XML pickup tool
As far as I know this requires a script expression rather than a condition with variable. But I do not have a script that would do this.
I'm just a dude. Anything I say has nothing to do with any other person or company.
XML pickup tool
Here, try this:
http://www.mattbeals.com/misc/inject_job.zip
http://www.mattbeals.com/misc/inject_job2.zip
What I did was use the XML as the asset itself. Then I use the inject job to point to a fixed location where the job resides. All the metadata that comes inside the XML is preserved and can be used for routing/processing.
The second sample has a UNC path to the asset itself.
http://www.mattbeals.com/misc/inject_job.zip
http://www.mattbeals.com/misc/inject_job2.zip
What I did was use the XML as the asset itself. Then I use the inject job to point to a fixed location where the job resides. All the metadata that comes inside the XML is preserved and can be used for routing/processing.
The second sample has a UNC path to the asset itself.
I'm just a dude. Anything I say has nothing to do with any other person or company.
XML pickup tool
It works!
Although I do not understand how. How does PowerSwitch know where the tag is for the path? In the manual it says : “the asset (the xml file) must contain data of the appropriate type..” What is the appropriate type?
The method in my original question (XMLpickup – Metadata refers to asset) suggests that the structure of the xml is flexible as long as your Xpath statement is correct... but that didn’t work, so I guess my logic is not sound.
Maybe Enfocus can provide with some more information...but for now I can use your solution.
thanx
Although I do not understand how. How does PowerSwitch know where the tag is for the path? In the manual it says : “the asset (the xml file) must contain data of the appropriate type..” What is the appropriate type?
The method in my original question (XMLpickup – Metadata refers to asset) suggests that the structure of the xml is flexible as long as your Xpath statement is correct... but that didn’t work, so I guess my logic is not sound.
Maybe Enfocus can provide with some more information...but for now I can use your solution.
thanx
XML pickup tool
sherczog wrote: And in Powerswtich an Single-line text with variables defined: [Metadata.Text:Path="//field[tag=pad]/value",Dataset="Xml",Model="XML"].
The xpath expression is not completely correct. Try this one:
[Metadata.Text:Path="//field[tag='pad']/value",Dataset="Xml",Model="XML"]
The xpath expression is not completely correct. Try this one:
[Metadata.Text:Path="//field[tag='pad']/value",Dataset="Xml",Model="XML"]
Re: XML pickup tool
I can't seem to make the method mentioned here work for me.
I have this XML (just the top portion shown for brevity), dataset is named "FTP_XML", I want to use xpath so that I don't have to re-connect everything if I add a field in the middle of the XML.
<?xml version="1.0" encoding="UTF-8"?>
<field-list>
<field>
<tag>CustomerID</tag>
<type>string</type>
<required>true</required>
<value>1107</value>
</field>
[Metadata.Text:Path=''//field[tag='CustomerID']/value",Dataset="FTP_XML",Model="XML"]
Shouldn't the above method work if I choose "textindexed" then "build location path" then External, choose "XPath expression"?
I have this XML (just the top portion shown for brevity), dataset is named "FTP_XML", I want to use xpath so that I don't have to re-connect everything if I add a field in the middle of the XML.
<?xml version="1.0" encoding="UTF-8"?>
<field-list>
<field>
<tag>CustomerID</tag>
<type>string</type>
<required>true</required>
<value>1107</value>
</field>
[Metadata.Text:Path=''//field[tag='CustomerID']/value",Dataset="FTP_XML",Model="XML"]
Shouldn't the above method work if I choose "textindexed" then "build location path" then External, choose "XPath expression"?
Re: XML pickup tool
Using a double slash in an XPath means to start at the beginning of the document. If you're doing that then you need to include the field-list element (
Also Switch's path builder tool is picky about XPaths that match multiple values, so if 'CustomerID' is not a unique value within the XML you could have issues.
Code: Select all
[Metadata.Text:Path="//field-list/field[tag='CustomerID']/value",Dataset="Xml",Model="XML"]
Re: XML pickup tool
Yeah nada:
[Metadata.Text:Path="//field-list/field[tag='PO#']/value",Dataset="FTP_XML",Model="XML"]
Doesn't work, I get the following error:
"There is no selected node. A location path is valid only when it indicates a single node"
[Metadata.Text:Path="//field-list/field[tag='PO#']/value",Dataset="FTP_XML",Model="XML"]
Doesn't work, I get the following error:
"There is no selected node. A location path is valid only when it indicates a single node"
Re: XML pickup tool
You sure that PO# is unique in the XML file? If it points to multiple nodes then you'll get that error.
What happens if you define the first node like this:
What happens if you define the first node like this:
Code: Select all
//field-list/field[tag="PO#"][1]/value
Re: XML pickup tool
That at least highlights the opening value tag <value> for the correct node and doesn't give an error in that dialog. For testing purposes I was playing with an existing SQL call (just some place I could define a variable) and it gives this error in response to the following in the "Text with variables" field:
[Metadata.TextIndexed:Path="//field-list/field[tag="PO#"][1]/value",Dataset="FTP_XML",Model="XML"]
Variable 'Metadata.TextIndexed' has incorrect syntax in 'SQL statement': unexpected 'P' characters after the argument value; expected characters are ',' or ']' - But if I change the double quotes around the tag name "PO#" to single quotes, all is well. Then it also works to take the [1] specifier out;
[Metadata.TextIndexed:Path="//field-list/field[tag='PO#']/value",Dataset="FTP_XML",Model="XML"]
So it was just "Metadata.TextIndexed" vs. "Metadata.TextPath" that was at issue.
Thanks for the assistance!
[Metadata.TextIndexed:Path="//field-list/field[tag="PO#"][1]/value",Dataset="FTP_XML",Model="XML"]
Variable 'Metadata.TextIndexed' has incorrect syntax in 'SQL statement': unexpected 'P' characters after the argument value; expected characters are ',' or ']' - But if I change the double quotes around the tag name "PO#" to single quotes, all is well. Then it also works to take the [1] specifier out;
[Metadata.TextIndexed:Path="//field-list/field[tag='PO#']/value",Dataset="FTP_XML",Model="XML"]
So it was just "Metadata.TextIndexed" vs. "Metadata.TextPath" that was at issue.
Thanks for the assistance!
Re: XML pickup tool
Have you tried [Metadata.Text.... instead of TextIndexed ?
TextIndexed will give you an array of values instead of just the value from the node if you use Text.
The Tag must always be in single quotes otherwise you break the XPath.
TextIndexed will give you an array of values instead of just the value from the node if you use Text.
The Tag must always be in single quotes otherwise you break the XPath.
Re: XML pickup tool
I will try that, thanks!