Add parent Xml Element

Hi All,
I have selected myElement. Then how to add new parent Element in indesign cs3 using Javascript.  pls suggest.
Regards,
KAn.

Well, you'll need to add a new element at the right place in the hierarchy, and then move myElement there.
So something like (untested):
var oldParent = myElement.parent;
var newParent = oldParent.xmlElements.add(oldParent.tag);
myElement.move(LocationOptions.AT_BEGINNING, newParent);
But you don't specify what the new parent node should have or where it should be in the hierarchy, so there'll need to be some adjustment.

Similar Messages

  • Javascript create parent xml element from selection

    Hello,
    With help from these forums I finally learned how to script creating a parent xml element from a selection in the Structure Pane.
    var myDoc = app.activeDocument;
    var mySel = app.selection;
    var newParent = myDoc.xmlElements[0].xmlElements.add({markupTag:"c_bullet_list"}).move(LocationOptions.before, mySel[0]);
    var i = mySel.length;
    while(i--){
              mySel[i].move(LocationOptions.AT_BEGINNING, newParent);  
    Hope this helps somebody.

    Use placeXML instead of move().
    var myXMLElementA = app.selection[0];
    var myTextFrameA = app.activeDocument.pages[2].textFrames.add({geometricBounds:[0, 0, 160, 160], contents:" "});
    myXMLElementA.placeXML(myTextFrameA);
    Shonky

  • How to add parent XML tag in ID CS5

    Hi,
    I have the following xml structrure in the InDesign cs5 document.
         <para>
              <link>
                    <insert>
    I want to add <xref> tag within this structure as parent to <insert>, like below:
         <para>
              <link>
                    <xref>
                        <insert>
    can anybody help me on this.
    Thanks,
    Krishnan

    Hi,
    First Select <insert> tag,
    var parentTagName = app.selection[0].associatedXMLElements[0].markupTag.name;
            if(parentTagName.toString() == "insert"){
                app.selection[0].associatedXMLElements[0].xmlElements.add("xref", app.selection[0]);
    Regards,
    Bala.

  • [CS3] [JS] add XML  Element to Insertion Points

    hi list,
    i'll do some text parsing in indesign cs3 intended to add some xml elements to my document.
    i just wonder why i can't markup an insertion point. is the following approach correct? The code works fine, only the return value (stored in the _xml variable) is not the new element but the parent element. The same code works without using the insertion point (marking up the text object [xmlElements.add(_dokument.xmlTags.item("index") , erg[0]))] ).
    Any ideas or thoughts?
    var _dokument = app.activeDocument;
    main ();
    // ** main ()
    function main() {
    //Set the find options.
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences= NothingEnum.nothing;
    //find any string encloased by @
    app.findGrepPreferences.findWhat = "@.*?@";
    erg = _dokument.findGrep();
    while (erg.length > 0) {
    _xml = _dokument.xmlElements[0].xmlElements.item("text").xmlElements.add(_dokument.xmlTags.item( "index") , erg[0].insertionPoints[0]);
    erg[0].contents = "";
    erg = _dokument.findGrep();

    hi dave,
    gui testing is always a good idea :-) but in this case the behaviour is different:
    your observation is correct (anyway at least a strange behaviour compared to any xml editing tool i know == how adobe intended to insert an empty element?), tagging in the gui a tagged insertion point tags the whole story.
    in the script a new element is added but the return value is the parent element (the xmlElement of the whole story).
    this causes a problem when i add an attribute (the intention of the above script is to add references) which is added to the parent element.
    gregor

  • Create XML Element Tag BasedOn Found Character Style

    Hi,
    Good Day!
    Basically I want to search only for character styles that contains "ntb-", that is why it is hard coded in my searchString variable.
    Although I was able to create XML tag based on selected character style, but it will always add/insert at the end of the parent XML element.
    Can anyone could help me how insert/add that element at the insertion point where the text is found?
    Thanks,
    --elmer
    var myDoc = app.documents[0];
    myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.POINTS;
    myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.POINTS;
    var charStyles = myDoc.allCharacterStyles;
    var foundStyles = Array();
    var searchString = String();
        searchString = 'ntb-';
    var tempName = String();
    var tempName1 = String();
    for(var i = 1; charStyles.length > i; i++){
       tempName = charStyles[i].name;
       tempName1 = tempName.toLowerCase();
       if(tempName1.indexOf (searchString.toLowerCase()) != -1){
           foundStyles.push (tempName);
    var myDialog = app.dialogs.add({name: "Convert Footnote Character Styles to XML Tags",canCancel:true});
    with (myDialog) {
        with (dialogColumns.add().borderPanels.add()) {
            with (dialogColumns.add()) {
                staticTexts.add({staticLabel: "Character style to search : "});        }
            with (dialogColumns.add()) {
                selCharStyle = dropdowns.add({stringList: foundStyles, selectedIndex: 0, minWidth: 175});
    var dialogShown = myDialog.show();
    while (dialogShown) {
        if (selCharStyle.selectedIndex == 0) {
            alert("Must have at least a character style to search!");
            dialogShown = myDialog.show();
            continue;
        } else {
            insertXMLTags(selCharStyle.stringList[selCharStyle.selectedIndex], selCharStyle.selectedIndex, "0");
            break;
    myDialog.destroy();
    alert("Finished!");
    exit();
    function insertXMLTags(cStyle, cStyleIndex, ip) {
        var myFinds = searchStyle(cStyle, cStyleIndex);
        for (i=myFinds.length - 1; i>=0; i--) {
            var myIP = myFinds[i].texts.item(0).insertionPoints.item(0);
            var myParentXML = myIP.associatedXMLElements[0];
            var myChiidXML = myParentXML.xmlElements.add ( cStyle );
            myChiidXML.contents =  myFinds[i].contents;
            //set the selection
            app.selection = myFinds[i].texts.item(0);
            //remove the selected text
            myFinds[i].texts.item(0).remove();
            Utility Functions         
    function searchStyle(cStyle, cStyleIndex){
        var myFinds;
        // if script version is for Indesign CS2
        if (app.scriptPreferences.version < 5){                                 
            app.findPreferences = NothingEnum.nothing;
            app.changePreferences = NothingEnum.nothing;
            myFinds = myDoc.search(undefined, undefined, undefined, undefined,
            {appliedParagraphStyle: pStyle, appliedCharacterStyle: cStyle});
        // else, for CS3 and CS4
        }else{                                 
            //Clear any existing find/change settings
            app.findTextPreferences = NothingEnum.nothing;
            app.changeTextPreferences = NothingEnum.nothing;
            // set character or paragraph style to search
            if (cStyleIndex != 0){ 
                app.findTextPreferences.appliedCharacterStyle = cStyle;
            //Set the find options.
            app.findChangeTextOptions.caseSensitive = false;
            app.findChangeTextOptions.includeFootnotes = true;
            app.findChangeTextOptions.includeHiddenLayers = false;
            app.findChangeTextOptions.includeLockedLayersForFind = false;
            app.findChangeTextOptions.includeLockedStoriesForFind = false;
            app.findChangeTextOptions.includeMasterPages = false;
            app.findChangeTextOptions.wholeWord = false;                             
            myFinds = myDoc.findText();
        return myFinds;

    Here is a way you can find any field.
    Download the current template.
    Open it in word and go to the line that you are interested in.
    The blanket PO# will be a field. Right click on it and go to properties. You will see the xml element there.
    Hope this answers your question,
    Sandeep Gandhi

  • Missing XML Element when using asset from library

    This is not really a scripting question but I seem to be unable to find any regular ID forum and it has something to do with a scripting workflow I established for a customer.
    A script places an asset from a library onto a document and then (amongst other things) imports some XML file.
    The asset in the library consists of a number of textframes and has the structure e.g.:
    article
    box
    box
    Now the customer needs new templates (that is assets in the library) and we cannot produce them anymore. It seems that as of CS 3 5.0.4 Adobe changed the behavior of the library. Dragging e.g. two box-tagged boxes with an article parent XML into the library leads to an asset without the article element. Can someone confirm this? And more important is there a reason to it? Or is there a way to configure the behavior?
    I guess I could create a parent xml element by script after placing the element but then I would need to redo all existing libraries.
    Thank you,
    Ralf

    while( testIterator.hasNext() ) {
       Element testElement = (Element)testIterator.next();
       String code = testElement.getChildTextTrim("code");
        if( null == code ) {
               continue;
       String analysis= testElement.getChildTextTrim("analysis");
       //same for description
    }

  • Add XML Element ID to all elements as attribute

    Hi There,
    The title hopefully states what I like to get. I'm having quite some documents that are tagged, but want to add an id to all elements to allow for better XML manipulation outside on Indesign. I've been looking around a bit but seems to be not to many people ever bothered with...
    So, how do I traverse through all my XML elements, and add the element ID as attribute ?
    Thanks,
    Koen

    Hi Koen,
    Please try the below JS code. This code its working fine in InDesign CS5.5.
    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

  • Add xml element error

    I am trying to add a new element to an xml file, I has 5
    existing, so I am trying to add the sixth. but got an error
    message, anyone could help me on this?
    Thanks,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The index of a child element is out of range.
    There are only "5" children under this node.
    Therefore index "6" is out of the allowed range [1-5].
    The error occurred in
    C:\CFusionMX7\wwwroot\myfolder\addNew.cfm: line 18
    16 : newNodePos =
    arrayLen(variables.xml.machii.listeners.listener) + 1;
    17 : // add new node then set it's attributes
    18 :
    variables.xml.machii.listeners.listener[variables.newNodePos]=
    XMLElemNew(variables.xml,"listener");
    19 :
    structInsert(variables.xml.machii.listeners.listener[variables.newNodePos].XmlAttributes, "name","#form.listenerName#",1);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    here the code:
    <cfscript>
    // get array position of next XML child to add
    newNodePos =
    arrayLen(variables.xml.machii.listeners.listener) + 1;
    // add new node then set it's attributes
    variables.xml.machii.listeners.listener[variables.newNodePos]=
    XMLElemNew(variables.xml,"listener");
    structInsert(variables.xml.machii.listeners.listener[variables.newNodePos].XmlAttributes, "name","#form.listenerName#",1);
    </cfscript>

    Did it help? I am using the new jwsdp 1.2 and have a jaxrpc-ri.xml
    like this;
    <webServices>
        <endpoint name="EP1"/>
        <endpoint name="EP2"/>
        <endpointMapping
            endpointName="SyndicationServerEP2"
            urlPattern="/ep1/*"/>
        <endpointMapping
            endpointName="EP2"
            urlPattern="/ep2/*"/>
    </webServices>But after running wsdeploy, in the resulting web.xml only EP2
    is mentioned!
    Any hints?
    Hans

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

    I need to find all XML elements and add a line break to the text of each of them.
    Is this possible with a script?

    I need to go from this ...
    to this...
    but looking for the XML elements (not paragraphs) and then adding text ...
    Thanks for your attention !!!

  • Move xml elements

    Hi,
       I need to create parent element and need to move selected elements into tat.  when doing this, paragraph style getting changed.  Dono wats my mistake there.
    Code :
    AddParentTag(app.selection,"row", elm)
    function AddParentTag(mySel, tagName, parentTg)
            mySel   -   Selection of multiple tags
            tagName -   Name of the parent tag
        var parnt = null;
        if(mySel.length > 0)
             parnt = parentTg.xmlElements.add({markupTag:tagName}).move(LocationOptions.before, mySel[0]);    
            var i = mySel.length;
            if(parnt != null)
                while(i--){    
                    var resTg = mySel[i].move(LocationOptions.AT_END, parnt);                                  
    I want to move the elements without changing style(pstyle) of the contents. Can anyone help me?
    - Sudha K

    I've done some thing like below:
    var Doc = app.activeDocument;
    var Root = Doc.xmlElements.item(0);
    var startElement = [];
    var listElements = ElementsArray()
    var Body = Root.xmlElements.add("body")
    var che = Body.xmlElements.add("ref")
    for(var k=0; k<listElements.length; k++){
            Root.xmlElements.item(listElements[k]).move(LocationOptions.after, )
    function ElementsArray()
        for(var i=1; i<Root.xmlElements.length; i++)
           if(Root.xmlElements[i].markupTag.name =="start")
               var myStartElement = Root.xmlElements[i].markupTag.name
                for(var j=i; j<Root.xmlElements.length; j++){
                    startElement.push (Root.xmlElements[j].markupTag.name)
                     if(Root.xmlElements[j].markupTag.name == "end")
                     return startElement;               
    But here I am getting couple of issue.
    when I use loop to move xml elements it moves all the emements with item name in single iteration So I loose element position while I need to preserve the element position also.
    For reference purpose I have to create an element "ref". since without reference xmlElement can not be moved inside the other elements. Please suggest if there any other way to move the elements.
    Also it throughs an error while moving elements since listElement array contains a number of elements which are already moved

  • Preserve whitespace in XML element value

    I am trying to add XML element with value prefix with white space:
      ex_doc->create_simple_element(
          name = 'VALUEPART1'
          value = '          BQ/XWKB-99-5-9999-2'
          parent = lo_ele_e1bpparex_bape_vbak ).
    But when the XML is create, the white space is removed! How can I preserve the white space???
    <VALUEPART1>BQ/XWKB-99-5-9999-2</VALUEPART1>
    What i want is:
    <VALUEPART1>          BQ/XWKB-99-5-9999-2</VALUEPART1>
    Appreciate for any help

    Hi,
    if you had been using XSLT instead, I would have said 'remove the strip-space element or alter it according to your needs'...
    Please provide what class you are using, else it's too generic..
    regards, Lukas

  • How to find out the page number of an xml element

    Hi everybody, sorry for my very bad english (french guy! logical). I hope you see what I'm looking for.
    I'm scripting (javascript) an exporting script of every articles from a multi-pages indesign script.
    In fact I could have one or more article in one file, every one of them is on an separate xml element. for each I have to export an xml file named with, first, the page number where appears the xml element, second, the number of exported article.
    I'm success the second purpose, but not the first.
    Someone have an idea ?

    Try this,
    var myDoc=app.activeDocument;
    var root = myDoc.xmlElements[0];
    var docTag = root.evaluateXPathExpression('//doc');
    for(i=0; i<docTag.length; i++)
        var docPos = docTag[i].insertionPoints.lastItem();
        var docFrame = docPos.parentTextFrames[0];
        var docPage;
        try
             docPage = docFrame.parentPage;
    catch(e)
            docPage = docFrame.parent.name;
        alert(docPage.name);
    Vandy

  • Remove xml element using JS[CS3]

    Hi, I have an xml structure where i want to remove some paritcular element named "extlink".
    I do have one script with me but it doesn't wipe out all specific xml element from structure.
    var myDoc = app.activeDocument;
    var foundtext = 0
    Query_Remove (myDoc);
    alert ("You have removed " + foundtext + " " +" Link !!")
    exit (0);
    function Query_Remove(elm)
    try
    for(var i=elm.xmlElements.length-1; i>=0; i--)
         if((elm.xmlElements[i].markupTag.name == "extlink") && (elm.xmlElements[i].xmlElements[0].markupTag.name == "http"))
        var Store_CitAttri = elm.xmlElements[i].xmlElements[0].xmlAttributes.item("c_style").value;
         if(Store_CitAttri == "URL")
          elm.xmlElements[i].remove();
         foundtext = foundtext + 1;
       Query_Remove(elm.xmlElements[i]);
    catch (e){
    Some time it skip the element from all figure captions and some time from body text and some time it works perfectly
    Could any one figure it out why this script behaviour is not consistent as i am new to scripting and not getting any idea about this.
    Thanks
    Mac

    Okay, after peering over your code and trying a few things out I see one immediate problem and one possible improvement.
    The problem lies in this:
    1. if condition is true, remove item
    2. check recursively
    The problem is .. if an item is removed, the following recursive check will always fail. However, the entire loop is wrapped into a try..catch, so InDesign will not alert you that it failed. Instead, it will continue with what's after the loop, exactly because the try..catch is around the entire loop!
    Change the loop code to this
    if((elm.xmlElements[i].markupTag.name == "http") && (elm.xmlElements[i].parent.markupTag.name == "extlink"))
        var Store_CitAttri = elm.xmlElements[i].xmlAttributes.item("c_style").value;
        if(Store_CitAttri == "URL")
          elm.xmlElements[i].remove();
           foundtext = foundtext + 1;
           continue;
    Query_Remove(elm.xmlElements[i]);
    so the recursive checking is skipped. You can also remove the entire try..catch block, as this may hide additional errors ...
    The improvement is: as I started reading this thread from the top again, shouldn't you be removing the "extlink" items, rather than just the "http" ones inside?
    If so, remove the parent of the found item (which is always the "extlink"):
          elm.xmlElements[i].parent.remove();
    -- and, as this will break the loop (because you just removed the set of elements it was working in!), replace 'continue' with 'return'.
    Hope this helps

  • Carriage Returns and Tabs in XML element

    I have a number of carriage returns and tabs within an xml element. When I take that element I would like it to transform to html in which I am then displaying within a JEditorPane. However, when I do this it is one long string. I have tried the xml:space="preserve" within that element and this still is not working.
    Here is part of the xml with the carriage return line feeds. The element that I am talking about is called pseudocode. You can see it is displayed correctly below.
    Design Document XML : <?xml version="1.0" encoding="ISO-8859-1"?><design-doc><title-page><title>Testing Document</title><class-prepared-for>Lloyd</class-prepared-for><authors>Ben Garbers</authors><date-created>September 23, 2004</date-created></title-page><introduction text="This is the introduction. This is the introduction."/><class-definitions><class-definition class-name="ClassOne" visibility="public" class-complexity="not complex"><global-variables><variable visibility="public" name="VariableOne" object="String" comments="This is a String."/><variable visibility="public" name="VariableTwo" object="Integer" comments="This is an Integer."/></global-variables><methods><method name="MethodOne" synopsis="This will do some things." purpose="public" visibility="public"><input-parms><variable visibility="null" name="firstName" object="String" comments="null"/></input-parms><output-parms><variable visibility="null" name="lastName" object="String" comments="null"/></output-parms><local-variables><variable visibility="null" name="age" object="int" comments="null"/></local-variables><pseudocode xml:space="preserve">/* Ensure that player name exist in the system*/
    if (player =null)
         NullPlayerException;
              if (NOT (isPlayerNameExist(player)))
                   throw PlayerNameNotExistException;
              /* Ensure player name exist in the team already*/
              i ? 1;
              while (i <= length(mPlayers)) {
                   if (mPlayers.mPlayerName != playerName)
                        throw PlayerNameNotExistInTeamException;
    this.mPlayers ? this.mPlayers - player;</pseudocode>
    However, when I do the transformation I get the following with the pseudocode:
    /* Ensure that player name exist in the system*/if (player =null)     NullPlayerException;          if (NOT (isPlayerNameExist(player)))               throw PlayerNameNotExistException;          /* Ensure player name exist in the team already*/          i ? 1;          while (i <= length(mPlayers)) {               if (mPlayers[i].mPlayerName != playerName)                    throw PlayerNameNotExistInTeamException;}this.mPlayers ? this.mPlayers - player;
    It looks like it adds some spaces but no carriage returns or line feeds.
    My transformation code is the following:
         public ParseFile(String xmlString) {
              try {
              //Here we will load the correct style sheet for the message
              //that will be formatted.
              String urlString = "DesignDocument.xsl";
              URL url = this.getClass().getResource(urlString);
              System.out.println("URL to style sheet = " + url.toString());
              String styleSheetName = url.getFile();
              System.out.println("Style sheet name : " + styleSheetName);
              InputStream styleSheetInputStream = this.getClass().getResourceAsStream(urlString);
              //We will than load our SAXParerFactory and parse the message.
              SAXParserFactory SPFactory = SAXParserFactory.newInstance();
              SPFactory.setValidating(true);
              SAXParser sp = SPFactory.newSAXParser();
              XMLReader sax2parser = sp.getXMLReader();
              //NO Validation done on for this because we do NOT have a DTD.
              sax2parser.setFeature(
                   "http://xml.org/sax/features/validation",
                   false);
              sax2parser.setContentHandler(new FileContentHandler());
              //we create a character array of the length of the xml message String
              char[] messageCharacterArray =
                   new char[xmlString.length()];
              // we then put the xml string into the character array.
              messageCharacterArray = xmlString.toCharArray();
              // after this ew end up creating a CharArrayReader that will be used by the Sax
              // parser to parse the xml.
              CharArrayReader xmlCharArrayReader =
                   new CharArrayReader(messageCharacterArray);
              // we put the xml character array within the Input Source which will then be parsed
              // by the Sax2 parser.
              InputSource in = new InputSource(xmlCharArrayReader);
              // Use a Transformer for outputting the message into our formatted xml using
              // the stylesheet defined up in a messages own sxl stylesheet file.
              TransformerFactory tFactory = TransformerFactory.newInstance();
              tFactory.setURIResolver(new BasicURIResolver());
              StreamSource stylesource = new StreamSource(styleSheetInputStream);
              Transformer transformer = tFactory.newTransformer(stylesource);
    //          transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    //          transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
    //          Properties properties = new Properties();
    //          properties.setProperty("indent", "yes");
    //          properties.setProperty("{http://xml.apache.org/xslt}indent-amount", "2");
    //          transformer.setOutputProperties(properties);
              // We will use a ByteArrayOutputStream to put our transformed xml.
              ByteArrayOutputStream bos = new ByteArrayOutputStream();
              StreamResult result = new StreamResult(bos);
              SAXSource source = new SAXSource(in);
              transformer.transform(source, result);
              String s = bos.toString();
              StringBuffer sb = new StringBuffer();
              //This will make sure the Version Line is not shown.
              BufferedReader br = new BufferedReader(new StringReader(s));
              String line = "";
              while ((line = br.readLine()) != null) {
                        sb.append(line);
              bos.close();
              br.close();
              formattedXmlString = sb.toString();
              System.out.println("--------------------------------");
              System.out.println(formattedXmlString);
              System.out.println("--------------------------------");
              } catch (Exception e) {
                   e.printStackTrace();
    I have been searching and trying to figure this out forever. Any help would be greatly appreciated. Bottom line is that I want carriage returns and tabs to work when transferring from the xml to xsl.

    I get the following line when adding the <pre> tags.
    /* Ensure that player name exist in the system*/if (player =null)     NullPlayerException;          if (NOT (isPlayerNameExist(player)))               throw PlayerNameNotExistException;          /* Ensure player name exist in the team already*/          i ? 1;          while (i <= length(mPlayers)) {               if (mPlayers[i].mPlayerName != playerName)                    throw PlayerNameNotExistInTeamException;}this.mPlayers ? this.mPlayers - player;
    On the screen this is shown on 1 line. It looks like the tabs are working correctly. However, the carriage return, line feeds do not seem to be working. The xml that is pushed into the transformation has the carriage returns and line feeds and is formatted correctly. There has to be something happening when the xsl takes the xml String. When I add <BR></BR> within the xml that doesn't seem to work either.
    I am really sumpted. If you could help DrClap I would really be appreciated.

  • Remove XML element with JAXB

    Hi all,
    does anyone knows if it's possible to remove an xml element after that element has been set ? Using only jaxb if possible and not using other technology, for example DOM.
    I explain:
    umarshall car -->setOwner("me"); setSpeed("80"); -->marshall car
    will result into:
    <car>
    <owner>me</owner>
    <speed>80</speed>
    </car>
    I would like something that for example
    unmarshall car -->remove(speed); ....-->marshall car
    would result into:
    <car>
    <owner>me</owner>
    </car>
    could someone point out a way to do that ?
    thanks in advance...

    Okay, after peering over your code and trying a few things out I see one immediate problem and one possible improvement.
    The problem lies in this:
    1. if condition is true, remove item
    2. check recursively
    The problem is .. if an item is removed, the following recursive check will always fail. However, the entire loop is wrapped into a try..catch, so InDesign will not alert you that it failed. Instead, it will continue with what's after the loop, exactly because the try..catch is around the entire loop!
    Change the loop code to this
    if((elm.xmlElements[i].markupTag.name == "http") && (elm.xmlElements[i].parent.markupTag.name == "extlink"))
        var Store_CitAttri = elm.xmlElements[i].xmlAttributes.item("c_style").value;
        if(Store_CitAttri == "URL")
          elm.xmlElements[i].remove();
           foundtext = foundtext + 1;
           continue;
    Query_Remove(elm.xmlElements[i]);
    so the recursive checking is skipped. You can also remove the entire try..catch block, as this may hide additional errors ...
    The improvement is: as I started reading this thread from the top again, shouldn't you be removing the "extlink" items, rather than just the "http" ones inside?
    If so, remove the parent of the found item (which is always the "extlink"):
          elm.xmlElements[i].parent.remove();
    -- and, as this will break the loop (because you just removed the set of elements it was working in!), replace 'continue' with 'return'.
    Hope this helps

Maybe you are looking for

  • Show Web Dynpro as a Pop up on CRM Web-gui from ABAP Call

    Hello Everybody, i have a created a Web Dynpro Application in Z'* naming Space and want to show this WD as a POP up on the CRM Business Partner. Step by Step Description of what I have done. 1) Want to change the Business Partner Addresse on CRM page

  • Data in cube is different from psa in the production system

    hi friends this is very urjent ,the data is fine and  same as r/3 in psa.for example i have sales for one article ie billing 2lis_13_vditm . which picked the data from r/3 when i see the records in the psa they r good when tried to see the same recor

  • Any ideas on why Final Cut Pro won't install?

    I tried to load in my version 6.0 of Final Cut Pro Academic into my computer at my music school and at the point when I loaded in the disk after "Audio Content 3", I think it was "Studio Pro Content" or "Motion" disc (sorry I can't remember which dis

  • Error when i copy the elements of cube essbase 9.3.1(otl.rul..) in 11.1.2.1

    Someone you have any idea how to copy files essbase otl, rul, dbb ... v9.3.1 to the 11.1.2.1? I try to do but my application in essbase target (11.xx) fails to start. I have an error return Thank you in advance

  • CS5 print booklet

    I have documents that were created in CS3 and printed perfectly that now won't print as a booklet in CS5. My most recent document appears correctly on screen but pulls various pages together to print rather than organising itself to print as it appea