Using Hp DFE JDF Control... Trying to use asset location as a variable that is buried in the xml... The problem is that the path in the xml reads like this... C:\DEPLOYMENTS\consol.csinc.com\CSIncShare\Output\CS-00001558\0000001_output. I need the value of C: to be changed to an actual ip address... So I decided to try my hand at scripting and used this in the scripting module...
var str = "C:";
var res = str.replace("C:", "123.456.7.8");
and i received an error in switch saying:
Cannot open script package 'C:/Users/switch/Desktop/Test.sscript': neither jobArrived nor timerFired entry point is found
Any help would be greatly appreciated...
How to replace an xml value
-
- Member
- Posts: 32
- Joined: Fri Mar 24, 2017 7:06 pm
- Location: Cleveland, OH
Re: How to replace an xml value
I think you have to have double slashes before the IP-number, and then they might need to be escaped as well meaning //// before the IP-number.
Re: How to replace an xml value
It also looks like your script doesn't have a proper entry point function. It should be wrapped like this:
or if using a timer this:
Code: Select all
function jobArrived( s : Switch, job : Job )
{
}
Code: Select all
function timerFired( s : Switch )
{
}
-
- Newbie
- Posts: 6
- Joined: Sun May 27, 2012 7:11 pm
Re: How to replace an xml value
you can do this without scripting... using single line text with variables. Use "After" C: and in the front place your ip address. Like this example.
\\ip address\[Metadata.Text:Path="/mDocEnvelope/Order/DocumentHeader/FilePath",Dataset="Xml",Model="XML",After="C:"]
\\ip address\[Metadata.Text:Path="/mDocEnvelope/Order/DocumentHeader/FilePath",Dataset="Xml",Model="XML",After="C:"]
-
- Member
- Posts: 32
- Joined: Fri Mar 24, 2017 7:06 pm
- Location: Cleveland, OH
Re: How to replace an xml value
Thank you!!! Never used the "after" function... That worked perfect!