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;

?

Tags: InDesign

Similar Questions

  • Apply the style of Pará to the xml element based on the type of master page?

    IM using a flow xml, im importing the xml to be used across different master page templates and I want to apply paragraph styles different items depending on what master page xml, they are on...

    So I have 3 put templates in place

    Type of page 1

    Type of page 2

    Type of page 3

    and 3 paragraph styles

    style 1

    style 2

    style 3

    I have the same xml structure deposited on each page...

    < Entry >

    < name > Page < / name >

    < / name >

    So, can I use javascript to apply the paragraph (style 1) style to the xml element (name) on any page that uses the master page (type of Page 1)

    Is this possible? whether and how this could be done?

    Thanks in advance

    Hello

    Try:

    #include '... / XML rules/glue code.jsx ";

    myDoc var = app.documents.item (0);

    var myRuleSet = new Array (new applyParaStyle());

    {with (MyDoc)}

    var elements = xmlElements;

    __processRuleSet (Elements.Item (0), myRuleSet);

    }

    function applyParaStyle() {}

    myIdName = "Xp".

    This.XPath = "//restaurant_name";

    This.Apply = function (myElement, myRuleProcessor) {}

    {with (MyElement)}

    {Switch(insertionPoints[0].parentTextFrames[0].) ParentPage.appliedMaster.Name)}

    case "X-Master:

    App.Select (texts);

    App.Selection [0]. FillColor = myDoc.colors.item ("xxxx");

    break;

    case 'guide-Scotland:

    App.Select (texts);

    App.Selection [0]. FillColor = myDoc.colors.item ("scotland");

    by default:

    break;

    }

    }

    Returns true;

    }

    }

  • I need the XML elements appear in the various paragraphs...  Could do with a script?

    I need of the XML elements appear in different paragraphs ...
    Pourrait to do this with a script?

    Thank you...

    You can use this / Puedes usar esto

    insertTextAsContent("\n",XMLElementPosition.beforeElement);
    //  or
    insertTextAsContent("\r", XMLElementPosition.afterElement);
    

    Necesitaria mas information,

  • How to bind the form to an XML element with a specific attrib/value?

    Is it possible to link a form in Designer to an XML element using an attribute as a criterion value?  This is a very basic construction of XPath and I can't believe that the form designer cannot do this.  For example:

    < library >

    < book lang = "fr" >
    Harry Potter < title > < /title >
    < price > 29.99 < / price >
    < / book >

    < book lang = "MS" >
    < title > Learning XML < /title >
    < price > 39.95 < / price >
    < / book >

    < / book >

    I would bind only the knot book with an attribute lang of "eng".

    [The simple xpath reference would be: bookstore/book[@lang='eng']

    Thanks for any help that anyone can provide.  I am new to LiveCycle Designer

    Jordon

    You must use the below expression in data binding, property to get the title of the book whose language is English

    .book $. (lang.value == "eng") .title

    Thank you

    Srini

  • 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

  • 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();.

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

  • 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)}
    }

  • V2.0 XML elements scroller question

    Can anyone help with resizing my Flash file please? I buy the v2.0 of Scroller XML elements and has got, it works well in CS4 Pro. However, now I'm trying to resize the stage to 100 pixels. The original file has been a scene of 300px. I resized the canvas and the background image and I moved everything in layers to the top. However, if I move "Symbol6', which is where thumbnails are anchored, my thumbnails go behind the background scroll. I don't know why because they are on a layer above the background image of scroller. I'm new to Actionscript, so I thought I would try it with this scroller XML because elements that the other thing that I downloaded did not work. Then I downloaded a much too complicated tutorial. Someone please help before going bald! Please, I beg you!

    Here's the URL:

    http://www.savie.biz/Flash/item_scroller.html

    Here's how it looked at 300 pixels height:

    screen1.jpg

    I need to integrate it into my site, so I changed the bottom of th to black and resizes to 100 pixels high and that's what I got:

    screen2.jpg

    If I try to 'Symbol 6', which contains the thumbnails, thumbnails of scrolling go behind the background image like this:

    screen3.jpg

    UH! So close to the finish, but still until now! Does anyone have an idea as to what could be the problem please? I am a single mother and I need this a.s.a.p. is to apply for a job. Any help or suggestions are greatly appreciated. Thank you in advance.

    If you select this mask object and see an instance name assigned in the properties panel, then that could lead you to find that he is handled in the code of the Framework 2.

    If you can find a line that gives this object as a mask for the thumbnail movieclip... and this comment out line... and then run RL file and can see thumbnails in their entirety... so you can be sure you will need to modify the code for this mask to move his property there.  Do not let this comment line, this is just a test.

  • 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

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

  • 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

Maybe you are looking for

  • Upgrading RAM on Satellite C850-1E7

    Hi all I'm looking into what upgrade possibilities I have for my Satellite C850-1E7 (serial: YC325575R).Looking through the manual and technical documentation, I know that I4 GB of ram memory (DDR3 1133 Mhz) and can spend up to 8 GB. Problem is that

  • MICROSOFT OUTLOOK... on pc startup

    Hello When I start my computer, windows microsoft outlook appears and I can't use it or see it... How can I clear check - in Autorun I see nothing... I would have one other than outlook as default e-mail... I can't do it on windows 7 - it was easier

  • CD/DVD drive not working do not, but are there in my computer!

    To anyone who can help... I have a Dell Inspiron 1545 with vista, less than 9 or 10 months. Now, the problem I have is that the CD/DVD drive does not work it will opening and closing and makes two short sounds and what - not more. Before this happene

  • General blackBerry Z10 sms problems

    Hello. I can't send sms messages on my Z10. I can receive it but when I want to send sms I can't always do, but it is sometimes possible and only to someone. I have manually set the advanced settings for sms, I registered my device in settings/topic/

  • SketchPad_Eclipse

    Hello I am new to the BlackBerry development and began using the demo of sketches to work using webworks and packaging this up like a .bar file and it works on the PlayBook Simulator. It worked well and now I'll have a look at the EClipse IDE with th