2 Replies Latest reply on Feb 22, 2008 8:28 AM by srakete

    XML code for "End Nested Style Here"

      I am currently workin on a XML-project and we need to include the code for "End Nested Style Here" in the XML-stream.

      I have tried to find it, exporting to XML takes that character away so I am lost there.

      Is there a way to include it in XML?

      Thanks

      Jan Suhr
      Stockholm, Sweden
        • 1. Re: XML code for "End Nested Style Here"
          srakete Level 1
          Hi Jan,
          I tried it with InDesign CS3. I get the message: "Content contains characters which cannot be encoded".
          Just an idea for a workaround: Convert the EndNestedStyle character to some crazy thing like ### which can be exported.

          When importing the file back into indesign you can use an xml rule to convert it back to the EndNestedStyle character.

          Or maybe create an Xml Comment which contains the characterposition of the EndNestedStyle character in the xmlElement.

          Stefan
          • 2. Re: XML code for "End Nested Style Here"
            srakete Level 1
            Jan,

            I have thought about it some more. You could also create an attribute, if your xmlElment contains an EndNestedStyle character with an xml Rule like this:

            function findNestedStyle(){
            this.name = "findNestedStyle";
            this.xpath = "//Root/article/text";
            this.apply = function(myElement, myRuleProcessor){
            myResetGrep();
            app.findGrepPreferences.findWhat = "~h";
            var myFoundItems = myElement.texts.item(0).findGrep();
            if(myFoundItems.length != 0){
            var myCharacterPosition = "1" // needs to be done
            myElement.xmlAttributes.add("endnestedstyle",myCharacterPosition); }
            myResetGrep();
            return false;
            }
            function myResetGrep(){
            app.findGrepPreferences = NothingEnum.nothing;
            app.changeGrepPreferences = NothingEnum.nothing;
            }}

            Import an Xml and tag the article elements to two separate textframes to test the script. Include the endNestedStyle character in one of your texts and then run your script.

            <?xml version="1.0" encoding="UTF-8"?>
            <Root>
            <article>
            <text>myText</text>
            </article>
            <article>
            <text>myText</text>
            </article>
            </Root>

            Stefan