[JS] Find & Replace attribute in xml tags (InDesign CS4)

Hi all,
Can anyone help me please who i can find and change attribute in xml tags (InDesign CS4) files. I have both link tags but its other attribute different but one attribute same. So who i can change attribute preference.
(1) one is
(2) second is
I want change link preference = 0 but only (2 number,  second) screen shoot. First screen shoot preference = 1 as it is.
I want this but its manually
Help me please. Thank you so much adv.
Regard
snegig

Hi John Hawkinson,
Thank you so much for replay. I am try Jeff, absqua code technique it is simply greet. But my problem is that my both tags link preference = 1 same and other link attribute almost same. So i am unable to change attribute.
John my code below =>
var doc = app.activeDocument,
attNodes = doc.xmlElements[0].evaluateXPathExpression("//link[@preference = '1' or @role = 'generated']"), i, l;
for (i = 0, l = attNodes.length; i < l; i++) {
attNodes[i].xmlAttributes.item("preference").remove();
John please update my code.
Thank you so much adv.
Regard
snegig

Similar Messages

  • "Unterminated value for attribute '' in XML Tag ''.(SBL-UIF-00265)"

    Getting this message when I do Edit Web Layout for a view in Siebel tools 7.8.2 "Unterminated value for attribute '' in XML tag ''.(SBL-UIF-00265)"...Anyone have any idea why I am getting this message?

    Thanks Joseph,
    Actually I looked at the Refer ID 1280569.1 before also, some how I could not figured it out the exact location as I was searching for two "(double quotes).
    Today I tried again and finally I found out the culprit. In my case actually there was no two double quotes, instead the " (double quote) was missing.
    Thanks again.
    Edited by: user624054 on Oct 5, 2011 8:10 AM

  • Spec oversight? Using dynamic-attributes in XML tag files

    I have a couple of tagfiles that generate form elements with specific conventions for the 'name' and 'value' attribute. Basically, a data binding framework.
    Dynamic attributes are useful because you can delegate all the usual html attributes to the generated HTML form element: SELECT, INPUT, id, class etc.
    The usual way to do this is to concatenate all the "pass-through" attributes to a string, and append this string to the element generated:
    <input type="hidden" name="foo" ${dynattrs}/>I'm wondering how to do this in a tagfile in XML format (mytag.tagx), since the XML format forbids syntax like in the example above.
    jsp:attribute won't help much, if it's nested inside a c:forEach: it won't apply to the right element.

    Ran into the same problem with 'optional attributes'. (see post "JSP 2.0 Tag files outputting elements with conditional attributes" http://forum.java.sun.com/thread.jspa?forumID=45&threadID=681033)
    Found a solution that is not very elegant but does work and saves you the trouble of reverting to Java Tags. Consider the following tag-file that outputs an html input-tag with conditional attributes:
    <?xml version="1.0" encoding="utf-8"?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"
         xmlns:c="http://java.sun.com/jsp/jstl/core">
         <jsp:directive.attribute name="name" required="true" type="java.lang.String"/>
         <jsp:directive.attribute name="id" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="value" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="disabled" required="false" type="java.lang.Boolean"/>
         <jsp:directive.attribute name="hint" required="false" type="java.lang.String"/>
         <jsp:directive.attribute name="cssClass" required="false" type="java.lang.String"/>
         <jsp:text><![CDATA[<input type="text" name="]]><c:out value="${name}"/><![CDATA["]]></jsp:text>
         <c:if test="${!empty id}"><![CDATA[ id="]]><c:out value="${id}"/><![CDATA["]]></c:if>
         <c:if test="${!empty cssClass}"><![CDATA[ class="]]><c:out value="${disabled?(cssClass + '-disabled'):cssClass}"/><![CDATA["]]></c:if>
         <c:if test="${disabled}"><![CDATA[ disabled="disabled"]]></c:if>
         <c:choose>
              <c:when test="${!empty value}"><![CDATA[ value="]]><c:out value="${value}"/><![CDATA["]]></c:when>
              <c:when test="${!empty hint}"><![CDATA[ value="]]><c:out value="${hint}"/><![CDATA[" onfocus="if(this.value==']]><c:out value="${hint}"/><![CDATA[')this.value='';"]]></c:when>
         </c:choose>
         <jsp:text><![CDATA[/>]]></jsp:text>
    </jsp:root>In answer to your question: Yes, it looks like an oversight. Using the jsp:attribute tag in a c:forEach doesn't work because the attribute is then applied to the forEach tag. You would have to put the attribute-tag inside a jsp:body tag (inside the forEach). Then it would apply not to the forEach tag but to the tag enclosing the forEach. However, this doesn't work either, or at least it doesn't work in Tomcat 5.5. Could be a bug though, JSP 2.0 is still very buggy (for instance, using a tagfile inside another tagfile from the same taglib doesn't seem to work either...)
    Anyway, if you ever find a good solution please let me know by posting to this topic!
    TIA

  • DataWriter - removing attributes from xml tag at the start of document

    Hi,
    I'm using DataWriter for generating a large XML document, however I do not want the attributees of the starting xml tag to appear in the final file.
    Eg: <?xml version="1.0" {color:#ff0000}encoding="UTF-8" standalone="yes"{color}?>I do not want to output the part highlighted in red.
    What could be the possible ways to do it? I prefer if it can be removed in the begining itself instead of parsing the document and removing in the end.
    -TIA, saum
    Edited by: nkrust on Feb 15, 2010 4:29 PM

    try {
                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        Marshaller marshaller = new Marshaller(new OutputStreamWriter(
                                  baos));
                        marshaller.marshal(ResponseContents);
                        // Create an object of type Document from the XML document
                        // created.
                        DocumentBuilderFactory domFactory = DocumentBuilderFactory
                                  .newInstance();
                        domFactory.setNamespaceAware(false);
                        DocumentBuilder builder = domFactory.newDocumentBuilder();
                        responseDoc = builder.parse(new ByteArrayInputStream(
                                  ResponseUtils.formatXMLString(baos.toString())));
                   } catch (IOException e) {
                        e.printStackTrace();
                        System.out.println(e.getMessage());
                   }

  • How to remove xmlns attribute from XML tag?

    Hello!
    I have a XMLType document:
    --- P R O B L E M # 1 ---
    <?xml version="1.0" encoding="windows-1257" ?>
    <RESPONSE xmlns="http://testserver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://testserver response.xsd">
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>
    I very need to remove from RESPONSE tag all addition information. Result I need is:
    <?xml version="1.0" encoding="windows-1257" ?>
    <RESPONSE>
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>
    What can I do in this situation? My Oracle version is 9.2.
    --- P R O B L E M # 2 ---
    How I can create from source XML this one:
    <?xml version="1.0" encoding="windows-1257" ?>
    <MY_RESPONSE>
    <RESPONSE xmlns="http://testserver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://testserver response.xsd">
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>
    </MY_RESPONSE>
    Thanks for your answers!
    Flu

    Maybe the problem#1 can be solved with a simple pl/sql using REPLACE statement. start with the <RESPONSE and look for the end > and get the entire string and replace that with only <RESPONSE> or maybe you can achieve this using xmldom to delete the attributes as part of the element.
    PRoblem#2 can be solved in this way.
    select xmlelement("MY_RESPONSE",
    xmltype('<RESPONSE xmlns="http://testserver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://testserver response.xsd">
    <DATA REQUEST_ID="111">
    <ENTITY name="PACKAGE_001">
    <ATTRIBUTE name="PERS_ID" value="1111" />
    <ATTRIBUTE name="FIRST_NAME" value="OLGA" />
    <ATTRIBUTE name="SURNAME" value="NOVIKOVA" />
    </ENTITY>
    </DATA>
    </RESPONSE>')).GetClobVal()
    from dual
    /

  • Anyone know how to use a regex to find an attribute in a tag?

    Does anyone know how to do the following using a regular
    expression in dreamweaver?
    If cellpadding="ANYNUMBER" is located anywhere in a table
    tag, get rid of it? I can get it to work by searching for table
    cellpadding="([0-9]+)" but it only works if nothing is in between
    table and cellpadding. If it looks like table border="0"
    cellpadding="1", it won't work because border is in the way.

    Since 'cellpadding' can only be used in a table tag, just
    search for '
    cellpadding="([0-9]+)" and replace it with ''.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "jm1275" <[email protected]> wrote in
    message
    news:e5hl20$ge8$[email protected]..
    > Does anyone know how to do the following using a regular
    expression in
    > dreamweaver?
    >
    > If cellpadding="ANYNUMBER" is located anywhere in a
    table tag, get rid of
    > it?
    > I can get it to work by searching for table
    cellpadding="([0-9]+)" but it
    > only
    > works if nothing is in between table and cellpadding. If
    it looks like
    > table
    > border="0" cellpadding="1", it won't work because border
    is in the way.
    >

  • Error when loading xml in Indesign CS4

    Hello,
    A couple of years ago, we wrote a little javascript file to import an xml file in Indesign CS2. Which worked fine.
    But now in CS4, we get the following error message:
    Javascript Error!
    Error Number: 55
    Error String: Object does not support the property or method '[object InsertionPoint]'
    I narrowed it down to this little method:
    function verwijderlege(elm) => elm = app.activedocument which is an XML file.
    var i, offset;
      for (i = elm.xmlElements.length - 1 ; i > -1 ; i--)
      if (elm.xmlElements[i].contents == "")
      offset = elm.xmlElements[i].storyOffset;
      parentst = elm.xmlElements[i].parentStory;
      elm.xmlElements[i].remove();
    parentst.characters[offset].remove(); (Error message sais it's this line)
        else 
      verwijderlege(elm.xmlElements[i]);
    I hope someone can help me with this.
    Thanks in advance,
    Gunther Christiaens

    Hi Anatoly,
    I suspect this is a problem with the underlying package DBMS_XMLGEN and not directly in APEX.
    Can you reproduce this issue on apex.oracle.com?
    Joel

  • Indesign Javascript, find  xml tag from cursor position

    Hi All,
    I have a single textframe with multiple xml tags within formated by paragraph and character styles.
    I want to access the xml tag attribute of the xmltag, related to my first 5 characters....
    How to do it?
    Or second approch, i need to find first and last xml tag on the page.

    Try this (second approach),
    Select any text frame and try the below code:
    alert(app.selection[0].lines[0].words[0].associatedXMLElements[0].markupTag.name)\\first XML tag
    alert(app.selection[0].lines[-1].words[-1].associatedXMLElements[0].markupTag.name)\\second XML tag
    Vandy

  • How to find the selection character is xml tag or not?(CS2-js)

    I have a xml tagged indesign document, when i select a tag in paragraph i cant able to find it as xml tag, it only shows me the character contents as small box, is there any way to find the selected item is xml tag or not ?
    thanks
    subha

    I have a xml tagged indesign document, when i select a tag in paragraph i cant able to find it as xml tag, it only shows me the character contents as small box, is there any way to find the selected item is xml tag or not ?
    thanks
    subha

  • Unable to define the XML tags with colon in XPath using gluecode

    Hi Everyone,
    I am working on XML with InDesign CS4. I need to do some automation stuffs for those. In my InDesign document, the XML tags (Eg. <ab:para>, <ab:figure> & etc…) name contains colon characters. If i try to loop these tags through gluecode using XPath expression, the script throws me a error like 'Adobe InDesign cannot processXPath expression'.
    Can anyone look into this and suggest me a right solution.
    Thanks in advance.
    Thiyagu

    Hi thiyagu,
        this.xpath = "//para";
        this.xpath = "//figure";
    Try this without the XML namespace in XPath Expression.  it's not tested code,  but it may works.
    Regards,
    Nagaraj

  • InDesign CS4 crash when printing .."macromedia" apparent culprit..

    (Sorry if this has found its way to the wrong advice Forum: I can't seem to find a way to the appropriate InDesign CS4 "Community" to post it in!)
    My Mac version of InDesign CS4 version 6.0.6 has begun crashing when attempting to print.
    The Crash Log shows the particular crashed thread to always include the line:
    com.macromedia.Flash Player.authplaylib    0x1c5ac2dd ExternalPlayer_Initialize  +  1864739
    ..which is repeated a further twice, with various similar numbers just before and after "ExternalPlayer_Initialize".
    I assume that this is a problem with InDesign calling "macromedia.Flash Player" instead of Adobe Flash Player, but I have no idea where or how to modify the phrase "macromedia.Flash Player" to encourage the program to run correctly.
    NOTE ALSO: That the program was installed on a Mac which had been lost, and was subsequently found and returned, but in the meantime we'd bought a replacement Mac. InDesign was then UNinstalled from the originally-lost Mac, and a full previous backup of that Mac was then restored onto the new Mac so that it was a complete copy of the original (..thus abiding by usage restrictions..)
    After the program was restored onto the new Mac it longer Prints.
    Any help or suggestions, please?

    Thanks for your quick reply!
    I'll hunt for pastebin.com and put a copy of the crash log there, and will reply here when I've done that.
    Meanwhile, regarding restoring, it was the entire Mac contents which were restored, not just the Applications folder (..this was a new Mac which was being "cloned" from the previous backup..) so all the attendant files, hidden here and there, would also have been restored back to their appropriate places as well!
    I'll go and place a crash log at pastebin.com now. Many thanks!

  • Indesign cs4 update error

    Hi,
    We are working in Indesign cs4..i am getting error while updating the xml in Indesign cs4.but it is working fine in Indesign cs5.5 and cs6...i have added my script below,
    function ReLink()
    myDoc = app.activeDocument;
    myLinks = myDoc.links;
    for (j = myLinks.length - 1; j >= 0; j--)
                        myName = myLinks[j].filePath;
                 var ext =  myName.substring(myName.length-3,myName.length) ;
               if (ext=="xml")
          var reLinkXMLFile = app.scriptArgs.get("reLinkXMLFile");
                  var myXMLFile = File(reLinkXMLFile);
         myLinks[j].relink(myXMLFile);
         myLinks[j].update();
    please someone help us to solve this problem.thanks in advance.

    I think you're in the wrong forum.
    Have you tried to ask your question at: http://forums.adobe.com/community/indesign/indesign_scripting  ?
    Regards
    Bartek

  • How can i find and replace xml tags?

    Hi, i am using xml in my workflow and want to be able to remove certain tags if they contain particular text.
    here is an example of my xml structure…
    <entry>
        <name>DEFAULT</name>
        <tel>DEFAULT</tel>
        <address>DEFAULT</address>
    </entry>
    I am using this initial structure to set the paragraph styles to be followed when the xml data is imported.
    This leaves DEFAULT in place wherever an entry doesn't have any content for that field.
    I want to be able to import my XML then run a script that removes any tags that include DEFAULT, - I need the entire xml tag to be removed not just the text, if i do a normal find and replace it will only remove the text not the tags which is causing problems with styling. I also want to remove the end of para/return (^p) that i've placed at the end of the line. So it would be the same as opening up story editor and removing the content + tags + hard return in there, but i want to automate the process…
    So i think this is what i need to search for in each case
    "<name>DEFAULT</name>^p"
    and i want to replace it with nothing ""
    Can this be done through scripting (ideally javascript)?
    I have a little knowledge of javascript but am not sure how to search and target that kind of string in indesign...
    using indesign cs5
    many thanks

    Hi,
    Script should do it in two steps:
    1. find all occurences of i.e. ">DEFAULT<"
    2. remove whole paragraph which is a found_text's container.
    For example this way -JS - (a textFrame filled with your text should be selected) :
    var mStory = app.selection[0].parentStory;
    app.findTextPreferences =  null;
    app.findTextPreferences.findWhat = ">DEFAULT<";
    var myF = mStory.findText();
    var count = myF.length;
    while (count--)
         myF[count].paragraphs[0].remove();
    rgds

  • XML tag markers moved: Find and Replace causing problem in xml elements

    Hi All,
    I am doing find and replace using GREP. While using the expression like $1, $2 (Found Items) in the change to field it changes the placement of tag marker. If the found item is a part of two of more xml elements, I am getting a serious problem while replacing it. (ie. The xml tag markers are moved.)
    See the screen shot below, then you may get better idea. And help me to overcome this issue.
    This is just an example to show you what i'm trying to say, there are so many cases like this.
    Original text/ Before doing find replace
    After replacing
    Green4ever

    Hi Peter and John,
    but it seems to me that the example is looking for any space that
    follows a semi-colon and has two word characters following it, and
    repalce that with an em space. I think you could do the same using look
    behind and look ahead and not need to replace the found text.
    Yes you are right about the look behind and look ahead. I'd like to show some more examples to show what the actual problem is,
    Original/Before Replacing,
    (Consider there is another case here, instead of em-space some times normal word space will also be there)
    Using the Grep:
    Find What---------> ^(\d+\.(?:\d+)?)~m
    Change To------------->$1\t
    After Replace:
    Did I make any sense? Eventhough this will not make any changes in the layout, my requirement is to insert the tab out-side the tag marker not indise.
    Green4ever

  • How to Find the XML Tag in indesign

    HI!!<br /><br />We are working with XML work flow in indesign. In indesign how could we find the XML Tag in indesign.<br /><br />Example::<br />In the Below list we could have to find the xml tag <chapter> in story editor or in the main text frame in indesign using find option. Kindely sent if any Plugins is available.<br /><br />For exmaple:<br />************<br /><book><br /> <part><br /> <chapter><br />  <head><br />   <para><br />    <bold><br /><br />Thanks,<br />C.K.Venkatesan

    I imported the xml file in vb.net. now i want to find the number of pages and no. of elements. i found out it. but i was not able to find which elements are placed in which page. i want that information. plz kindly help. i am using vb.net. for eg. <ce:figure> placed in which page no., <ce:sections> placed in which page no., etc..,

Maybe you are looking for

  • How to retrieve query string value from the URL in my portlet

    Hi, When user clicks on "Advance Search", i am redirecting to page in the community. At the same i am adding some more values to the query string (to the URL). My URL will look like this. http://ctp-mc0149/portal/server.pt?space=CommunityPage&parentn

  • Folio Producer: reduce document dimensions of a folio

    Hello, we have a small problem regarding the folio document dimensions (2048 px, 1024 px). Our goal is to publish one version for a 2048 px resolution and one version for 1024 px. This is not a problem for documents we design – we simply create two f

  • Functionality of Partner profiles in Idocs

    Hi All, Can somebody help me with the exact functioanlity of partner profiles in ALE/IDoc. Kind Regards Chakradhar

  • Windows smart card logon and kdc certificate (2008R2)

    dear,  we are trying to implement a smartcard logon on 2008r2 dc and ca. Environment: Domain controller - windows server 2008 R2 CA - windows server 2008 R2 testing server - windows server 2008 R2 when using smartcard logon, a message pops up "The sy

  • Mystery freak out in background render (FCPX) on new Mac Pro

    Just migrated to new computer - background render numbers flying out of control. When we open backgroud tasks - nothing shows up. We edit for about 20 minutes, entire computer freezes. Contacted Apple support, re-installed FCP. Still happening. Anyon