4 Replies Latest reply on Dec 10, 2011 7:54 AM by dhishok

    check whether the selected character is an xml open/close tag character...

    dhishok Level 1

      Hi Everyone,

       

      I am using InDesign CS4 and i need some help from you.

      Is there any better way to check the selected character is an XML open/close tag character in the text instead of using the unicode.

       

       

      Thanks in advance

      Thiyagu

        • 1. Re: check whether the selected character is an xml open/close tag character...
          absqua Level 4

          I don't think so, no. InDesign seems to go to some trouble to hide the existence of these characters.

           

          You could add additional checks, though. The tag character's .associatedXMLElements[0] is not the element it starts, but the parent element. So if it is character 0xfeff and has a different .associatedXMLElements[0] than its following character (for the start tag) or preceding character (for the end tag), then it is a start or end tag character.

           

          Jeff

          • 2. Re: check whether the selected character is an xml open/close tag character...
            dhishok Level 1

            Hi Jeff,

             

            Thanks for your comments.

             

            Actually the problem is unable to find the zero width space character (\x{FEFF}) using find/change directly. Also the unicode value of the xml tag character and the zero width space character is same. Hence I am unable to differenciate this two characters.

             

            I have been finding the tag character by this associatedXMLElements property only. When i making each character of the text to loop to remove this zero width space character its getting very slow and InDesign gets hanged.

             

            Is there any better way to acheive this faster?

             

             

            Thanks in advance

            Thiyagu

            • 3. Re: check whether the selected character is an xml open/close tag character...
              absqua Level 4

              I'm having trouble understanding your requirements. I think you're trying to remove the zero-width non-breaking spaces that don't hold tags. Is that right?

               

              If that's the case, you don't really have to worry about the tags. You can do a normal find and replace:

               

              app.findTextPreferences.findWhat = "<feff>";
              app.changeTextPreferences.changeTo = "";
              app.activeDocument.changeText();
              

               

              It will match the characters that hold the tags, but won't remove them. Actually, it will say it removed them, but won't actually do it—or will replace them immediately? I don't know.

               

              (As far as I know, there is no way to match the 0xfeffs with a grep find, which is what it looks like you were trying. It would be super awesome if there weren't as many different  notations for unicode characters as there are means of finding them.)

               

              If you're trying to remove the characters that hold the tags, I think your only option is to untag the elements. You can't remove the 0xfeffs but keep the tags.

              • 4. Re: check whether the selected character is an xml open/close tag character...
                dhishok Level 1

                Jeff its working fine.

                 

                Thank you so much...