Add xml Tags in Indesign CS4 by Apple/Java script

Hi,
All, I'm new to Indesign Scripting, and I'm hoping someone can help me with the following add xml tags in my xml indesign cs4 files.
I have IDML (ETMV2) xml Indesign CS4 files. But i have lots of powermath equation without xml tags. So i want how i can insert xml tags.
My probleam like this =>
<no open xml tags>[&x^{2}+y_{3}&]<no close xml tags>
I want like this (But i do manualy)
<inlineequation><inlinemediaobject><textobject role="xpressmath">[&x^{2}+y_{3}&</textobject></inlinemediaobject></inlineequation>
Can anyone write/suggest me how i can add xml Tags. By Apple/Java Script
Any insight is appreciated!
snegig

Hi,
John Hawkinson thank you so much your suggestion.
I am new  this type of discusion (on this page). So i think anybody could not replay my answer. So i repost my question.
I want insert tags in my Indesign CS4 files. Is this posible when i select my powermath equaiton then run script. Script add tags automatically before/after my equation. Please ignore IDML word.
Yes i an comfortable with XSLT presently i working with Pearson ETMV2.
I have one more question when i past my snapshot its appear properly but when i agin see my commant then my snapshot disappear (see small blue rectangle).
Thank you John again i am new in this industry please guide.
snegig

Similar Messages

  • Edit JS Script CS4 (Add XML Tags All pages automatically)

    Hi, all Scripter
    I have a javascript for add xml tags (ETMV2 Pearson, InDesign CS4).  We have select my powermath equation data then run script. Script automatically insert xml tags both side (open/close). But we select one by one then run script its time taking.
    var d=app.activeDocument,
    root=d.xmlElements[0],
    ie = root.xmlElements.add("inlineequation", app.selection[0]),
    im = root.xmlElements.add("inlinemediaobject", ie.texts[0]),
    to = root.xmlElements.add("textobject", im.texts[0]);
    to.xmlAttributes.add("role", "xpressmath");
    Example 1: My powermath equation data (InDesign CS4)
    [&x^{2}+y *frac*{1}{2x}&]
    Select powermath equation data then run javascript below mention. Script insert xml tags.
    <inlineequation><inlinemediaobject><textobject>[&x^{2}+y *frac*{1}{2x}&]</inlineequation></inlinemediaobject></textobject>
    Its time taking and select one by one
    Result:
    My main concern is that is this possible script find open [& and close &] all poermath equation data automatically then insert (add) xml tags all pages.
    Thank/Regard
    snegig

    Hi,
    John Hawkinson thank you so much your suggestion.
    I am new  this type of discusion (on this page). So i think anybody could not replay my answer. So i repost my question.
    I want insert tags in my Indesign CS4 files. Is this posible when i select my powermath equaiton then run script. Script add tags automatically before/after my equation. Please ignore IDML word.
    Yes i an comfortable with XSLT presently i working with Pearson ETMV2.
    I have one more question when i past my snapshot its appear properly but when i agin see my commant then my snapshot disappear (see small blue rectangle).
    Thank you John again i am new in this industry please guide.
    snegig

  • Add xml Tags by Apple/Java script

    Hi,
    All, I'm new to Indesign Scripting, and I'm hoping someone can help me with the following (add xml) problem.
    Can anyone write/suggest me how i can add xml tags. By Apple/Java Script
    My Probleam =>
    [&x+2, y+3&]
    Solution => (But its manual)
    <inlineequation><inlinemediaobject><textobject role="xpressmath">[&x+2, y+3&]</textobject></inlinemediaobject></inlineequation>
    I want add xml tags on my powermath equaiton. Its ETMV2 xml tags.
      Any insight is appreciated!
    Thank you so much
    snegig

    Hi John,
    (1) Without xml tags my InDesign file
    (2) After add tags my file (its manually)
    Is this any script when i select my power math equation data then add xml tags automatically
    Thank's any suggestion

  • InDesign crashes when I add xml tag

    I have some groups (image + text) inside text.
    When I try to add xml tags with a grep query InDesign crashes.
    If I try to manually add xml tag to the text in a group, for example "evitare l'umidità", InDesign give me a message error.
    I think it's a bug
    Here there is the document Dropbox - ProblemaTag.idml
    Thanks
    Ivan

    I haven't done a Book in CS6 yet, but I'm starting to wonder if there might be some sort of bug (not extremely likely, but....) that's new. We had another post yesterday where ID crashed when trying to move a particular file into the chapter 5 position.
    Can you add this file first, then move it to the correct spot after the other files are added?

  • Unused XML Tags in InDesign CS2.....

    Hi all,
    Using Javascript i need to generate a report for all unused XML Tags in InDesign CS2.
    Please help it is very urgent...
    Thanks in advance...
    Regards
    Subha

    Hi,
    John Hawkinson thank you so much your suggestion.
    I am new  this type of discusion (on this page). So i think anybody could not replay my answer. So i repost my question.
    I want insert tags in my Indesign CS4 files. Is this posible when i select my powermath equaiton then run script. Script add tags automatically before/after my equation. Please ignore IDML word.
    Yes i an comfortable with XSLT presently i working with Pearson ETMV2.
    I have one more question when i past my snapshot its appear properly but when i agin see my commant then my snapshot disappear (see small blue rectangle).
    Thank you John again i am new in this industry please guide.
    snegig

  • Add XML tag (all power math equation) after/before

    Hi all,
    I have JS code written by (Sir John Hawkinson "http://forums.adobe.com/thread/938603?tstart=90") its work fine. Actually script do add XML tags [&x+2&] after/before this power math equation.
    My problem when i run this script i am select matter (power math equation) one by one is that possible when i select few paragraph script add automatic xml tags select all "power math equation" matter.
    script code below:
    var d=app.activeDocument,
        root=d.xmlElements[0],
        ie = root.xmlElements.add("inlineequation", app.selection[0]),
        im = root.xmlElements.add("inlinemediaobject", ie.texts[0]),
        to = root.xmlElements.add("textobject", im.texts[0]);
    to.xmlAttributes.add("role", "xpressmath");
    Thank's
    Regard
    snegig

    Hello Sir,
    That time you suggest lots of possibility this script code. But 2 and 3 month i am very new in (InDesign, JS and my first jobs) so i have heavy workload so.
    I am really sorry once again could you any change/update this code.
    Thank you so much once again
    Regard
    snegig

  • Need to add xml tag in the request message

    Hello Experts,
    Need ur help.
    Right now i am working on the scenario Http -> to -> Proxy.
    Whatever request i am getting is not having XML tag in it, and because of that my mapping is failing.
    Can you tell me that how can i add XML tag in my request so it will not fail in Mapping?
    Need to add : <?xml version="1.0" encoding="UTF-8"?> in request.
    Thanks,
    Hetal

    HI Hetal
    Instead of adding this to the source message. Remove this tag from mapping.
    Use a XSLT mapping without this initial tag. it will work.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://namespace">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
    <xsl:template match="/">
    <xsl:for-each select="//tag">
    <xsl:value-of select="." disable-output-escaping="yes"/>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Use this mapping without
    <?xml version="1.0" encoding="UTF-8"?>
    If you still see XML tag then use
    <xsl:output method="html"
    instead of
    <xsl:output method="xml"
    Thanks
    Gaurav

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

  • How to reveal XML tags in InDesign CS5.5?

    I'm trying to tag a business catalog for an XML export. I've never done it before - but our sister company has done the same task with a similar catalog. I can view their catalog in InDesign CS5.5 for Windows over a VPN connection in order to see how they tagged their catalog.
    I'm doing this task on a Mac using InDesign CS4. The interfaces are not the same. The biggest problem is the sister company is in Czech and so is InDesign. I need to open the tags pane. On the Mac, its just "Window>>Tags." There is a "Window" (Okna) menu, but I'm not seeing a "Tags" choice. I have the structure open, but I want to see all the little colored tags. How do I reveal these on the Windows CS5.5 version?
    Thanks

    Wouldn't it be View > Structure > ... ?

  • Add xml tag to specific words in a text frame

    Dear all,
    I'm pretty sure this can't be too much of a hassle, but after hours of experimenting, searching and reading I can't seem to look at it from the right angle. I'm trying to find a way to search for a specific word ('Figure', in my case) in a given text frame, and add a corresponding XML tag to it automatically. I've found plenty of information on how to apply it to a page item as a whole, but from there no approach seems to work. Seeing as I'm fairly new to InDesign scripting, any nudge in the right direction would be an immense help.
    Kind regards and thanks in advance,
    Julian

    Hi Julian,
    Is this you asking?
    var doc = app.activeDocument;
    app.findTextPreferences.findWhat = "figure";
    var found = doc.findText();
    for(var i =0;i<found.length;i++)
            doc.xmlElements[0].xmlElements.add({markupTag:"figure", xmlContent:found[i]});
    Regards,
    Chinna

  • Add XML Tag to XML File (Idoc to XML File)

    Hi there.
    Just a question regarding the addition of a tag header in an XML file please?
    Idoc - > XI -> file (XML File)
    We have a need to add something like this below in bold to XML Tag Header in the inbound file:
    <?xml version="1.0" encoding="UTF-8"?>
    <?POSTEN SND="SE03220037090" SNDKVAL="1" REC="SE03220669500"
    MSGTYPE="ORDERS"?>
    Any ideas on how this can be managed would be apreciated please?
    Thank you.
    Mick.

    Hi Carlos.
    Thanks for your reply. I like what you are suggesting, however, I have no knowledge of Java and how to implement this Java addition to the mapping interface.
    I would appreciate any hints you may have. The value that I am trying to add to the tag header is exactly as it is below(the value in bold) and it can in fact be fixed, i.e. I am not looking to dynamically determine the values in the additional tag but just add the value as it is below...
    <?xml version="1.0" encoding="UTF-8"?>
    <?POSTEN SND="SE03220037090" SNDKVAL="1" REC="SE03220669500"
    MSGTYPE="ORDERS"?>
    I would appreciate any input from you on that.
    Thanks in advance Carlos.
    Mick.

  • Search for, edit, and delete XML tag (Adobe InDesign Server CS5)

    Hi all,
    I'm working with Indesign Server CS5 and JavaScript, though having some trouble coming up with a solution to a problem...
    I need to build a JS script (called through SOAP) that will enable me to search an InDesign file for a given XML tag.
    Upon finding the XML tag, if the 'action' variable is set to delete, it should delete the tag and its contents.
    If the action is set to edit, it should change the contents of the tag to some user-specified content.
    The primary caveat is that the XML tag is variable, as is the XML structure of the InDesign file.
    Here's what I have in mind, in pseudocode:
    function findXMLTag(tag, action) {
         app.searchForTag(tag);
         if (tagIsFound) {
              if (action == "delete") {
                   tag.delete;
              } else if (action == "edit") {
                   tag.contents = "Updated content";
    Any help would be greatly appreciated!
    Thanks,
    Ben Kay

    'searchForTag' can be implemented as a recursive function.
    Recursion is defined like this: I thought, "I'll just search this forum for 'recursion'." The first post I found was one of my own, suggesting that the poster should search the forum for 'recursion'.
    Here is an example: find the XML Element [<email>]
    And another: Remove xml element using JS[CS3] (read carefully, as the OP got stuck on how to successfully remove an element and continue)
    And one, using XML Rules -- which I'm totally unfamiliar with, but may work for you: Changing Values in XML tags

  • Cannot add ruler guides in InDesign CS4. What am I doing wrong?

    I'm trying out InDesign CS4 on a trial basis. I have the Web Design CS3 suite and have no problem making ruler guides by clicking and dragging from a ruler. I'm wondering if there is a conflict between CS3 and CS4 products. I can't select the Selection or Direct Selection Tools by clicking on them. They do become active, however, if I use the keyboard shortcuts (V) or (A).  According to the 1-on-1 tutorial, my Selection Tool cursor should change from black to white when the guide snaps to an existing margin. My cursor turns white as soon as a click on the ruler. When I drag, nothing happens. When I release the mouse button, the cursor turns black again. With the Direct Selection Tool, the cursor remains white throughout the entire attempt. Nothing happens in either situation. This is a simple, getting started doc. There is only one layer, I'm in Normal view, and I have created margins and columns that are visible. I can select Baseline and Document grids and they work. Is this a bug or am I missing something?
    P.S. I've tried to attach the InDesign file (840 kb), but got the message, "The content type of this attachment is not allowed." Sheesh!

    You were right in your original assessment; it was a corrupt installation. There were several other things not functioning as designed. I just came upon the guides problem first. BTW, I found that if I expanded the document to where it covered the entire screen, the guides were visible. Unfortunately, the tool box and menus are covered, so that was a bit inconvenient. Just wanted to say thanks and tip my hat to you and the others who responded by offering help.
    One last thing, when I posted my original posting, I tried to attach the InDesign doc file I was working on and got a pop-up window saying that these type of files are not allowed. Am I to understand that you can't post InDesign files on the Adobe forum?

  • How to read value within XML Tag data using IO Stream in Java

    We have xml data into a Stream and we need to extract values again into a Stream from the particular XML tag <Data> inside the Stream. PFB the sample XML which will be contained inside the stream and can someone help us to hint the java code for this. We require it using the IO API only and we need to look <DATA> for the begining of the stream and </DATA> as the end of the stream.
    Please note that input is stream and output require also is a stream.
    <?xml version = "1.0" encoding="UTF-8" ?>
    <GenericDataEnvelope>
    <DataFormat>PlainText</DataFormat>
    <Name>1111</Name>
    <Security>NA</Security>
    <senderName>abc</senderName>
    <Protocol>HTTP</Protocol>
    <Data>
    SElQRlhDVElQRlBCTktERUZGMDYxMDAyMDc0MzUyMDAwMTA2MTAwMjA3NDM1MlRDSEFTVVMzMzAw
    MDAwMDAwMDAwMTc4LDEyMDAwMTc4MTIKezQ6TVQxMDM6CjoyMDowMDYwMDQ5MjQxMDA2NzcwCjoy
    M0I6Q1JFRAo6MjNFOlNEVkEKOjMyQTowNjEwMDVDQUQwLDAxCjozM0I6RVVSMCwwMQo6MzY6MSwz
    TNzcwQU5WLVJFTlRFIE9DVCAwNgowLDAxLzEsMTcxOQo6NzFBOlNIQQo6NzI6L1JFQy84NDM2MTU3
    MTA2Ci19ClRJUEYK
    </Data>
    <DataType>INVOICE</DataType>
    </GenericDataEnvelope>

    The example you've showed is valid and it is also text.
    Think seriously about this ... for example, do you have a rule that says </DATA> can't appear in the binary data?
    But in any case I can't see the problem. If you want to use IO classes directly, just read lines until you see <DATA>, then read data until it ends with </DATA>, and remove that.
    But I would certainly use SAX myself until proven otherwise that it won't work..

  • Add XML tag to the XML output File

    Experts,
    My Scenario is JDBC to File
    For the resultant xml file i have to append a line <?Test Line?> after
    <?xml version="1.0" encoding="UTF-8" ?> while passing it to legacy system ?
    From SDN I found that a XSLT Mapping(as second mapping in the Interface mapping) will do the above requirement,
    I got some XSLT Code from SDN to do this
    1) 
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" />
      <xsl:template match="/">
    <!--  add processing instruction -->
      <xsl:processing-instruction
    name="POSTEN">SND="SE03220037090" SNDKVAL="1" REC="SE03220669500" MSGTYPE="ORDERS"</xsl:processing-instruction>
    <!--  copy payload -->
      <xsl:copy-of select="." />
      </xsl:template>
      </xsl:stylesheet>
    2) 
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" />
      <xsl:template match="/">
    <!--  add processing instruction -->
      <xsl:processing-instruction
    name="POSTEN">SND="SE03220037090" SNDKVAL="1" REC="SE03220669500" MSGTYPE="ORDERS"</xsl:processing-instruction>
    <!--  copy payload -->
      <xsl:copy-of select="." />
      </xsl:template>
      </xsl:stylesheet>
    But none of them worked for me, the additional tag does not appear on the o/p xml file
    Any help would be appreciated
    Srinivas

    Hello Srinivas,
    I had achieved the same using java mapping:
    Suppose your XML structure is:
    <?xml version="1.0" encoding="UTF-8" ?>
    <Root Element>----
    </Root Element>
    you can use the following code:
              import java.io.*;
              import java.util.*;
              import com.sap.aii.mapping.api.*;
              public class AddCommentInXML implements StreamTransformation {
              String record=null;
              String comment=null;
              public void execute(InputStream in, OutputStream out) {
              try {
              DataInputStream stdin = new DataInputStream(in);
              int length = getLengthFromStream(stdin);
              stdin.reset();
              byte[] buffer = getBytesFromStream(stdin);
              String str = new String(buffer);
              record = "<Root Element>";
              comment ="<!Test Line><Root Element>";
              str = str.replaceAll(record,comment);
              out.write(str.getBytes());
              out.close();
              } catch (IOException e) {
              public int getLengthFromStream(InputStream is ) throws
              IOException{
              int i = 0;
              int length = 0;
              try{
              while ((i = is.read())> 0){
              length ++;
              }catch (ArrayIndexOutOfBoundsException e) {
              e.printStackTrace();
              return length;
              public byte[] getBytesFromStream(InputStream is) throws
              IOException {
    //             Create the byte array to hold the data
              byte[] bytes = new byte[getLengthFromStream(is)];
              is.reset();
    //             Read in the bytes
              int offset = 0;
              int tmp = 0;
              while (offset < bytes.length
              && (is.read(bytes, offset, offset +
              (tmp = is.available()))) > 0) {
              offset += tmp;
    //             Ensure all the bytes have been read in
              if (offset < bytes.length) {
              throw new IOException("Could not completely read Inputstream");
    //             Close the input stream and return bytes
              is.close();
              return bytes;
              public void setParameter(Map param) {
    Hope this helps.
    Regards,
    Shweta

Maybe you are looking for

  • HT204266 How to install an epson stylus nx230 printer on my iPad?

    How do I install a wireless printer for my iPad?

  • How to divide one catalog into two?

    I have a question that I can not find an answer to and hope I can get the help here. Lightroom 5. I have one catalog now and would like two.  The reason is I have two things that I shoot.  I do studio work for my clients and also do landscape photogr

  • PSE 8 Serial Number Keeps Expiring

    The serial number in PSE 8 keeps expiring.  When I launch the program, it comes up with a software setup box which asks for the serial number.  When I put in the serial number, it gives a red X and will not take it.  I then have to uninstall the soft

  • Similar functionality to Google/Outlook Calendar advice required

    Hi all, I have built an Apex app that is used to create jobs and assign them to an engineer. It is a straightforward app and we are now looking at adding some new functionality, specifically I have been asked to provide a diary type view of the jobs

  • Saving and other issues

    For whatever reason, it seems like every application on my 10.5.5 macbook is having trouble saving. For example, itunes give me and error about not being able to autosave the library, final cut can't render sometimes saving there is already a file wi