23 Replies Latest reply on Jan 4, 2011 3:12 AM by wttewaall

    XML namespaces changed to aaa when exporting xml doc in AIR app

    BKUoP

      When I export my xml in a TimedText Format from an AIR application I'm working on, the xml namespaces get changed to aaa instead of xml...does anyone know how to fix this or keep the application from changing them arbitrarily.

       

      One other question, for some reason the code I have, as formatted now, will not let me use the appendChild method to add my cuepoints to the TTF xml document.

       

      Any advise would be greatly appreciated.  My code is below:

       

                     //Create final XML

       

                      private function submit():void

       

                      {

       

                          if (boolVideoSelected == true)

       

                          {

       

                              xmlData =

       

                                  <tt xml:lang="en" xmlns="http://www.w3.org/2006/04/ttaf1" xmlns:tts="http://www.w3.org/2006/04/ttaf1#styling">

       

                                      <head>

       

                                          <styling>

       

                                              <style id="1" tts:textAlign="center" tts:backgroundColor="gray" tts:color="white" tts:fontSize="14" tts:fontFamily="sansSerif" />

       

                                          </styling>

       

                                      </head>

       

                                      <body>

       

                                          <div xml:lang="en" style="1">

       

                                                 

       

                                          </div>

       

                                      </body>

       

                                  </tt>;

       

                             

       

                              var cue:XML;

       

                             

       

                              var strTempDuration:String;

       

                              var strTempTime:String;

       

                              var strTempContent:String;

       

                             

       

                              vidVideo.pause(); //Pause video

       

                              btnPlay.label = ">";

       

                             

       

                                 for (var i:int = 0; i < stateArray.length; i++) //Convert stateArray into XML

       

                                 {                              

       

                                     strTempDuration = stateArray[i].duration.toString();

       

                                     strTempTime = stateArray[i].time.toString();

       

                                     strTempContent = stateArray[i].content.toString();

       

                                    

       

                                     cue = <p begin={strTempTime} dur={strTempDuration}>{strTempContent}</p> //Generate cue

       

                                     //trace(xmlData);

       

                                    

       

                                     xmlData.body.div.appendChild(cue); //Insert cues into XML sequentially

       

                                 }

       

                                

       

                                 xmlFile = new File;

       

                                 xmlFile.browseForSave("Save XML File"); //Open browse window for save location

       

                                 //Event listeners


                                 xmlFile.addEventListener(Event.SELECT, xmlFileSelectHandler);
                              xmlFile.addEventListener(IOErrorEvent.IO_ERROR, ioHandler);
                              xmlFile.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityHandler);
                          }
                      }
                     
                      private function xmlFileSelectHandler(e:Event):void {
                          var newFile:File = e.target as File;
                         
                          if(!newFile.extension || newFile.extension != "xml") //Check if .xml was included in user entry
                          {
                              newFile.nativePath += ".xml"; //Add .xml to the filename if it was not included
                          }
                     
                          var stream:FileStream = new FileStream();
                          stream.open(newFile, FileMode.WRITE);
                          stream.writeUTFBytes(xmlData.toString()); //Write XML string to XML file
                          stream.close();
                      }