The location of the XML element - predicate

Hello

I'm trying to bind a text field to the Designer 8.1 to a specific XML element.

An example of XML structure:

< KeyValueGroup >

< ID >

Name1 < name > < / name >

Value1 < value > < / value >

< /ID >]

< ID >

name2 < name > < / name >

value2 < value > < / value >

< /ID >

< ID >

< name > Name3 < / name >

Value3 < value > < / value >

< /ID >

< / KeyValueGroup >

I tried to link using $record. KeyValueGroup.ID [Name = "Name2"]. Value to return the value of the property name2, but the designer rejects this expression.

Anyone would be able to advise where I'm wrong?

I understand that I could achieve this by using a Javascript function that lists the table ID, but would prefer a solution not involving not JavaScript if possible.

Any help appreciated,

Matt

Hi Matt,

The $record refers to the current subtree of the DOM data, so in your case $data. KeyValueGroup and $record are the same thing.

You also need a "." before the predicate.

In any case, try $record.ID. [name == "Name2"]. Value

Good luck

Bruce

Tags: Adobe LiveCycle

Similar Questions

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

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

  • 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 the XML element used in RTF PUBLIC/PRIVATE? I know how to hide columns in RTF, but do not know how to generate xml below way. Help, please.

    Hello

    I'm following link below to show/hide my columns dynamically. See "formatting of column.

    http://docs.Oracle.com/CD/E12844_01/doc/BIP.1013/e12187.PDF

    According to the doc element can be made in private/public.

    <items type="PUBLIC">
     <item>
      <name>Plasma TV</name>
      <quantity>10</quantity>
      <price>4000</price>
     </item>
     <item>
    

    And even can be used to hide the column with the help of State

    <?if@column:/items/@type="PUBLIC"?>
    

    MY QUESTION IS HOW TO DO THIS IN MY XML BELOW?

    Here's the part of my XML code that I use in the definition of the data to RTF.

    <group name="GH3" source="QH3">
    <element name="COLUMN_HEAD3" value="COLUMN_NAME" /> 
    </group>
    <group name="GH4" source="QH4">
    <element name="COLUMN_HEAD4" value="COLUMN_NAME" /> 
    </group>
    

    I'm out like that.

    <LIST_GH3>
    <GH3>
    <COLUMN_HEAD3>REBILL_TO_OTHER_BUSINESS_UNIT</COLUMN_HEAD3>
    </GH3>
    </LIST_GH3>
    <LIST_GH4>
    <GH4>
    <COLUMN_HEAD4>XYZ</COLUMN_HEAD4>
    </GH4>
    </LIST_GH4>
    

    In order to use the logic according to the oracle document I want output like this.

    <LIST_GH3 type="PUBLIC">
    <GH3>
    <COLUMN_HEAD3>REBILL_TO_OTHER_BUSINESS_UNIT</COLUMN_HEAD3>
    </GH3>
    </LIST_GH3>
    <LIST_GH4 type="PRIVATE">
    <GH4>
    <COLUMN_HEAD4>BLANK</COLUMN_HEAD4>
    </GH4>
    </LIST_GH4>
    

    Should what changes I make in my XML to get the result of the execution as above? Help, please. Where should I make changes in the XML above? Name of the Group? Name of the element?

    I intend to use it under condition in RTF model to hide the column, but do not know how to set the column as PRIVATE/PUBLIC type in the XML output that is used to populate the data in the RTF while running.

    <?if@column:/BTSPIEXP/LIST_GH3/@type=”PUBLIC”?>COLUMN_HEAD3<?end if?>
    

    Kind regards

    Patricia K.

    Hello

    Problem has been resolved. I used the value of the item to determine whether to show it.

    Kind regards

    Patricia K.

  • 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

  • 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

  • Extract the XML element in Oracle

    Hi all

    I am trying to extract a value from the XML. But I'm not able to do.

    I gave below the XML and the request which I use to recover data.

    Please help me in this regard.

    query:
    --------

    SELECT A.ixml.EXTRACT ('/ / ns1:clm / ns1:provBill [@T = "85"] [@T = "EI"] /id / text () "," xmlns:ns1 = "http://xyz.com/ac/xsd/LoanV2.0.3" "") .getstringval
    value_str)
    LOAN one
    WHERE a.Loan_reference_id = 286;


    SELECT A.ixml.EXTRACT ('/ ns0:LoanWrapperRequest / ns0:LoanRequest/CXmlPayload/ns1:clm / provBill [@T = "85"] [@T = "EI"] /id / text () "," xmlns:ns0 = "http://xyz.com/ac/activator/schema/LoanWrapper" xmlns:ns1 = "http://xyz.com/ac/xsd/LoanV2.0.3" "") .getstringval
    value_str)
    LOAN one
    WHERE a.Loan_reference_id = 286;

    XML:
    -----
    < ns0:LoanWrapperRequest xmlns:ns0 = "http://xyz.com/ac/activator/schema/LoanWrapper" >
    < ns0:LoanRequest xmlns:msgns = "http://xyz.com/wsdl/ActivatorBpel/TrigActivatorQue" xmlns:ns1 = "http://xyz.com/wsdl/PersistLoanLogs/persistLoanLog" >
    < RequestHeader mlns = "http://xyz.com/ac/activator/schema/LoanWrapper" >
    < SourceSystem > OKC < / SourceSystem >
    < ServiceWorkflow >
    < ServiceInfo >
    < ServiceName > ACActivator < / ServiceName >
    < / ServiceInfo >
    < / ServiceWorkflow >
    < / RequestHeader >
    < cXmlPayload xmlns = "http://xyz.com/ac/activator/schema/LoanWrapper" >
    < ns1:clm xmlns:ns1 = "http://xyz.com/ac/xsd/LoanV2.0.3" >
    < hdr xmlns = "http://xyz.com/ac/xsd/LoanV2.0.3" >
    eTest1126saggy < corn > < / corn >
    < idSend > 123456789 < / idSend >
    < nmSend T '41' = > ABC SUBMITTER < / nmSend >
    < contact >
    < n > JOHN SMITH < /nm >
    < T comm = "TE" > 5555551234 < / comm >
    < / contact >
    < dtSend > 090831 < / dtSend >
    < tmSend > 1440 < / tmSend >
    < indAck > 1 < / indAck >
    < indTest > P < / indTest >
    < worm > 00501 < / worm >
    < numIsa > 999999999 < / numIsa >
    < numGs > 1 < / numGs >
    < > 0001 numTs < / numTs >
    <!-< IdBht > 20090831 < / IdBht >->
    < cdClmType > CH < / cdClmType >
    < / hdr >
    < provBill T = "85" xmlns = "http://xyz.com/ac/xsd/LoanV2.0.3" >
    < cdTaxon T 'BI' = > 207Q00000X < / cdTaxon >
    < name >
    ABC Group Practice < nmOrg > < / nmOrg >
    < / name >
    < id P = "P" T = "XX" > 145 / < ID > "
    < id T = 'EI' > 234 / < ID >
    < id T = "24" > 234 / < ID >
    < addr >
    LN of billing address 123 < addr1 > < / addr1 >
    < City > Nashville < / City >
    < cdState > TN < / cdState >
    < cdPostal > 37214 < / cdPostal >
    < / addr >
    < contact >
    < n > JOHN SMITH < /nm >
    < T comm = "TE" > 5555551234 < / comm >
    < comm T = 'EX' > 123 < / comm >
    < / contact >
    < cdCurr T '85' = > CAD < / cdCurr >
    < / provBill >
    < / ns1:clm > < / CXmlPayload > < / ns0:LoanRequest > < / ns0:LoanWrapperRequest >



    best regards
    Swami

    Once again, with the full qualified path, which is preferable from the point of view of optimization, careful inspection of the nodes parents led to the conclusoon they are also in the same namespace, so the following works

     62  select VALUE_STR
     63    from LOAN A,
     64         XMLTABLE
     65         (
     66           xmlnamespaces
     67           (
     68             'http://xyz.com/ac/activator/schema/LoanWrapper' as "ns0",
     69             'http://xyz.com/ac/xsd/LoanV2.0.3' as "ns1"
     70           ),
     71           '/ns0:LoanWrapperRequest/ns0:LoanRequest/ns0:CXmlPayload/ns1:clm/ns1:provBill[@T="85"]'
     72           passing IXML
     73           columns
     74           VALUE_STR varchar2(32) path 'ns1:id[@T="EI"]/text()'
     75         )
     76  /
    
    VALUE_STR
    --------------------------------
    234
    
    SQL>
    
  • 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

  • Table of attributes in the XML element and the element values. Is this possible?

    I use BI Publisher generator model for Word. I'm using Word 2007 and the patch 9821068 generator model.

    I'm trying to create a table using the table Wizard. The values in the column must be based on the attributes of the element and the element values. I have no control over the incoming data.

    Given the following XML:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < valuesOverTime type = "fromServer" >
    < name aValue = "xyz" date = "2010-07-21" time = "" 15: 55:26 ' > 2 < / aValue > "
    < name aValue = 'abc' date = "2010-07-21" time = "" 15: 55:26 ' > 0 < / aValue > "
    < name aValue = "xyz" date = "2010-07-21" time = "" 15: 55:26 "> 42 < / aValue >"
    < name aValue = 'abc' date = "2010-07-21" time = "" 15: 55:26 "> 100 < / aValue >"
    < name aValue = "xyz" date = "2010-07-21" time = "" 15: 55:26 "> 17 < / aValue >"
    < name aValue = 'abc' date = "2010-07-21" time = "" 15: 55:26 ' > 0 < / aValue > "
    < name aValue = "xyz" date = "2010-07-21" time = "" 15: 55:26 "> 1 < / aValue >"
    < / valuesOverTime >

    Table I need should look like this:

    name date time aValue
    XYZ-2010-07-21 15:55:26 2
    ABC-2010-07-21 15:55:26 0
    XYZ-2010-07-21 15:55:26 42

    So far, that I can understand it.

    Any suggestions?

    Thank you
    -Matt
    
      
    
    
  • Apply a paragraph style for the XML elements that have a specific attribute

    (1) I am an almost complete noob when it comes to XML

    (2) I have a XML with a ssstructure like this:

    <chapter>
         <paragraph> bla bla </paragraph>
         <paragraph> bla bla </paragraph>
         <list type="disk">
              <listitem>
                   <paragraph> bla bla </paragraph>
                   <paragraph> bla bla </paragraph>
              </listitem>
              <listitem>
                   <paragraph> bla bla </paragraph>
                   <paragraph> bla bla </paragraph>
              </listitem>
              <listitem>
                   <paragraph> bla bla </paragraph>
                   <paragraph> bla bla </paragraph>
              </listitem>
         </list>
    
         <list type="square">
              <listitem>
                   <paragraph> bla bla </paragraph>
                   <paragraph> bla bla </paragraph>
              </listitem>
              <listitem>
                   <paragraph> bla bla </paragraph>
                   <paragraph> bla bla </paragraph>
              </listitem>
              <listitem>
                   <paragraph> bla bla </paragraph>
                   <paragraph> bla bla </paragraph>
              </listitem>
         </list>
    </chapter>
    

    Is there an easyer (except the xmlElements) way to find all the lists and apply the appropriate paragraph style (I have a definition of 'list_with_disk' and a 'list_with_square' one)?

    Hi Vamitul,

    Please try the JS code below.

    var myDoc = app.activeDocument;
    //____________________ disk bullet style apply
    try{
        var rootElement = myDoc.xmlElements.item(0);
        var linkElementList = rootElement.evaluateXPathExpression("//list[@type='disk']//paragraph");
        for(i=linkElementList.length-1; i>=0; i--){
            var myAttribute = linkElementList[i];
            myAttribute.xmlContent.appliedParagraphStyle = myDoc.paragraphStyles.itemByName("Disk");
            }
        }catch(e){}
    //_______________________________________________________________________________
    
    //____________________ Squar bullet style apply
    try{
        var rootElement = myDoc.xmlElements.item(0);
        var linkElementList = rootElement.evaluateXPathExpression("//list[@type='square']//paragraph");
        for(i=linkElementList.length-1; i>=0; i--){
            var myAttribute = linkElementList[i];
            myAttribute.xmlContent.appliedParagraphStyle = myDoc.paragraphStyles.itemByName("Square");
            }
        }catch(e){}
    //_______________________________________________________________________________
    

    THX,

    csm_phil

  • Select the XML ELEMENT of Java not supported

    Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production0
    PL/SQL Release 12.1.0.2.0 - Production0
    CORE12.1.0.2.0Production0
    AMT for Linux: Version 12.1.0.2.0 - Production0
    NLSRTL Version 12.1.0.2.0 - Production0

    Using JavaSE - 1.7

    I have the following:

    stmt = getStatement();

    try {}

    String T1 = "SELECT XMLELEMENT (\"CHECKINOUT\ "").

    + ", xmlattributes (property-id AS \"PROPERTY\ ' ").

    +", msgid AS \"ID\ «»

    +"status AS \"STATUS\ «»

    +', lead_name AS \"OCCUPANT\ «»

    +"email LIKE \"EMAIL\ «»

    +', unit_ext AS \"EXTENSION\ «»

    +', folio_id AS \"FOLIO\ «»

    + "," $: ~' AS \"RECORDS\")) ' "

    + 'LIKE tosend.

    + "OF TABLE (pm_pbx_systems.checkinout ("LOL"));

    RS = stmt.executeQuery (q1);

    {while (RS. Next())}

    System.out.println (RS. GetString ("tosend"));

    valid = true;

    }

    The result set all out them with a null value. How do I would be that it works?

    The query returns an XMLType object, not a string. That's why your rs.getString returns null.

    Use the SQLXML interface to read the value of the column in the result set:

    rs.getSQLXML("TOSEND").getString)

    You can also serialize a string directly in the query:

    SELECT XMLSerialize (content

    XMLELEMENT ("CHECKINOUT',

    ...

    )

    VARCHAR2 (4000) - or CLOB, according to your requirement

    )

    TABLE...

    and you will be able to use rs.getString ().

    I suggest also not coding of SQL queries directly in the Java code.

    Encapsulate as much as you can in the PL/SQL functions or procedures and simply call those.

    Maintenance will be easier and safer.

Maybe you are looking for