Rename the XML attribute

Hi all

I want to rename the attribute in the indesign document. I found no reference in this forum.

Here are the attribute appear in the palette of structure in the Indesign Document:

News[@North=N01]

And want to change the line above to:

News[@South=N01]

I only want to change of name not the attribute value.

Need help.

Thank you

LUN

Post edited by: designmon79

var doc = app.activeDocument,
    elements = doc.xmlElements[0].evaluateXPathExpression("//news[@north='n01']"),
    i, l;

for (i = 0, l = elements.length; i < l; i++) {
    elements[i].xmlAttributes.item("north").name = "south";
}

Jeff

Tags: InDesign

Similar Questions

  • How to remove the value of the XML attribute in the Indesign file with javascript

    Hi all

    How to remove the value of the XML attribute in the Indesign file.

    1.jpg

    What error is this?

    in any case try this as well (one another),

    var myDoc = app.activeDocument;
    attrDelete(myDoc);
    function attrDelete(elm)
    {
        for (var i = 0; i < elm.xmlElements.length; i++)
        {
            try{
                for(j=0; j
    

    Vandy

  • Rename the 1 ' attribute ' for client QDs in the search screens.

    We use the field "attribute 1' to store a 'Username' people so that it can be used as a search option by default, when you connect to a call, etc.

    Customer QoS for the screens of the IPK are easily modified in the HTML code and changed "client 1 title attribute" in the system of titles and widgets - servicedesk.xml updated to reflect the changes for new customer unique QDs created, but research existing criteria for customer QoS screens still show ' 1' and not 'Username' attribute for the QD customer?

    customer QD.jpg

    Anyone know where VSM9 (RP10) is populating the QD options for the QDs search screen? I have watched in a variety of places to the JS/HTML and SQL queries, but can't find it.

    Davejball,

    In the search-html file - Call.xsl (located in c:\Program Files\VMware\Service Manager\System1\Search\HTML folder), you can change the settings in the client QDs.  The search folder contains all the parameter to the search screen.

    In the research-html file - Call.xsl, it just search "Attribute 1" and change it to "User Name".  Save the file iisreset.

    Hope this helps out.

  • [CS5 - JS] Definition of the XML attributes from variables...

    Hello

    I'm building a XML variable to store the information needed to run my script.

    The XML structure is quite simple:

    var = new XML document ("< document > < pages > < page / > < / pages > < / document >");

    Every 'page' nodes are added using a simple statement.

    If I need to add an attribute to a node of 'page' I usually use this method:

    document.pages.page.@height= 210;

    What happens if I need to add an attribute without knowing its name (because it is stored in a variable)?

    Y at - it something like that? :

    document.pages.page.setAttribute (Name, 210);

    Have no idea how to handle this...

    Try this:

    document.pages.page['@'+var_name] = 210;

    @+

    Marc

  • Rename the XML via Javascript tags

    Currently, I have a script that detects some paragraph styles and renames them. For example:

    var myDoc = app.activeDocument;

    var myStyle = myDoc.paragraphStyles.itemByName ("bar SIDE B HEAD");
    myStyle.name = "SIDEBAR HEAD of NOTE"

    I would like to do the same thing with some names of XML tags, preferably as part of the same script. I'm sure it's pretty easy, but for some reason, I can't find any info on how to tell the XML tags!

    I looked in the tutorial Scripting InDesign CS4 and Adobe Introduction to scripting, but at this point, I feel I'm wasting my time on a simple problem. Anyone can help out by an amateur?

    Thanks in advance,

    Matt

    Yes you are right Matt, it is very easy.

    var myDoc = app.activeDocument;
    var myTag = myDoc.xmlTags.itemByName("Old");
    myTag.name = "New";
    

    Shonky

  • How to add the XML attribute to an element using BPEL assign

    I have a xml request to a bpel process that contains no attribute.
    After some process, I need to create this missing attribute and specify a value.

    I tried to use the XML fragment in the business to be divested. But how do I create an attribute?
    This XML node which I am trying to create an attribute is a very large knot with many dynamic typing(xsi:type). I can just re - create the complete xml code with the required nodes.

    Anyone know how I can create an attribute xml using the BPEL entitlement? I don't want to use the Java code in my process.

    Thank you.

    You can use the attribute bpelx:insertMissingToData on the item to copy, for example:




    Query="/client:process/@time"/ >

    If not there is time of the attribute in the process element, it will be added.

  • POOR RECOVERY OF THE XML ATTRIBUTE VALUES

    Hi all

    I searched this forum and the web a way to get the value of an xml attribute. The solutions I found always had a problem, the values returned when concatenated without any separators, so I can't know every value.

    Here's how:

    BEGIN

    l_bfile: = BFILENAME ('CTEMP1', nome_fich);
    DBMS_LOB. FileOpen (l_bfile);
    DBMS_LOB. LoadFromFile (l_clob, l_bfile, DBMS_LOB.lobmaxsize);
    DBMS_LOB. FileClose (l_bfile);
    xmlx: = XMLTYPE (l_clob);
    Str: = xmlx. Extract('rowset/Row/@id'). GETSTRINGVAL();

    dbms_output.put_line (' :'|| id values) (STR);
    END;

    Returns the string str: 123456654321 for this example

    <? XML version = "1.0" encoding = "UTF-8"? >
    rowset <>
    < row id = "123456" >
    < name > Peter < / name >
    < / row >
    < row id '654321' = >
    < name > Louis < / name >
    < / row >
    < / lines >


    I want to get each id concatenated for example values (123456:654321) instead, I get the concatenated values (123456654321).


    Does anyone know a work around for this problem?


    Cordially Pedro.

    11.2 you can use listagg()

    SQL> with t as (select xmltype('
      2    
      3      Peter
      4     
      5     
      6      Louis
      7     
      8    ') xcol from dual)
      9  select listagg(v.val,':') within group (order by null) val
     10  from t,xmltable('/rowset/row/@id'
     11  passing t.xcol
     12  columns val varchar2(1000) path '.') v;
    
    VAL
    ------------------------------------------------------------------------------------------------------------------------
    123456:654321  
    

    If not 11.2

    SQL> with t as (select xmltype('
      2  
      3  Peter
      4  
      5  
      6  Louis
      7  
      8  ') xcol from dual)
      9  select xmlquery('fn:string-join(/rowset/row/@id,'':'')'
     10  passing by value t.xcol  returning content) val
     11  from t;
    
    VAL
    ------------------------------------------------------------------------------------------------------------------------
    123456:654321
    
  • With the help of the XML attributes in itemRenderer and labelFunction

    Hello!

    I searched for hours and read the Devguide but always impossible to find the solution to my problem.
    I have a xml returned from php like this:
    < files >
    < record id = "1" name = "name_1" type = "0" / >
    < record id = "2" name = "name_2" type = "0" / >
    < record id = "3" name = "name_3" type = "1 / >"
    < / documents >

    I can bind the result returned from the HTTPService to a data grid:

    < mx:DataGrid dataProvider = "{ret_XML.record}" width = "500" number of rows = "20" editable = "false" id = "dg" > "
    < mx:columns >
    <!-NEXT WORK! ->
    "< mx:DataGridColumn headerText ="Name" dataField="@name " width ="300"/ >
    <!- LABELFUNC don't DO NOT WORK IN LINE NEXT->
    "< headerText ="Type"dataField="@type mx:DataGridColumn " labelFunction ="labelFunc">
    < / mx:DataGridColumn >
    "< headerText ="Id"mx:DataGridColumn dataField="@id " editable ="false">
    < mx:itemRenderer >
    < mx:Component >
    <!-LINE FOLLOWING IS don't DO NOT WORK! ->
    "{< mx:Button label="{data.@id} '/ >
    < / mx:Component >
    < / mx:itemRenderer >
    < / mx:DataGridColumn >
    < / mx:columns >
    < / mx:DataGrid >

    and I have a labelFunction like this:

    private void labelFunc(item:Object,_column:DataGridColumn):String {}
    return "Type:"+ item.@type; "
    }

    So, my problem is that when I bind the column to an XML attribute, it works fine but when I try to link it to an itemRenderer or use it in a function, it does not work. I'm trying for hours now, but just can't make it work.
    I tried:
    "{< mx:Button label="{data.@id} '/ >
    < mx:Button label = "{data. () @id)} »/ >
    "{< mx:Button label="{@data.id} '/ >

    and perhaps others but no luck...
    Please someone help me with this one!

    Ty:
    [Pig]

    Problem solved!

    Well, post it on the forum after I solved my problem as follows:

    So in itemRenderer just use data.attribute () with the desired XML attribute name

    And in the labelFunction:

    private void labelFunc(item:Object,_column:DataGridColumn):String {}
    return "Type:"+ item.attribute ('type'); '.
    }
    Even with itemRenderer but rather data use () item.attribute

    I hope that this is the 'official' solution too...

    [Pig]

  • Retrieves the value of the XML attribute for multiple element sequence

    Guys,

    I have already posted this in the forum XML DB, but some of you could help me.


    I have searched for a solution for this and couldn't quite. I'm trying to get multiple entries in a node attribute values. It workes for a single node, but for many nodes, it fails. Could you please give me a solution?

    SQL> select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME
      2        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@NAME') CITY_NAME
      3        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@POPULATION') POPULATION
      4  from xmltable('WORLD' passing xmltype('
      5  <WORLD>
      6  <COUNTRY NAME="INDIA">
      7  <CITY NAME="MUMBAI" POPULATION="10000"></CITY>
      8  </COUNTRY>
      9  </WORLD>'
     10  ));
     
    COUNTRY_NAME CITY_NAME POPULATION
    ---------------------- ------------------ -------------------
    INDIA MUMBAI 10000
    When I execute the same for several nodes, it fails, please guide me. Please also let me know how to handle if I have an XML file that contains this data.

    SQL> select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME
      2        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@NAME') CITY_NAME
      3        ,extractvalue(column_value, '/WORLD/COUNTRY/CITY/@POPULATION') POPULATION
      4  from xmltable('WORLD' passing xmltype('
      5  <WORLD>
      6  <COUNTRY NAME="INDIA">
      7  <CITY NAME="MUMBAI" POPULATION="10000"></CITY>
      8  <CITY NAME="CHENNAI" POPULATION="2000"></CITY>
      9  <CITY NAME="BANGALORE" POPULATION="13000"></CITY>
     10  <CITY NAME="HYDERABAD" POPULATION="14000"></CITY>
     11  </COUNTRY>
     12  </WORLD>'
     13  ));
    select extractvalue(column_value, '/WORLD/COUNTRY/@NAME') COUNTRY_NAME
                                                                      *
    ERROR at line 1:
    ORA-19025: EXTRACTVALUE returns value of only one node
    See you soon
    Sarma.

    So, this is the first step:

    SQL> with test as
      2  (select xmltype('
      3                 
      4                 
      5                 
      6                 
      7                 
      8                 
      9  ') resp from dual)
     10  select country
     11       , cities
     12  from xmltable('WORLD/COUNTRY' passing (select resp from test)
     13                         columns country varchar2(50) path '/COUNTRY/@NAME'
     14                               , cities xmltype path '/COUNTRY/CITY') world
     15  /
    
    COUNTRY         CITIES
    --------------- --------------------------------------------------
    INDIA           
    

    two columns, a varchar2 and an xmltype.

    Then do the same with the second column, pass the XML to the function XMLTABLE

    SQL> with test as
      2  (select xmltype('
      3                 
      4                 
      5                 
      6                 
      7                 
      8                 
      9  ') resp from dual)
     10  select country
     11       , cit.name
     12       , cit.population
     13  from xmltable('WORLD/COUNTRY' passing (select resp from test)
     14                         columns country varchar2(50) path '/COUNTRY/@NAME'
     15                               , cities xmltype path '/COUNTRY/CITY') world
     16     , xmltable ('CITY' passing cities
     17                columns name varchar2(50) path '@NAME'
     18                      , population number path '@POPULATION'
     19                ) cit
     20  ;
    
    COUNTRY         NAME                                               POPULATION
    --------------- -------------------------------------------------- ----------
    INDIA           MUMBAI                                                  10000
    INDIA           CHENNAI                                                  2000
    INDIA           BANGALORE                                               13000
    INDIA           HYDERABAD                                               14000
    
  • Hide the XML attribute if no data value / doesn't exist

    Hello

    I have a xsd defined as the following structure:
    --------------
    < xsd: complexType name = "PersonImageType" >
    < xsd: attribute name = "ID" type = "xsd: Integer" / >
    < xsd: attribute name = "FileName" type = "xsd: String" / >
    < xsd: attribute name = "ErrorMessage" type = "xsd: String" use = "optional" / >
    < xsd: attribute name = "Fetched" type = "xsd: String" / >
    < xsd: attribute name = "S1" type = "xsd: String" / >
    < xsd: attribute name = "S2" type = "xsd: String" / >
    < / xsd: complexType >
    --------------

    When I run my BPEL process, I get the reply/output as follows:

    --------------
    < PersonImage >
    "" < PersonImage ID = "12410276" FileName = "12410276.jpg" ErrorMessage ="" recovered = "Y" S1 = S2 "Y" = "Y" / >
    < / PersonImage >
    --------------

    When you look at the output, the xml 'ErrorMessage' attribute has no value in it.
    I want to:
    (a) hide this attribute - when there is no data and
    (b) display this attribute - when it has all the data.

    Very appreciated if someone help me solve this problem.

    Thank you and best regards,
    Rakesh

    without double quotes around the @ErrorMessage

    see you soon
    James

  • Remove the XML attribute

    Hello

    I export xml data into our database files. Since the xsd has changed it can be exported directly to another db to a third-party tool and I (among others) remove an attribute of an element
    CREATE TABLE xml_test(
          message XMLTYPE
          )
    /
    INSERT INTO xml_test
    VALUES (q'[<?xml version="1.0" encoding="ISO-8859-1"?>
    <ZusyMeldung xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://www.zusy.de/2002/XMLSchema" 
    xsi:schemaLocation="http://www.zusy.de/2002/XMLSchema ZusyAZ01.xsd">
      <TransferHeader xsi:nil="true"/>
      <Daten>
        A lot more elements
      </Daten>
    </ZusyMeldung>]')
    /
    COMMIT;
    < TransferHeader xsi: Nil = 'true' / > should become < TransferHeader / >.

    I want to write files directly with the script next and tried to use updateXML in my SELECTION, but somehow I don't understand well.
    DECLARE
        CURSOR cur_out IS
            SELECT  message
            FROM    xml_test;
    BEGIN
        FOR r_out IN cur_out LOOP
            dbms_xslprocessor.clob2file (
                 r_out.message
                ,'DIR_XMLOUT'
                ,'out_name.xml'
                ,0
                );
        END LOOP;
    END;
    /
    Concerning
    Marcus

    Hi Marcus,

    Given that you want to remove, try deleteXML :

    select xmlserialize(document
             deletexml(
               message
             , '/ZusyMeldung/TransferHeader/@xsi:nil'
             , 'xmlns="http://www.zusy.de/2002/XMLSchema", xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
             )
           )
    from xml_test ;
    

    Note that the functions of XML DML Oracle (updateXML, deleteXML etc.) are not recommended in 11.2.0.3 for the update of XQuery:

    select xmlquery(
             'declare default element namespace "http://www.zusy.de/2002/XMLSchema"; (: :)
              copy $d := .
              modify ( delete node $d/ZusyMeldung/TransferHeader/@xsi:nil )
              return $d'
            passing message
            returning content
           )
    from xml_test ;
    
  • Add the XML attribute

    Right now I work with a very simple .xml file that retrieves data ultimately resulting in the generation of run-time components. Here is a simplified version:

    < data >
    < article type = "Button" x = "50" y = "100" label = "Button 1" / >
    < article type = "Button" x = "50" y = "300" label = "Button 2" / >
    < / data >

    I figured out how to remove an attribute, such as the "label" with this:

    If (. name(). attributes() [i] myXML.item [0] == "label" "")
    {
    delete myXML.build.item [0]. attributes() [i];
    i-- ;
    }

    Now, the question is how can I add another attribute - like the "height"? Any help would be greatly appreciated. Thank you.

    Okay, I just stumbbled on the solution:

    x 1. @["name"] = "test 2"; "

    This seems to do. I don't know if the reverse works just not or if I did it all just bad. Thanks for your help.

  • Rename the XML tags

    Dear people,

    Is there a way to search and replace all XML elements.

    Search replace xmlTags.item ("tag1") to xmlTags.item("tag2")?

    Greetings

    Ed.

    Got it!

    var myDoc = app.activeDocument;
    
    var myElement = myDoc.xmlElements.item(0);
    var myElements = myElement.evaluateXPathExpression("//tag1");
    
    for(var x = myElements.length -1;x>=0;x--)
    
    myElements[x].markupTag.name =("tag2");
    

    Thank you very much for the help!

    As you can see Im yet to try to understand the operation of Javascript.

    Once again thank you.

  • ESD context-setting shaped based on XML attributes

    Hi all

    I have some difficulty to get my EDD to format correctly based on the XML attributes. Basically, what I would like is:

    I have a few XML:

    < root >

    < elem > example text sample text sample text sample text. < / elem >

    < elem multi = "true" > example text example text example text sample text. < / elem >

    < / root >

    For items with the multi = 'true' attribute, I want to be prefixed by a ball and with a left indent of 0.14"in order to align the text with the ball.

    • Example text sample text

    example text sample text.

    Those without the attribute are simply formatted according to the paragraph format (no prefix, 0.0 left indent ")

    Example text sample text

    example text sample text.

    My EDD looks like this:

    (Container) element: elem

    General rule: < ANY >

    List of attributes

    Name: multi String

    Rules of prefix

    If the context is: [multi = 'true']

    Prefix: •

    Text format rules

    Paragraph element format: element

    If the context is: [multi = 'true']

    Basic properties

    Dashes

    Withdrawal left: 0.14 "

    After importing my XML, the prefix part works perfectly. No problem.

    However, the left based on the context does not work at all - all items inherit only the removal of paragraph (0.0 "). So it ends up looking like this:

    • Example text sample text

    example text sample text.

    I can't understand this. No formatting in ESD does not replace the formats specified paragraph or something?

    Any help would be greatly appreciated.

    Thank you
    Carl

    Please do not take into account the incomplete answer, it seems to me having posted. What I started to say is:

    Carl,

    Format of the item rules override formatting that it inherits from its parent, as well as modalities parentElement must not interfere with those that you specify for prim.

    I don't see the problem, and without actually opening the file in FM, it is difficult for me to guess what might be wrong.  A number of things that I do are:

    (1) set another property in the rule, for example, to set the font size to 70pt and changes the left indent. A change in font size will confirm that the rule was actually fired.

    (2) inspect the left indent in paragraph Designer. Maybe you have set it to 0.14pt instead of 0.14 to?

    -Lynne

  • Enforcement of XML attribute with a structure?

    I use xmlParse() to read an XML file into a structure and then deal with the structure (replace some of the XML attributes) and then write structure back as an XML file. The problem is that I lost the original order of the XML attributes when I convert a structure and instead end up with a new attribute for each element that is alphabetical order.

    In other: c = 'text' d = 'text' element has = "text" / >

    be rewritten in the form: element = 'text' c = 'text' d = "text" / >

    which is a problem for this application.

    Is it possible to work with XML in CF but keep ordering attribute (LinkedHashMap instead of a structure, perhaps)?

    Thank you.

    Walter

    If you need to control the order of the attributes, you must write your xml code on hand, according to the XML specification, ordering attribute must not be important, so strictly speaking your condition here requires something XML which is contrary to his intention.  And, therefore, has no way of making CF respect something that inherently isn't supposed to be respected.

    NB: "I use xmlParse() to read an XML file in a structure"... xmlParse() creates an XML object, not a struct, so what you ask in your last paragraph doesn't really sense.  xmlParse() will only create an XML object. If you want to read the XML data as something else than XML, you need to write your own function.

    The best solution here, if poss, is to remove the importance of the order attribute in your application, because it is "wrong" to deduct any order, and you do a little logic a rod for your own back based on this ranking.

    Not an answer 'just do it like this', I'm sorry, but that's what you get when the question is immersed in a Pandora's box... ;-)

    --
    Adam

Maybe you are looking for

  • use as a back up of my mac without being connected to the wifi

    Hi I changed to broadband providers and used to use extreme Apple as a base station and a capsule time to backup my mac up to via wifi. However, on my new wifi I want to connect the Apple extreme and time capsule to extend wifi wifi coverage is much

  • Toshiba Canvio Alu unrecognized hdth305ek3aa

    I used the usb drive mentioned above on Vista and Windows8.1 without problems. To save storage, I deleted some of the files it contains.Now that the drive is still recognized in Vista without problem.But when using Windows 8.1 the usb in the toolbar

  • No sound on my laptop (HP Pavilion G6)

    I have HP pavilion g6, there is no sound on my laptop I'm of the India and the U.S. laptop computer purchase.

  • printer does not print anything.

    My printer will only print the parts highlighted in an email.

  • problems with rv042g after the software upgrade

    After the software upgrade it reboot the router on every 45 seconds I tried this tool from Cisco RV0xxV3_FirmwareRescueUtility_v4.0.0.7 Web site without success, the problem is there, is one way that you can get the router up and running again? Can I