2 Replies Latest reply on Dec 22, 2012 4:01 AM by Chang_indd

    Remove XML attribute and value

    Chang_indd Level 1

      Hi All,

       

      I require to delete the attribute and value in xml structure.

       

      Below code is not working due to ":" (aid:cstyle) between attribute name.

       

      JS code is:

       

      evaluateXPathExpression("//typestyle[@aid:cstyle = 'bold']")

       

       

      If I remove colon and change it to aidcstyle than it is working. How to read : (colon)?

       

      Also it is showing alert message again and again.

       

       

       

      Error.png

      Please help.

      Chang.

        • 1. Re: Remove XML attribute and value
          Vamitul Level 4

          for the first problem there are two fixes:

          first one (simple, normal, no ideea why it's not there already) declare your aid (and aid5) namespaces in your xml. For example:

          <Root xmlns:aid=”http://ns.adobe.com/AdobeInDesign/4.0/”
          xmlns:aid5=”http://ns.adobe.com/AdobeInDesign/5.0/”>
          

          second one: more advanced xpath, if it works, using local_name() and namespace-uri(). My xpath-expert is not at work right now, so i can't help you more with this until he's back.

           

          second problem... no real fix for now. some characters that indesign uses (indentToHere and rightIndentTab, as far as I know, but may be others too) have no UTF equivalent, so you get that warning. you can eitehr ignore it, or, as I do, before doing anything with XML in scripting, i change the said characters to some marking (##RIT## and ##ITH##), and change them back after changing the XML

          1 person found this helpful
          • 2. Re: Remove XML attribute and value
            Chang_indd Level 1

            Thank you so much for your response on this, Vamit.

             

            Chang