Copy link to clipboard
Copied
Hi All,
I'm developing the UXP scripts for InDesign. While reading the HTML file, we use a DOM Parser to read the HTML file.
our UXP is not supporting to read the DOM parser. Kindly any one resolve this and will appreciate.
//======================================
const file = await ufs.getFileForOpening({mode: uxpfs.modes.readWrite, type: "file"});
const text = await file.read({format: formats.utf8});
if (window.DOMParser) {
const parser = new DOMParser();
var manifest = parser.parseFromString(text, "text/xml");
}
//==================================
Thanks & Regards,
Harihara Sudhan T R.,
Copy link to clipboard
Copied
Seems DOMParser is not available to UXP. Untill this is implemented by Adobe I suppose you will have to rely on alternate means. I am not sure if we can use node packages with UXP, if we can then you can look at https://www.npmjs.com/package/dom-parser
-Manan
Copy link to clipboard
Copied
The following link talks about using nodejs packages with UXP
Could be possible, but you will have to test it
-Manan
Copy link to clipboard
Copied
Dear Mannan,
Really this is helpful for me and thank you for your Kind support.
Copy link to clipboard
Copied
That's the old documentation page for XD, the newer page is here: https://developer.adobe.com/xd/uxp/develop/plugin-development/javascript-and-xd/javascript-support/
That said, have you tried this with InDesign 18.5? It just came out in prerelease and has many more UXP features...
Copy link to clipboard
Copied
Thanks for the update URL @erinferinferinf. I see the new article also has the same advice on the topic so @Harihara28692478zxj6 please do try it and let us know how it goes.
-Manan
Copy link to clipboard
Copied
Dear Mannan,
Thank you, we will check ....