Indesign Comparing XML Structure

Can Anyone help me ?????
I have wasted a lot time in this query with no result please help me to achieve my desired output.
i want to display all XmlAttributes of a xml structure in a TextFrame of indesign CS4 that match the following conditions :-
1) for a selected Character Style ( KT), XmlAttribute of one document(i.e CHAPTER ) must have same value as other document(GLOSSARY) that is being compared. then keywords with same id & olinkend would be displayed in a text frame.
snapshot 1 shows chapter with highlighted keyterm & its olinkend (which to be used for comparison).
snapshot 2 shows Xml Structure of Glossary with highlighted glossentry & its id
Snapshot 3 shows Xml Structure of chapter(containing keyterm its olinkend)
Snapshot 4 shows Xml Structure of chapter(containing glossary)
in above snapshot pathology,etiology,pathogenesis,infection and disease have same olinkend(keyterm in chapter) and id (glossentry in glossary) but Human Microbiome Project  do not have different id & olinkend so its not a keyterm. it should not be displayed in text frame with  keyterms but somehow it is tagged wrongly as KT .we dont want it to b displayed.
my text frame displayed it as
i want a javascript code to display only keyterms in a text frame( in active document i.e. chapter )where keyterm olinkend = glossentry id and finally save the data to excel file .
i have taken this code from ADOBE FORUM plz modify this to achieve my output.
var myDc =app.activeDocument;
var mySty = myDc.characterStyles.everyItem().name;
var myDia = app.dialogs.add({name:"Character Style Display Menu", canCancel:true});
     with(myDia.dialogColumns.add()){  
          with(borderPanels.add()){
               with(dialogColumns.add()){staticTexts.add({staticLabel:"Select Character Style:  "});}
                    with(dialogColumns.add())
                                                            var SelSty = dropdowns.add({stringList:mySty, selectedIndex:0});}
var myRes = myDia.show();
if(myRes==true)
      var myChoice = mySty[SelSty.selectedIndex];
            myDia.destroy();
else
{ exit();}
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedCharacterStyle = myChoice.toString();
var myFind = app.findText(false).reverse();
for(var a=myFind.length-1; a>=0; a--){
     var  myString= myFind[a];
     var myPg = myString.parentTextFrames[0].parent.name;
     var myCon = myString.contents;
     app.selection[0].insertionPoints[-1].contents = String(myCon+"\t"+myPg);
     app.selection[0].insertionPoints[-1].contents = "\r";
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
if(myCon==null)
                                                  alert("Character Style not found");
HOPE YOU WILL UNDERSTAND MY QUERY.
THANX
WAITING FOR REPLY.

Could Peter or someone move this to the scripting forum, please?

Similar Messages

  • Comparing Xml in a Text Field

    We have a Text field which saves Xml data (not too big, 20 to 40 lines usually), in one of the stored procedures, we are receiving the Xml, which needs to be either inserted or updated based on whether that record already exists in table or not. We are doing
    that match based on other non-xml fields but in one case we don't have any other option but to compare xml, so here is my question.
    What's the most performance efficient way to compare Xml (which is passed as input parameter to SP as Text) to the one already saved in Table as Text? We are running Sql 2005.
    Thanks
    Syed

    Hi Syed_Sajid,
    Regarding your description, are you looking for approach to compare xml structured TEXT fields? If so, you can reference the below sample.
    DECLARE @Tab TABLE(id INT, content TEXT)
    INSERT INTO @Tab SELECT 1,'<catalog>
    <book>
    <author>Gambardella, Matthew</author>
    <title>XML Developer''s Guide</title>
    <genre>Computer</genre>
    <price>44.95</price>
    <publish_date>2000-10-01</publish_date>
    <description>An in-depth look at creating applications
    with XML.</description>
    </book>
    </catalog>'
    DECLARE @XML1 XML,@XML2 XML;
    SELECT @XML2= content FROM @Tab WHERE id=1
    SET @XML1 = '<catalog><book>
    <author>Corets, Eva</author>
    <title>Maeve Ascendant</title>
    <genre>Fantasy</genre>
    <price>5.95</price>
    <publish_date>2000-11-17</publish_date>
    <description>After the collapse of a nanotechnology
    society in England, the young survivors lay the
    foundation for a new society.</description>
    <extra>a</extra>
    </book>
    </catalog>'
    ;WITH XML1 AS
    SELECT T.N.value('local-name(.)', 'nvarchar(max)') AS NodeName,
    T.N.value('.', 'nvarchar(max)') AS Value
    FROM @XML1.nodes('/catalog/book/*') AS T(N)
    XML2 AS
    SELECT T.N.value('local-name(.)', 'nvarchar(max)') AS NodeName,
    T.N.value('.', 'nvarchar(max)') AS Value
    FROM @XML2.nodes('/catalog/book/*') AS T(N)
    SELECT ISNULL(XML1.NodeName, XML2.NodeName) AS NodeName,
    XML1.Value AS Value1,
    XML2.Value AS Value2
    FROM XML1
    FULL outer join XML2
    ON XML1.NodeName = XML2.NodeName
    WHERE ISNULL(XML1.Value, '') <> ISNULL(XML2.Value, '')
    The different nodes between two xmls will be listed in the result above.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Indesign Javascript and xml structure

    Hi to all
    I am new to program javascript in Indesign, and I am looking for some example on how modify the xml structure inside a document using a javascript script.
    i.e.
    if I have a structure like this in the original document:
    root
    section
    tag1
    tag2
    tag3
    I need to transform it in this way( this is just an example, may be more complex):
    root
         section
              tag1
              tag2
              tag3
    Any help on where or how to solve this is very appreciate.
    Thanks a lot

    I think the MoveXMLElement.jsx script there shows pretty well what's involved. Here's something that addresses something closer to your example:
    var root = app.activeDocument.xmlElements[0];
    root.xmlElements.item("tag1").move(LocationOptions.AT_END, root.xmlElements.item("section"));
    root.xmlElements.item("tag2").move(LocationOptions.AT_END, root.xmlElements.item("section"));
    root.xmlElements.item("tag3").move(LocationOptions.AT_END, root.xmlElements.item("section"));
    You want to be careful about the order you do things and when you grab references to the xml structure objects, since you're changing them as you go (i.e. root.xmlElements[3] might refer to tag3 when you start, but will be invalid once you start moving things into section).
    If the xml structure in your InDesign document is the result of an xml import, you might consider transforming the xml as you import it. It's faster and more natural there.
    Hope that helps,
    Jeff

  • [CS3 JS] Is it possible to export just the XML structure?

    Hello,
    I am using scripts to find various objects in an InDesign document and tagging them.
    I will then want to export the XML structure but not any of the content. I'm just learning XML and do not see a way to do this.
    Thanks,
    Tom

    Share/export using QuickTime to an audio only codec such as MP3.

  • Convert IDOC XML structure to flat file - and now?

    Hi,
    we are working with input message ORDERS05 and want to convert it to flat file.
    So we used the implementation description from "how to convert an IDOC-XML structure to a flat file....".
    Looks like this is a standard procedure described here fitting for all IDOCs.
    We followed the guide, making XI ready for Abap-Mapping, implemented the Abap class like described, added an interface mapping with source ORDERS05 to a mess.type dummy destination, added with type Abap-class the class implemented from the guide and completed the Int.Dir. implementation.
    For comparism purpose we have two systems as receiver, one with a standard flat file with regular graph.mapping in XI, one with the Abap mapping.
    Result:
    Error description in SXMB_MONI:
    Didn´t expect something like that! The IDOC was delivered successfully to the other simple flat file receiver.
    Any idea what we made wrong (we are on SP17) or if there is a standard mistake you can do when following the guide?
    Best regards
    Dirk

    Hi,
    I've got the same problem. He the solution in my case:
    The problem is:
    My IDOC has no element <STDMES>, but the method IF_MAPPING~EXECUTE from the 'HOW-TO Guide' does not check this situation:
    el_element = idocument->find_from_name('STDMES').
    ls_edidc-stdmes = el_element->get_value().
    thows the exception.
    Solution:
    make shure that the field STDMESis set or change the method to:
    el_element = idocument->find_from_name('STDMES').
    if not el_element is initial.
        ls_edidc-stdmes = el_element->get_value().
    endif.
    Best regards
    Dieter

  • Missing images - "XML structure element, not in layout"

    I'm putting together handouts for several classes, which largely consists of copying and pasting text from Microsoft Word into InDesign CS5. Images I am placing manually. After re-organizing some of my files, one of my documents is now missing 118 links to images. However, none of these images are actually in my document - in the Links panel, each image says:
    "XML structure element, not in layout"
    Here's a screenshot of my links panel:
    These images are not supposed to be in the document at all. Clicking "Go To Link" does nothing. Is it possible that copy and pasting text from Word could have also copied the images in the Word document as well, without actually placing them on the pages? They now seem to be stuck in some kind of InDesign limbo.
    The only way I was able to get rid of them was to delete elements from the XML structure panel, however this deletes the content from my pages, which is not exactly helpful. Is there some way to just remove all of the missing image links from my document? Many thanks for any help!

    I was able to solve my problem. After displaying the Structure panel, I apparently had tons and tons of XML elements in the XML structure that were not placed in the document. I've never even seen the Structure panel before so this is totally new to me. I was able to delete all of the XML elements that were not placed in my document by checking their icons.

  • Xml structure being ignored

    XML structure in "Bus Card Order Form" created in inDesign is being ignored by Acrobat>Tools>Forms>More Form Options>Export Data. 
    inDesign form also has DTD.
    1. inDesign "BC Order Form" is output to interactive pdf fillable form
    2. pdf filled form is then saved.
    3. XML is then exported per above, however XML structure does not match. Rather, root is redefined as "fields' and all fields are listed alphabetically.  
    4. xml data does not flow into fields in BC template.
    Both "Bus Card Order Form' and 'BC Template' have matching xml structure.
    What am I doing wrong?

    Nevermind my previous post; I see the error in our own code. You're
    right; the file isn't being used. This will be fixed in our 2.5 final
    release. Sorry!
    In the meantime, I suggest you continue to use the 2.4
    kodo-reverse-schema.jar

  • XML structure validation by javascript

    Hi All,
    I’m trying to find solution for XML structure validation on opening the indesign document.
    Is this possible by javascript.
    by
    hasvi

    Or you could go directly to the source.
    http://help.sap.com/saphelp_nw70/helpdata/en/c4/e1343e8c7f6329e10000000a114084/frameset.htm
    Regards,
    Henrique.

  • Remove Structured Anchored Frame  without disturbing the XML Structure - Reg.

    Dear All,
    Please any one help me!, How to remove the xml Structured Anchored Frame without disturbing the XML Structure.
    Manually If I'm removing the XML Structured Anchored Frame, the XML Structured is gone.
    I tried so many ways.  If  I am removing manually in Grouped Frame, then this problem is not happens.
    I mean, Create 2 separate frames Move any xml structured contents to that frames. Group that 2 frames and make it anchored.
    Now you can remove that anchored, this xml Structure is not disturbing (I mean not removed).
    If I did the same in above method for Single Text Frame, this xml Structure is gone.
    Kindly any one person resolve this problem, Thanks in advance!!!
    Note:
    (1) I tried through in InDesign CS6 Plug-In, this is working perfectly. But I need in Javascript to do this.
    Thanks & Regards
    T.R.Harihara SudhaN

    Hm – if you can do it with a Group object, why don't you wrap around a group object?
    With ExtendScript it's quite possible to create Groups with only one single object.
    If we have a text frame selected, you could add a "helper" rectangle to the spread.
    Group the text frame and the rectangle, then remove the rectangle from the group.
    Now you have a Group with a single text frame.
    var myTextFrame = app.selection[0];
    var myHelperRectangle = app.documents[0].layoutWindows[0].activeSpread.rectangles.add();
    var myGroup = app.documents[0].layoutWindows[0].activeSpread.groups.add([myTextFrame,myHelperRectangle]);
    myGroup.rectangles[0].remove();
    app.documents[0].select(myGroup);
    Uwe

  • Fetch entire xml structure

    Hi,
    I am looking for a way to get the entire xml structure inside an actual xml object, or if possible, as a string. I need to pass it to a service but i haven't found a way to get it in the layout that it is shown in the structure panel. The only thing i am able to do is work with XMLElments but isnt there any other way to access it?

    if its importing then you can import the xml into javascript rather than indesign then manipulate the xml before placing it in indesign.
    for example, in this case the xml is read from a file into javascript:
    var xmlFile = File.openDialog ("Please select the XML file");
    xmlFile.open("r");
                        var strXML = xmlFile.read();
      xmlFile.close();
                        XML.ignoreComments = true;
                        XML.ignoreProcessingInstructions = true;
    xmlTree =  new XML(strXML);
    var childrenXML = XMLTree.children(); // children would be directly below the root element to select individual elements use .child("elementName") there are several other options available for navigating through the nodes: including: .parent() and also descendants().
    for (i =0;i < XMLTree.children().length; i++) {
    //process the xml
    Keith

  • OSB: Looping through XML Structure

    How could I loop through a WHOLE XML structure and check the contents of each node to determine whether it is a dateTime stamp?
    I attempted a for-each loop in OSB but I could not get my expected output
    A sample xml structure may look like this
    <ebo:CreateQuoteEBM >
        <ebo:DataArea>
          <ebo:CreateQuote>
            <ebo:Custom>
              <chubCommon:Quote>
                  <chubCommon:ItemDetail>
                         <chub:Name>Test</chub:Name>
                        <chub:Value>20130527T12:02:13<chub:Value>
                  </chubCommon:ItemDetail>
                  <chubCommon:Reference>
                      <chubCommon:ReferenceQualifier>Bid Submit Date</chubCommon:ReferenceQualifier>
                      <chubCommon:Value>20130527T12:02:13</chubCommon:Value>
                    </chubCommon:Reference>
              </chubCommon:Quote>
            </ebo:Custom>
          </ebo:CreateQuote>
        </ebo:DataArea>
      </ebo:CreateQuoteEBM>
    Bonus: If it is a dateTime stamp convert into a date
    Thanks!

    You can use FLOWR loop to loop though this, and then for each node check if conditon is (fn:data() is true and fn:matches()) to check if the node is of datetime type. fn:data() will give you the if the xml node has some data and then using fn:matches() you can compare it with the datetime pattern, You can use a regex pattern to compare 20130527T12:02:13 . For converting this date use fn:substring() get the data before "T" and use fucntion similar to this functx:mmddyyyy-to-date for converting to date.For converting to date you can also use substring to extract the data from node and then use below fucntion to convert to date.
    declare function functx:date
      ( $year as xs:anyAtomicType ,
      $month as xs:anyAtomicType ,
      $day as xs:anyAtomicType ) as xs:date {
      xs:date(
      concat(
      functx:pad-integer-to-length(xs:integer($year),4),'-',
      functx:pad-integer-to-length(xs:integer($month),2),'-',
      functx:pad-integer-to-length(xs:integer($day),2)))

  • How can I get the XML structure from a flat structure?

    Hi all,
    in my XI SP 12 I use a JMS adapter to read information using the WebSphereMQ transport protocol.
    The structure that I receive have this format:
    <Name_A.KeyFieldValue><Name_A.fieldName_A1_Value>...<Name_A.fieldName_AN_Value>
    <NumberRecordType_B><NumberRecordType_c>
    <Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>
    <Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>
    <Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    <Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    the problem is that in this structure each line is not separated by a carriage return or a comma, I have all the information in a single line:
    <Name_A.KeyFieldValue><Name_A.fieldName_A1_Value>...<Name_A.fieldName_AN_Value><NumberRecordType_B><NumberRecordType_c><Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>...<Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value><Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>...<Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    and the customer don't want to insert a line separator.
    Then, the question is:
    How can I get the XML structure from this structure?
    If possible, I don't want to develop new Module and add it in the JMS Module Sequence.
    PS I have already read the article "How to Use the Content Conversion Module with the XI 3 J2EE JMS Adapter.pdf" and it doesn't seem to help me.
    Best Regards,
    Paolo

    To get context parameters from your web.xml file you can simply get the ActionServlet object from an implementing action object class. In the perform (or execute) method make the following call.
    ServletContext context = getServlet().getServletContext();
    String tempContextVar =
    context.getInitParameter("<your context param >");

  • One Communication Channel for two XML-Structure

    Hi to all!
    i'm Newbee in XI.
    i register one Communication Channel to recieve two different XML-Structure and when i sent second structure there was a Mapping error, because XI waiting for first XML-Structure.
    I'd like to ask if there are any additional condition that i must tune up to make it possible or just it's impossible?

    Hi,
    Please refer below links
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/121b053d-0401-0010-539f-f9295efb7bad
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3a913f71-0601-0010-7a83-dfd3208a9a0b
    how to find the URL of deployed Web services?
    Creating .NET Web service
    http://www.15seconds.com/issue/010430.htm
    Also refer SOAP Framework to generate the common wsdl for both the messages with single SOAP CC
    http://help.sap.com/saphelp_nw04s/helpdata/en/bb/ddb33d2ae46b3be10000000a114084/frameset.htm
    Thanks
    swarup

  • Special characters in XML structure when prepared using String

    Hi,
       I am preparing an XML structure using 'String'. I print the prepared XML structure in the server log. Issue is that I am seeing extra characters([[ and ]]) that I am not printing.
    Please let me know how to get rid of those.
    Code Excerpt
            String xmlHeader = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
            String lsb_xmlcon = xmlHeader;
            logger.info("ReqXMLString Process  1  --->" + lsb_xmlcon);
            lsb_xmlcon = lsb_xmlcon +("\n");
            logger.info("ReqXMLString Process  1.1  --->" + lsb_xmlcon);
            lsb_xmlcon = lsb_xmlcon +("<REQUEST>");
            lsb_xmlcon = lsb_xmlcon +("\n");
            logger.info("ReqXMLString Process  1.2  --->" + lsb_xmlcon);
    Log
    ReqXMLString Process  1  ---><?xml version="1.0" encoding="utf-8" ?>
    ReqXMLString Process  1.1  ---><?xml version="1.0" encoding="utf-8" ?>[[
    ReqXMLString Process  1.2  ---><?xml version="1.0" encoding="utf-8" ?>[[
    <REQUEST>
    Thanks,
    Message was edited by: 996913
    This issue is observed only while running the code in server, not from Jdev.
    When we append the additional tags without new line character, "\n", there are no extra characters being added. Also, in other case also. where we used "Marshaller" to prepare the XML, we have seen this issue.
    After we set the below property to false, we got rid of the extra characters.
                            jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false);
    Apparently the insertion of new line when the code runs on server(Weblogic 10.3.6.0) is creating the issue.
    Please let me know if anyone has come across a similar scenario.
    Thanks,

    I am building this XML in a servlet so ,right, DOM does process XML (even though a valid HTML file can be loaded into a DOM object) but if you build XML using DOM then write the XML out using PrintWriter and Transformer objects this will cause the XML to print out in your browser. If you view source on this XML you will see that the DOM object has translated all special characters to there &xxxx; equivalent. For a example: when the string (I know "cool" java) gets loaded into a attribute using the DOM object then wrote back out it looks like (I know &xxx;cool&xxx; java) if you view the source in your browser. This is what it should do, but the DOM object is not change the � to the "&xxxxx;". This servlet is acting as a gateway between a Java API and a windows asp. The asp will call the servlet expecting to get XML back and load it directly into a DOM object. When the windows DOM object gets the xml that I am returning in this servlet is throws a exception "invalid character" because the � was not translated to &xxxx; like the other characters were. According to the book HTML 4 in 24 hours (and other references) the eacute; or #233; are how you say "�" in HTML or XML. How do you say it?

  • How to use For-Each Structure with Multiple node XML structure

    Hi,
      How to use for-each (BPEL 2.0) construct for Multinode XML structure.
    Here is the easy case: I have list of suppliers specified by supplier
    <supplierList>
    <supplier>1</supplier>
    <supplier>2</supplier>
    <supplier>3</supplier>
    </supplierList>
    Now there is a web service http://hostname/getsupplierdetails/wsdl which accepts one supplier at a time.
    like
    <supplier>1</supplier>
    reponse object is
    <message> notfound/found </message>
    But how can I use for each of XML node to call this service and collect the result like
    <supplierList1>
         <Suppinfo>
            <supplier>1</supplier>
            <message> not found</message>
    </suppinfo>
        <suppinfo>
            <supplier>1</supplier>
            <message> not found</message>
    </suppinfo>
    </supplierlist1>
    Thanks

    For looping you use foreach loop and , loop for the number of occurences and when constructing response, adding a new element you have to use bpelx:append.  Good sample at Enterprise Integration: Oracle SOA Suite 11g: Populating a list or an array in BPEL without using XSLT.

Maybe you are looking for