Get all XML elements

Hi guys,.

I need to get all of the XML elements in the InDesign using JS documents (InDesign 5.0.4 - windows), the code below, it shows only the first node.

for (var i = 0; i < app.activeDocument.xmlElements.length; i ++)
{

Alert (App.activeDocument.xmlElements.markupTag.Name);
}

Help me to anybodies,

Nanan

Hi Julie

Try this

aDoc var = app.activeDocument;

getTags (aDoc)

function getTags (ele)
{
If (!) ELE.xmlElements.Length) {return ;}
for (var i = 0; i)<>
{
       
xrefId = ele.xmlElements [i].markupTag.name;
$.writeln (xrefId);
           
       
       
getTags (ele.xmlElements [i]);
}
}

Tags: InDesign

Similar Questions

  • Get all the elements of a spread

    Hi all

    How to get all the elements (images, etc.) of the current spread?

    I know we can get the items on a page by < ISpread > GetItemsOnPage(), but how to get ALL the items (including who are located outside of the page but on the spread)

    Thank you

    Hello Shawn,

    You can browse all the pages on the spread and call GetItemsOnPage with the parameter bIncludePasteboard = kTrue.

    Markus

  • How to get several xml elements in a relationship 1: n without using xmlaggregation

    I need to create the following xml structure from an oracle database

    where each survey can multiple deelnemers (participants)

    I'm not sure create this use of XMLElement without getting the message "ORA-01427 subquery returns more then one line."

    I could try to use dbms_xmldom (never done that before) but I wonder if anyone knows how to generate this just using the plain Oracle SQL-XMLfunctions (XMLElement, XMLAggr)

    < NieuweSurveys >

    < survey >

    < Surveynaam > 2013 - 02 - 01 < / Surveynaam >

    < Months > 2013 - 02 - 01 < / months >

    < Einddatum > 2013 - 02 - 15 < / Einddatum >

    < Deelnemer >

    Tilde < Chairwoman > < / Chairwoman >

    < Tussenvoegsel / >

    DeelnemerA < Achternaam > < / Achternaam >

    man < Geslacht > < / Geslacht >

    < Emailadres > [email protected] < / Emailadres >

    < Voorkeurstaal > nl < / Voorkeurstaal >

    Schouten < account > & Nelisen < / account >

    bouwer < function > < / function >

    < / Deelnemer >

    < Deelnemer >

    Tilde < Chairwoman > < / Chairwoman >

    < Tussenvoegsel / >

    DeelnemerB < Achternaam > < / Achternaam >

    Vrouw < Geslacht > < / Geslacht >

    < Emailadres > [email protected] < / Emailadres >

    < Voorkeurstaal > nl < / Voorkeurstaal >

    Schouten < account > & Nelisen < / account >

    Tester of < function > < / function >

    < / Deelnemer >

    < / inquiry >

    < / NieuweSurveys >

    What is your version of the database? (SELECT * FROM version$ v)

    The query does not match the output that you claim that it produces.

    In any case, the problem is the following:

    ) as "deelnemers.

    Put an alias here should not generate an element - unless you are using XMLForest in your actual query without your telling us.

    That's why I ask about the version of db, it could be an old bug that's been fixed now (I have not to reproduce the behavior on 11.2).

    What happens when you delete the alias?

  • How to get all the elements form Jdev10.1.3.4

    Hello
    I have a form on his land is not bound to VO. Pagedef empty.
    each element has the id and binding.
    <af:inputText label="#{r['questionnaire.surname']}"
                                  required="true" id="surname"
                                  binding="#{QuestionnaireBean.surname}"
                                  />
    I want to get an array of elements.

    for a list of links
             BindingContainer bindings = getBindings ();
             bindings.getAttributeBindings ();
    null (())

    As you request your empty pagedef, which is what you do with

    BindingContainer bindings = getBindings ();
    bindings.getAttributeBindings ();
    

    It returns null. It is the expected behavior.
    You have to walk the tree of components for all components check each of this type and get the information from the component itself. You can use something like

    // reset all the child uicomponents
    private void getAllUIItems(AdfFacesContext adfFacesContext,
                                     UIComponent component){
       List items = component.getChildren();
       for ( UIComponent item : items ) {
    
           getAllUIItems(adfFacesContext,item);
    
           if ( item instanceof RichInputText  ) {
               RichInputText input = (RichInputText)item;
               //do your work here e.g. store id in an array
               };
           } else if ( item instanceof RichInputDate ) {
               RichInputDate input = (RichInputDate)item;
               //do your work here e.g. store id in an array
               };
           }
       }
    }
    

    You may need to change the signature of the method to return the array of ID...

    Timo

  • I need to find all of the XML elements and add a line break for the text of each of them

    I need to find all XML elements and to add a line break the text of each of them.

    Is it possible with a script?

    Try this piece of code as it is. I hope that's what you want...

    var myDoc = app.activeDocument;
    var inddRooElement = myDoc.xmlElements.item(0);
    var xPathElements = inddRooElement.evaluateXPathExpression("//*");
    var elementCount = xPathElements.length;
    for(var eId=0; eId
    

    ----------------

    Green4ever

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

  • Get the xml comment previous xml element in the document

    Hello

    I need to get the previous indesign document xml comment element.  My selection is an xml comment. I need to select the previous item (author) xml (basic book) comments.  How can I get this xml elemant?

    Screen shot 2015-08-27 at 11.05.44 AM.png

    Thanks in advance,

    Sudha K

    Yes, all THE namespaces must be declared. And especially in the loop, the problem is that evaluateXPathExpression does not' see 'declatration of the namespace of the parent tags.

    Workaround: temporary namespace statement

    _tempNSDeclaration = _comments[i].parent.xmlAttributes.add( "xmlns:cl", "http://www.namespace.xyz" );
    _precTags = _comments[i].parent.evaluateXPathExpression("child::comment()/preceding-sibling::*[position() = 1]");
    _tempNSDeclaration.remove();
    

    Or course _comments [i].parent.xmlElements

    Moreover, it is easier to help you if you provide a test with the whole of the structure file.

    Roland

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

  • My 10 photoshop element stop working, I'm not able to open it more.  ?  I posted this question a few days ago and I did not get all yer anwer, please help

    My 10 photoshop element stop working, I'm not able to open it more.  ?  I posted this question a few days ago and I did not get all yer anwer, please help

    I have photoshop editor item 10 and organizer first and I have a Macbook pro 10,9,9

    When I try to open an image with the Publisher of the item or if I try to open the PS Editor directly I see this

    file:///users/main/desktop/screen%20Shot%202014-11-26%20at%201.17.35%20PM.PNG

    When I click on edit it does not open and I have this window

    file:///users/main/desktop/screen%20Shot%202014-11-26%20at%201.21.07%20PM.PNG

    and if I click on REOPEN, I still got the same message

    Lucie

  • Loop through all of the xml elements

    How do I loop over all xml tagged in a story? I created a reference to the xml elements of the story I want to like this:

    var xmlStory = myDoc.xmlElements[0].xmlElements[0];
    

    In this structure, I have items < v > 10 / < v >, which I want to change of < id v '10' = > 10 / < v >. I want to do in the InDesign scripting and not with XSL export because of workflow, I plan. I know I can loop on children in the structure like this:

    for(var i=0;i<xmlStory.xmlElements.length;i++){
                        if(xmlStory.xmlElements[i].markupTag.name == "v"){
                                  xmlStory.xmlElements[i].xmlAttributes.add("id", xmlStory.xmlElements[i].contents);
                       }
             }
    

    This works very well for the first level, but I want to find all elements with the tag '< v >. These tags can appear at any level in the structure. How can I make sure that all of them are included and not just the first elements of the child of the element of the story?

    Try this,

    #target inDesign;

    var doc = app.activeDocument;
    xmlTag var = doc.xmlElements [0];
    var vTag = xmlTag.evaluateXPathExpression("//v")
    for (var i = 0; i)<>
    {
    Try
    {
    vTag [i].xmlAttributes.add ("id", vTag [i].xmlContent.contents)
    }
    {catch (e)}
    }

  • Get all the text values in a XML node

    Suppose I have a XMLList that I'm working my way through and I want to quickly and easily get all the 'text' from the node. In other work strip the < xmtag > all possible markup and attributes and just leave the content.

    There is a simple/fast way to do it?

    < myNode >

    < title > title an event here < /title >

    < host > name and title of the presenter here < / presenter >

    < date startTime = "Somedate" / >

    < desc > <! [CDATA [text here. [[It < b > would < /b > have html or links or something like.]] > < / desc >

    < resources >

    list of < resources > has some resources, downloads, etc. < / res >

    < resources > another site or something like < / res >

    < / resource >

    < / myNode >

    If the xml is your XML instance, after loading is finished:

    trace (XML.descedants("*"). Text());

  • Add the ID of the XML element to all elements as an attribute

    Hello

    The title says I hope that what I like to do. I have quite some documents that are marked, but add an id to all the elements of better handling external XML in Indesign. I've been looking around a bit but seems not forever be disturbed by many people...

    So, how can I iterate through all my items in XML and adds the ID of the element as an attribute?

    Thank you

    Koen

    Hi Koen,

    Please try the JS code below. This code its InDesign CS5.5 work.

    var myDoc = app.activeDocument;
    try{
        var rootElement = myDoc.xmlElements.item(0);
        var linkElementList = rootElement.evaluateXPathExpression("//para");
        for(i=linkElementList.length-1; i>=0; i--){
            var myAttribute = linkElementList[i];
            myAttribute.xmlAttributes.add("idname", "idvalue");
            }
        }catch(e){}
    

    THX,

    csm_phil

  • CS4: Get all the UIDS of pages containing a page element

    Hello

    How can I get all the UIDS of page, which contains a page with a specified UID element?

    For example: I have two UIDS of pages if a page item is placed on two pages.

    Thank you

    Hans

    Jongware probably confuses the problem with page elements spread master.

    I think you talk page possibly items on several pages in a spread.

    ILayoutUtils::GetOwnerPageUID is a good start.

    If you want more details, browse the pages of your broadcast and match covering them for the bounding box of the element on the page.

    Dirk

  • 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
    

Maybe you are looking for

  • Mobile phone for Tecra A4 photo transfer

    is anyone know how you can get the photo taken with a cell phone nokia6070 in a computer laptop tecra A4? It is supposed to work with infrared technology, even if I can't find the infrared receiver on the laptop (when it exist?). Thank you very much!

  • Update Froyo for the Milestone in Russia

    Motorola plans to upgrade in Russia Milestone phones to Android 2.2 (Froyo). If yes then when it should?

  • Display problem iMac late 2009

    Anyone know what happened to my screen? Its a model of iMac 27 "late 2009 running 10.11.1 It happened all of a sudden while I was surfing on the internet - sometimes it goes back to normal, but most of the time she stays like that... 2.66 GHz IntelCo

  • HP Envy to current continuous?

    Hello I have a desktop HP ENVY 700xt product number: E9G99AV #ABA. It is great and does everything that I need to. I have it running in an environment where the power source is at best unreliable. Purchase and installation of a battery backup are not

  • How to fix "Startup Repair cannot repair this computer automatically.

    My computer not boot not correctly. I just get a blue page with an error message that says "Startup Repair cannot repair this computer automatically." How can I fix?The following problems: Problem event name: StartupRepairV2Signature of the problem 0