9 Replies Latest reply on Aug 9, 2014 5:31 AM by Sajeev Sridharan

    Please correct this script for call xml element

    hasvi Level 1

      Hi all,

       

      How to correct this script for 'lev1sec1' should call 'H1' in paragraph style, and 'lev2sec1'should call 'H2'.

      1st Issue:

      This is the code: This is working fine for below xml file.

      var myDocument = app.documents.item(0);
          var myPage = myDocument.pages.item(0);
        //Create a tag to style mapping.
        myDocument.xmlImportMaps.add(myDocument.xmlTags.item("heading_1"), myDocument.paragraphStyles.item("H1"));
        myDocument.xmlImportMaps.add(myDocument.xmlTags.item("heading_2"), myDocument.paragraphStyles.item("H2"));
        myDocument.xmlImportMaps.add(myDocument.xmlTags.item("para_1"), myDocument.paragraphStyles.item("TXF"));
        myDocument.xmlImportMaps.add(myDocument.xmlTags.item("body_text"), myDocument.paragraphStyles.item("TX"));
        //Map the XML tags to the defined styles.
        myDocument.mapXMLTagsToStyles();
      

      3.png

       

      2nd Issue:

      But another xml file has different coding like below, but its showing as below, lev1(H1) and lev2(H2) both have same <title> tag, how can I set '<section id="ch01lev1sec1"><title>' for H1, <section id="ch01lev2sec1"><title> for H2. For your reference I have attached below snapshot.

      4.png

      2.png1.png

       

      please help for this issue.

       

       

      by

      hasvi