Go a way of XML element as a parameter of a class.

Hey all,.

I created a class to handle some audio in an app I am building.  This class will accept the path of the XML element as a parameter and or a Get accessor.

examples of some XML elements I would switch to the audio to Access Manager class.

Dialog.introScreen.text


or


Dialog.secondScreen.main.text


ect.

I pretty sure this is not a data type string and therefore cannot be passed as a string (I could be wrong but), if not, what kind of data would I spend as?

Thank you.

You can use the describeType() function to find all sorts of information about objects in as3.

Tags: Adobe Animate

Similar Questions

  • How to obtain the page to an XML element?

    Hi all

    I am fairly new to InDesign scripting (and scripts in general) and have lots of fun :-)

    I have an InDesign document containing several frames (texts, graphics, etc.) and I tagged using the InDesign tags window.

    After much struggle, I managed to get the name of the XML element tag first in my document using this simple code:

    app.activeDocument.xmlElements[0].xmlElements[0].markupTag.name
    

    I know that it worked because I got the right answer in the Javascript console. (By the way, can someone explain to me why I write xmlElements [0] twice?) And what is the difference between xmlElements and xmlItems? Any help is appreciated).

    Then I'll probably use a loop for for each markupTag of each xmlElement. But I have a lot of trouble to obtain the page associated xmlElement :-/

    After a lot of searching on Google, I came across this article which is supposed to answer my question exactly. I tried to understand this code, copy and paste in ExtendScript, but I must admit it's a bit too complex for me...

    Can someone tell me how to get a graphic or a text linked to my XML tags block? Any help is greatly appreciated!

    Nevermind, I found an easier way to achieve what I was trying to do. Actually, I wanted to be able to handle different images in my document, so why I wanted to use the XML markup.

    For those of you who have the same problem, who knows from InDesign CS5, there is an itemByName method that allows you to select an image by its name in the layers panel. So much easier to use :-)

    Thread closed!

  • How can I save the references to the elements of the xml elements page?

    Hello

    I am trying to add coordinates of the page elements to their associated as xml attributes xml elements.

    I can easily create xml help items

    myDocument.mapStylesToXMLTags ();

    Now, I want to browse the xml document and find details of each element of the associated page and then add them in the corresponding as attributes xml node.

    In other words, I'm trying a code (assuming that all the nodes as children of the root for simplicity) as follows:

    for (var i = 0; i < myRootXMLElement.xmlElements.length; i ++) {}

    var myElement = myRootXMLElement.xmlElements.item (i);

    var myElementsPageItem = * did not find a reference of function / correct documents *.

    var myBounds = myElementsPageItem.visibleBounds;

    addORupdate (myElement, "y1", myBounds [0]);

    addORupdate (myElement, ' x 1', myBounds [1] ");

    addORupdate (myElement, "y2", myBounds [2]);

    addORupdate (myElement, ' x 2', myBounds [3] ");

    }

    In my example of document all the xml that is created by mapStylesToXMLTags() are history of type.

    So I need a way to refer to the corresponding (or rectangle) page element of the history so that I can add information about contact information item xml as attributes.

    Thank you very much...

    myElement.xmlContent.parentTextFrames was not defined in the xml document that is generated by mapStylesToXMLTags()

    After some research the object model, I found my data in

    myElement.xmlContent.textContainers [0]

    Thank you

    Halin

  • that means xml, when I try to set up an analysis of the image years ago, I get the message that there are on this scan xml elements and if I save it, elments of xml will be cleared. What is

    When I bring up some old pictures on my computer, it comes like a scan, when I opened the scan he says he has xml elements, which, if I save it, the xml elements will be deleted, what are xml elements

    The normal definition of xml is the Extensible Markup Language and is the most used in the web development. There is no logical reason why scans contain xml in their breast.

    All files have an extension that is used by Windows to identify what program to use to open the file. Word uses .doc or .docx format, Excel .xls or .xlsx, Adobe uses .pdf etc.

    Right-click on one of the files and select Properties, in the general tab, it displays the type of file and its extension.

    You are referring to 'initials pvt' but pvt isn't a common file extension and is used by a couple of applications, but have nothing to do with analysis or graphics.

    Up to what you did what in fact do a copy files (copy the directory as a whole) and let the originals intact.

    Although Word works with graphics files which is not normally the native program to use, can you explain the steps that you use to open the files.

  • Create the XML element for the cell in the chart CC2015

    Hello world

    I am currently working with the xml element.

    And I want to create xml, table cell element.

    For now, I can create xml for the graphic cell by select graphic image of that cell, and then call the AutoTag() function.

    But I want to create an xml element of a chart without selected cell.

    I found the function () Utils < IXMLElementCommands >-> CreateElement()

    but it doesn't seem to work with a graphic table cell structure.

    Does anyone know how to do?

    Thanks in advance.

    Try,

    InterfacePtr cellContent (tableModel-> QueryCellContentBoss (gridAddress));

    if(cellContent == Nil) {}

    break;

    }

    InterfacePtr cellXMLReferenceData (cellContent, UseDefaultIID());

    {if(!cellXMLReferenceData)}

    break;

    }

    XMLReference cellXMLRef is cellXMLReferenceData-> GetReference();.

  • How to pass the content of an xml element in the text frame in inDesign Script

    var XMLFile = File.openDialog ("select XML Files... ») ;

    var doc = app.activeDocument;

    If (!) App.Documents.Length)

    {alert ("ERROR: Document not opened");}

    return;

    }

    doc.importXML (XMLFile);

    var firstFigureNode = doc.xmlElements [0] .xmlElements [1] .xmlElements [0];

    var lableNode = firstFigureNode.xmlElements [0];

    var lableNodeText = lableNode.contents;

    myFrame var = doc.textFrames.add ({geometricBounds: [-13, 13, 3, -3]});

    lableNodeText.move (LocationOptions.AFTER, myFrame.texts [0]);

    ========================================================

    My requirement is: == > > move the content of an xml element in the text by inDesign Script block, but XML InDesign file Structure should not be change & data in the XML Structure should remain as it was before...

    I tried to code above, but it does not work...

    Please can someone help me in solving this problem...

    It does not work correctly...

    It moves firstFigureNode in myFrame...

    firstFigureNode.placeXML (myFrame);

    ===>> For Apple Script try below Code ===>>

    myFrame markup using firstFigureNode

  • How to add content in the xml element?

    I need to insert a word sqrt (plain text without tags) in the xml element of m:msqrt as below:

    enter image description here

    I tried,

         

    var path = (app.activeDocument.fullName.parent.fsName) m:System.NET.SocketAddress.ToString () replace (/ \ / g, ' /'); document path (sample.indd) active

    var xmlPath = (app.activeDocument.fullName.parent.fsName) m:System.NET.SocketAddress.ToString (.replace(/\\/g, '/')) + "" / with_aid2.xml ";"

    xmlFile = file (xmlPath);

    {if (xmlFile.Exists)}

    xmlFile.open ();

    var myString = xmlFile.read ();

    xmlFile.close ();

    myXml = new XML ();

    myXml = XML (myString);

    var msqrtCount = myXml.xpath("//m:msqrt");

    } else {alert (xmlPath + "does not exist!") ;}}

    for (var i = 0; i < msqrtCount.length (); i ++) {}

    var added = msqrtCount [i];

    added.contents = "sqrt";

    }

    I get an error indicates the invalid content property.

    Try this,

    var myDoc = app.activeDocument;
    mySqrtTag(myDoc)
    function mySqrtTag(elm)
    {
        for (var i = 0; i < elm.xmlElements.length; i++)
        {
            if(elm.xmlElements[i].markupTag.name.toString() == "m:msqrt")
            {
                elm.xmlElements[i].insertionPoints[0].contents = "sqrt";
            }
            mySqrtTag(elm.xmlElements[i]);
        }
    }
    
  • XML: Management Styles with yields within XML elements

    Hello

    I get XML source, which may contain flashbacks (\r) within an XML element representing the various paragraphs, for example:

    < bodytext > This is the text of the first paragraph.

    And the following paragraph.

    And so on... < / bodytext >

    It is easy to apply a style to the whole paragraph < bodytext > XML scripting rules. But what PARAGRAPH < bodytext > should have a different paragraph style, which applies to a drop cap: How can I do this?

    Thanks in advance

    Tobias

    Why don't reach you the paragraph of xmlElement object and apply the style?

    myXMLElement.paragraphs [0] .appliedParagraphStyle = myParaStyle;

    ?

  • XML: contents.replace () destroyed XML elements inside

    Hello

    I wrote a script XML rule where all the < ul > < li > is mapped to a paragraph style that uses bulleted lists. It is possible that returns occur inside the < li > elements. Before you go through the items and by applying styles with a script rule, I tried to change the return (\r) of returns (\n) cycling through all the < li > with this code:

    _node.contents = _node.contents.replace(/\r/g, '\n');  //change all returns inside <usp><li> to newline
    

    But I realized that, when there are other XML elements (for example < em > or < strong >) inside the < li >, these elements have been killed by my call of. replace().

    So my question: How can I reach evolution \r's to \n's and keep inside XML structure?

    Thanks in advance

    Tobias

    I did it with this chiseled script - function grep with emphasis on the XML element - executed after that all XML was processed and placed in the document:

      // change \r to \n in usp's li's
      app.findGrepPreferences = NothingEnum.NOTHING; app.changeGrepPreferences = NothingEnum.NOTHING;
      var _root = _dok.xmlElements[0];
      var _nodeList = _root.evaluateXPathExpression("//li");
      app.findGrepPreferences.findWhat = "\\r"; app.changeGrepPreferences.changeTo = "\\n";
        for ( i = 0; i < _nodeList.length; i++ ) {
            var _node = _nodeList[i];
            if ( _node.contents != "" ) {
                _node.changeGrep();
            }
        }
      app.findGrepPreferences = NothingEnum.NOTHING; app.changeGrepPreferences = NothingEnum.NOTHING;
    

    It works perfectly. Any other suggestions?

    Thank you

    Tobias

  • I'm new in indesign scripting, please tell me how to write a script to get the contents of an XML element and then sort all the content

    I'm new in indesign scripting, please tell me how to write a script to get the contents of an XML element and then sort all the content

    Hello

    Can the code below is useful for you, but I do not know how to sort.

    Change the tag based on your employment application.

  • How to separate the content of the XML element

    Hi all

    How can we separate content of the XML element in two strings, where each string will be copied to new variables.

    For ex:
    The entry that I get is

    C:/documents/sharedFiles/Apple.PDF < XmLElement > < / XMLElement >

    now I want to break the content into two parts as

    < yyyy > C:/documents/sharedFiles / < / aaaaa >
    Apple.PDF < bath > < / bath > (I want to separate the file name string)

    and now I want to copy it in two other variables. How can I achieve this in BPEL. Appreciate your help.

    Thank you

    Published by: kameshb on March 25, 2013 11:16

    Hi Philippe,.

    I tried this on a simple XSL and achieve the desired results:

    Entry:
    ------------

    C:/test/dummy/post/test.PDF










    It will be useful.

    Thank you
    Deepak.

  • Check for the existing XML element

    Hi all

    I'm writing a simple script first check if an XML element exists and creating so if it's not. I tried to change a piece of code that I used previously to do the same for paragraph styles, but apparently it's not that simple. Currently, all I get is the error "Unable to run the script in the 'main' target engine!" Without checking them, adding the XML element based on the result of the search works very well.

    /* Find all instances of the word "Superscript" */
    app.findTextPreferences.findWhat = "Superscript";
    var mySuperscript = myDocument.findText(); // Save search result for future reference
    
    /* See if an XML element named "Superscript" already exists, and create it if that's not the case; then add it to all instances of the word "Superscript" */
    var myXMLElementSuper = myDocument.xmlElements.item("Superscript");
    try {
    var myName = myXMLElementSuper.name;
    }
    catch (myError){
        var myXMLElementSuper = myDocument.xmlElements.add({markupTag:"Superscript", xmlContent:mySuperscript[i]});}
    

    Any help would be greatly appreciated!

    Regards and thanks in advance.

    Julian

    The myDocument.xmlElements always has a single element - the root element.

    If you want your element directly below that, you have to work a level down.

    To try-catch for such situations regular aid is bad because you spend so usually the ESTK option stop on exceptions and real problems don't miss. Use the isValid property.

    var rootXE = myDocument.xmlElements.item(0);
    var superXE = rootXE.xmlElements.itemByName("Superscript");
    if( !superXE.isValid )
      superXE = rootXE.xmlElements.add(...
    else
     superXE = superXE.getElements()[0]; // take first of potentially multiple elements
    
  • Can a Xquery return a concatenated string and an XML element

    Hello

    My Xquery fucntion is illustrated below:

    It accepts parameters of Channel 4 and a XML element i.e., $Message which is a component of XML (application to come to the service) and I need to connect all this information in a log file.

    I use the below fucntion concat to get a concatenated string of all parameters, but for $Message I m not able to get the XML load. How to achieve the same in the XQuery?

    *$Message is the below XML file:*

    payload of <>
    < aa > a < /aa >
    < bb > two < /bb >
    < cc > 3 < /cc >
    < / payload >

    My Xquery function is:

    declare function xf:XformLog($Name_as_xs:string,)
    $id as XS: String.
    $Context as XS: String.
    $Annotation as XS: String.
    $Message as element (*))
    as XS: String {}
    Concat ("name = ', $Name, ','," Id = ", $id,", ","Message = ", $Context,","context", Annotation = ", $Annotation,","," event Message = ', data ($Message/@*, $Message / node ()) "" "")
    };


    I am trying to achieve the following log:

    Name = xyz, Id = 111, Message Contact is abc, Annotation = ggg, the event Message = < payload >
    < aa > a < /aa >
    < bb > two < /bb >
    < cc > 3 < /cc >
    < / payload >


    How can I achieve the same. Please suggest.

    Thanks in advance.

    Published by: user9223904 on March 18, 2013 03:16

    Hello

    You must use a serialization function to convert a string of the instance of the element.
    This type of functionality is not included in the XQuery standard, but many directors provide an extension to do this.

    For example, in OSB, you can use fn - bea: serialize().

    What is your environment and XQuery engine?

  • MN jobs XML elements

    Hi all

    I need to get out the marginal following tags in XML jobs.

    I hope that the problem is in line 18 coding.

    Screenshot:

    Screen Shot 2014-07-17 at 11.14.24 AM.png

    The coding is below:

    var myDoc = app.activeDocument;  
    
    var myLib = app.libraries[0];
    
    var myXMLElement = app.activeDocument.xmlElements[0].evaluateXPathExpression("//marginalnote");
    
    alert(myXMLElement.length);
    
    for(i=myXMLElement.length-1; i>0; i--)
    
    {
            var myText = myXMLElement[i].texts[0];
            
            alert(myText.contents)
            
            var myLibraryAsset = app.libraries[0].assets.item("box").placeAsset(myXMLElement[i].insertionPoints[-1])[0];
            
            var myTextMove = myXMLElement[i].texts[0].move(LocationOptions.AT_END, myLibraryAsset.insertionPoints[0])           //Problem in this only
            
             myLibraryAsset.appliedObjectStyle = myDoc.objectStyles.item("Box")
    
            myLibraryAsset.fit(FitOptions.frameToContent)
    
        }
    
    
    
    
    
    
    
    
    

    Thanks in advance

    Siraj

    As I read in your source, without attempting to reproduce the environment:

    When you place your library assets, the result (a places 'box' page element, not a library asset more) is found in the xml element. According to means grounded in the text of content via a special character. That the special character is your problem, because it is found in your text [0]. So the error message means that you can't move that character to anchor in the anchor block.

    To resolve this problem, place the assets in the library outside of the xml element. I had also tag the frame rather than leaving the empty tag in the text. There is a nice method by combining these operations call.

    You can further optimize if you place the 'box' that only once, for example on a unused master page, then use the second parameter of placeIntoInlineCopy() to produce copies. I think it's a bug that after my 'fake' I still remove TF1.

    var x = app.activeDocument.xmlElements.item(0).evaluateXPathExpression("//P") [0];

    var box = app.libraries [0].assets.item ('box');

    TF1 = box.placeAsset (xe.storyOffset) var [0];

    TF2 var = xe.placeIntoInlineCopy (tf1, false);

    TF1. Remove();

  • How to find the page number of an xml element

    Hi everyone, sorry for my very bad English (french guy! logic). I hope you see what I'm looking for.

    I'm script (javascript), of each articles export a script from a script multiple indesign pages.

    In fact, I might have one or more article in a single file, each of which is a separate xml element. for each, I export an xml file named with, first, page where appears the xml element, the second number, the number of exported article.

    I am the second goal of success, but not the first.

    Someone has an idea?

    Hi kazegonzo,

    Please try the js code below, I have access to the doc/article/the title tag because the doc not placed in pages, you placed the title tags to access the title tag and get the page number.

    var myDoc=app.activeDocument;
    var root = myDoc.xmlElements[0];
    var docTag = root.evaluateXPathExpression('//doc//article//titre');
    for(i=0; i
    

    THX,

    csm_phil

    Post edited by: csm_phil

Maybe you are looking for