Copy link to clipboard
Copied
not ablr to read highlighted tag
var myProject = myxml.Journal;
for (var i = 0; i < myProject.length(); i++){
toolname = myProject[0].toolname .@name;
var logoPath=myProject[0].alt-title-icon.@path; ....not able to read bold part able to read toolname
}
}
Thanks all of you.
I used the below line to read the path and stored in my path.its working.
myPath=myProject[0].xpath("\\alt-title-icon").@path.toString();
Anupam
Copy link to clipboard
Copied
myProject.xpath("//alt-title-icon/@path")
should work.
Copy link to clipboard
Copied
Hi Dirk,
hm, yes.
Note: The backslashes in the path string will not be returned…
This is an issue of the data source. The backslashes are not escaped.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi Uwe,
above was no working code example, I assume the XML was manually typed (telling from the lowercase end tag "config").
When you wrap it in JS / E4X to get the example going, you will lose the single backslash, because for a literal in your overall JS source you'd need them escaped. Otherwise the single backslash should be ok, nothing to worry about the data source.
OP chould have used the toSource() method to produce the example.
The issue of OP is the minus in the element names, which is not the best choice for a Javascript / E4X name.
I think instead of xpath something like myProject["da-name"] would also work, or some variation on xml node functions - e.g. element("da-name") .
Copy link to clipboard
Copied
Hi Dirk,
I understand…
myProject["alt-title-icon path"]
is working. It returns "D:AnupamRY"
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Anupam,
You used loop then why you used myProject[0] instead of myProject[i]?
Sumit
Copy link to clipboard
Copied
Just to clarify, backslashes have no special meaning in XML, and the data in <alt-title-icon path="D:\Anupam\RY"/> is simply
D:\Anupam\RY
Double backslashes will mean double backslashes. NOW, the app processing the data might (unusually) have additional rules for backslashes, but that isn't what I'd expect.
Copy link to clipboard
Copied
that "i" is used for different purpose.
Copy link to clipboard
Copied
that "i" is used for different purpose.
Likes
Copy link to clipboard
Copied
Hi Test Screen Name,
just tested three real-world samples for the path on my Windows 10 machine using the ESTK.
<alt-title-icon path="F:\Versionen\GehezuZiel-2021_1.indd"/>
<alt-title-icon path="F:\\Versionen\\GehezuZiel-2021_1.indd"/>
<alt-title-icon path="F:/Versionen/GehezuZiel-2021_1.indd"/>
Tested the returned path with:
File( myProject.xpath("//alt-title-icon/@path") ).exists
The first one returned false, the other ones returned true.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
That would seem to be an oddity of the File method, or of xpath's "path" processing. It isn't an XML property.
Copy link to clipboard
Copied
Thanks all of you.
I used the below line to read the path and stored in my path.its working.
myPath=myProject[0].xpath("\\alt-title-icon").@path.toString();
Anupam