Skip to main content
Known Participant
Aug 2, 2023 7:48 AM UTC
Question

DOM Parser not working in IDJS script

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.,

 

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

Community Expert
Aug 3, 2023 5:47 AM UTC

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

Translate
-Manan
Community Expert
Aug 3, 2023 5:51 AM UTC

The following link talks about using nodejs packages with UXP

https://adobexdplatform.com/plugin-docs/reference/javascript/javascript-support.html#can-i-use-npm-packages-or-nodejs-apis

Could be possible, but you will have to test it

-Manan

Translate
-Manan
Known Participant
Aug 3, 2023 2:26 PM UTC

Dear Mannan,

 

Really this is helpful for me and thank you for your Kind support.

Translate