• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

DOM Parser not working in IDJS script

Explorer ,
Aug 02, 2023 Aug 02, 2023

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

 

TOPICS
UXP Scripting

Views

691

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 02, 2023 Aug 02, 2023

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 02, 2023 Aug 02, 2023

Copy link to clipboard

Copied

The following link talks about using nodejs packages with UXP

https://adobexdplatform.com/plugin-docs/reference/javascript/javascript-support.html#can-i-use-npm-p...

Could be possible, but you will have to test it

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 03, 2023 Aug 03, 2023

Copy link to clipboard

Copied

Dear Mannan,

 

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 03, 2023 Aug 03, 2023

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 05, 2023 Aug 05, 2023

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 03, 2023 Aug 03, 2023

Copy link to clipboard

Copied

Dear Mannan,

 

Thank you, we will check ....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines