1 Reply Latest reply on Oct 31, 2009 7:25 PM by flashharry!

    flex based xml editor

    flashharry! Level 1

      I have a flex app that uses xml as its configuration, the app is quite complex and the xml quite daunting . User want a GUI to edit the xml.

       

      I have an admin app in progress to do this, at the moment have a text area that displays the raw xml, this is rather boring as all the text its just black. Anyone know of a component or direction on creating a color coded text editor. If you look at Flex builder and apps like bbedit they color code the text. XML elements are normally blue, attributes are colored brown, text is black etc

       

      thanks in advance

       

      flash harry

        • 1. Re: flex based xml editor
          flashharry! Level 1

          So far I got something that is acceptable but still working on it.

           

          private function colorCodeText() : void {

               var tempHTML:String;

               tempHTML = rawXMLEditor.htmlText;

               var tagRegExp:RegExp;

               //tag all the single xml as blue

               tagRegExp = /(<\w*>)|(<\/\w*>)|(<\w*)|(\/>)|(>)/g;

               tempHTML = tempHTML.replace(tagRegExp,"<FONT COLOR=\"#0000FF\">$&</FONT>");

               //tag attribute values

               tagRegExp = /(\w*)(\s)*=(\s)*(&quot;)((\w| |#|,|&apos;)*)(&quot;)/g;

               tempHTML = tempHTML.replace(tagRegExp,"<FONT COLOR=\"#990000\">$&</FONT>");

               rawXMLEditor.htmlText = tempHTML;

          }

           

          <RichTextEditor id="rawXMLEditor" width="100%" height="100%" creationComplete="colorCodeText()"  />