Skip to main content
2007ay
Known Participant
April 12, 2013
Question

Can i create a xmlDocument in Adobe ExtendScript toolkit

  • April 12, 2013
  • 1 reply
  • 723 views

hi all,

i am using Adobe extendScript toolkit to write plugin for Adobe illustrator.

and the same time i also want to convert my application object in to xml Document .

first of all i want to know whether its is possilble? if yes know how ?

as of know i used the given below code but its throwing some error "DOMParser dont not have constructor "


function createXmlDocument(string)
{
    var doc;
    if (window.DOMParser)
    {
        parser = new DOMParser();
        doc = parser.parseFromString(string, "application/xml");
    }
    else // Internet Explorer
    {
        doc = new ActiveXObject("Microsoft.XMLDOM");
        doc.async = "false";
        doc.loadXML(string);
    }
    return doc;
}

NOTE: actully i want to convert app.activeDocument in to xml documents (exc : docutmen1.xml).

thanks

Regards

Ashish.

This topic has been closed for replies.

1 reply

2007ay
2007ayAuthor
Known Participant
May 10, 2013

luckly i sloved my problem by the api given in extend java script;  the ans is :  read the file as string and use var xmlDoc = new XML(strData); it will convert ur strdata into xmlDocument exp

:var xmlString =  <body>
<div id="Layer_1" class="Layer_1">
<div id="TextFrame_1" class="TextFrame_1"> This is the text Examples </div>
</div>
</body>

try
{
var xmlDocument = new XML (xmlString);

}catch (e)
{
alert(e);
}

Regards

ashish yadav