Flash / Flex / ActionScript/XML/settings

Материал из Web эксперт
Перейти к: навигация, поиск

All of these settings can be accessed as a group with the settings() static method

 
//ignoreWhitespace 
//ignoreComments 
//ignoreProcessingInstructions 
//prettyPrinting 
//prettyIndent 
//ignoreWhitespace

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        trace(XML.settings().ignoreProcessingInstructions); // Displays: true
        XML.ignoreProcessingInstructions = false;
        trace(XML.settings().ignoreProcessingInstructions); // Displays: false
    }
  }
}



use the defaultSettings() object to reset an individual flag, ignoreWhitespace, and then reset all the settings to their defaults using setSettings().

 
package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        XML.ignoreWhitespace = XML.defaultSettings().ignoreWhitespace;
        trace(XML.ignoreWhitespace); // Displays: true
        XML.setSettings(XML.defaultSettings());
    }
  }
}