Nov 23 2007

as3yaml – A YAML 1.1 parser and emitter for ActionScript 3

Tag: AS3, ActionScript, as3yaml, yamlDerek Wischusen @ 7:13 pm

I am pleased to announce the first release of as3yaml, an ActionScript 3 library for parsing and emitting YAML. It is a direct port of Ola Bini’s jvyaml, which was itself a port of Kirill Simonov’s PyYAML.

For those of you who are unfamiliar with YAML, here is a concise description from the yaml.org welcome page:

YAML(tm) (rhymes with “camel”) is a straightforward machine parsable data serialization format designed for human readability and interaction with scripting languages such as Perl and Python. YAML is optimized for data serialization, configuration settings, log files, Internet messaging and filtering. YAML(tm) is a balance of the following design goals:

  • YAML documents are very readable by humans.
  • YAML interacts well with scripting languages.
  • YAML uses host languages’ native data structures.
  • YAML has a consistent information model.
  • YAML enables stream-based processing.
  • YAML is expressive and extensible.
  • YAML is easy to implement.

Here are some example of YAML taken from the current version of the YAML spec:

american:
  - Boston Red Sox
  - Detroit Tigers
  - New York Yankees     

national:
  - New York Mets
  - Chicago Cubs
  - Atlanta Braves     

-
  name: Mark McGwire
  hr:   65
  avg:  0.278     

-
  name: Sammy Sosa
  hr:   63
  avg:  0.288

Here is an example of decoding a YAML string and converting it to ActionScript objects:

With the following YAML stored in a file called myYaml.yaml

  ---
  Date: 2001-11-23 15:03:17 -5
  User: ed
  Fatal:
    Unknown variable "bar"
  Stack:
    - file: TopClass.py
      line: 23
      code: |
        x = MoreObject("345\n")
    - file: MoreClass.py
      line: 58
      code: |-
        foo = bar

You can load then load the YAML and decode it as follows.

   public function loadYaml() : void 
   { 
       var loader : URLLoader =  new URLLoader(); 
       loader.load(new URLRequest('myYaml.yaml')); 
       loader.addEventListener(Event.COMPLETE, onYamlLoad); 
   } 
  public function onYamlLoad(event : Event) : void 
  { 
       var yamlMap : HashMap = YAML.decode(event.target.data) as HashMap; // returns a HashMap 
       trace(yamlMap.get("Date"));  // returns a Date object and prints: Fri Nov 23 15:03:17 GMT-0500 2001 
       trace(yamlMap.get("User"));  // returns a String and prints: ed 
       trace(yamlMap.get("Fatal")); // returns a String and prints: Unknown variable "bar" 
       trace(yamlMap.get("Stack")); // returns an Array and prints: [object HashMap],[object HashMap] 
       trace(yamlMap.get("Stack")[0].get("line"));  // returns an Int and prints: 23 
       trace(yamlMap.get("Stack")[0].get("code"));  // returns a String and prints: x = MoreObject("345\n")     
 
  }

There are some more examples available in the as3yaml docs.

I have been working on this for a little while now, and running it through various tests, so I think it is at a point where it is ready to be released into the wild. Please submit any bugs that you find to the issues list on the google project site. If you have any interest in contributing to the project, please let me know.

 THANKS:

  • Of course, special thanks to Ola Bini and Kirill Simonov for their excellent work on jvyaml and PyYaml, respectively.
  • I would also like to thank the as3commons project.  This library made the port from Java quite a bit easier than it might have been. 

Xanax online without prescription
Where can i buy levitra
Order propecia without prescription
Non prescription cialis
Where to buy levitra online
Cialis low cost
Viagra overnight delivery us
Viagra online sales
Cialis pricing
Buying viagra in the uk
Cost of prednisone
Propecia without a prescription
Order viagra online canada
Best generic viagra review
Phentermine no prescription needed
Xanax no prescription needed
Viagra to buy in uk
Where can i buy phentermine online
How to buy viagra over the counter
Best price on cialis
Mail order phentermine
Generic cialis prices
How to buy viagra in australia
Cheap generic xanax
Best place to buy viagra uk
Buy viagra 100mg online
Cheapest place to buy phentermine
Generic cialis tadalafil
Buying generic viagra
Levitra cheapest price
Cialis no rx
Viagra cheap prices
Prescription viagra online
Viagra fast shipping
Genuine viagra prices
Generic levitra from india
Get phentermine without a prescription
Online cialis reviews
Buy 30mg phentermine
Valium online reviews
Pharmacy valium
Genuine cialis no prescription
Valium purchase
Buy xanax bars online
Tramadol pharmacy online
Levitra 10 mg
Best place to buy xanax
Viagra usa pharmacy
Online cialis generic
How to buy viagra online without prescription
Where to buy phentermine
Canadian pharmacy phentermine
Viagra trial pack
Overnight xanax without prescription
Buy cialis online from canada
Cialis professional online
Online prescriptions for phentermine
Brand cialis without prescription
Generic tramadol medication
Buy phentermine in uk
Low price phentermine
Purchase valium without prescription
50 mg tramadol
Levitra lowest price
Buy tramadol cod delivery
Cialis 100
Get phentermine without prescription
Prednisone online
Purchase viagra without prescription
Buy xanax cod
Buy tramadol online canada
Order tramadol online no prescription

Xanax pills online
Brand name cialis online
Levitra cheap
Viagra discount prices
Tramadol overnight no prescription
Buy phentermine online without prescription
Generic 2mg xanax
Generic cialis from india
Non prescription levitra
Doses of tramadol
Levitra generic online
Cheapest viagra professional
Buying propecia
Order xanax online uk
Australia viagra prescription
Prednisone online without prescription
Where to buy valium
Cialis 20 mg tablets
Free viagra samples without prescription
Buy viagra professional
Tramadol 100 mg
Cheap viagra canada
Buy phentermine with mastercard
Where can i buy valium in the uk
Phentermine 37.5mg without prescription
Cheapest price viagra
Order valium without a prescription
Viagra prescription australia
Canadian pharmacy phentermine 37.5
About xanax bars
Phentermine diet pills
Valium without prescription australia
Cheap viagra and cialis
Xanax 1mg dosage
Cialis over the counter in canada
Viagra ordering
Canada viagra online without prescription
Viagra free samples
Prednisone prescription
Generic propecia cost
Cialis free sample
Cheapest generic viagra online
Viagra purchase uk
Cheap viagra cialis
Buy discount cialis
Cialis medicine
Buy viagra generic
Best generic viagra prices
Cheap levitra uk
Phentermine 37.5 manufacturer
Order phentermine without prescription
Cheap viagra pills
Valium buy online uk
Valium generic
Generic viagra overnight shipping
Cheap viagra online uk
Fast delivery cialis
Best generic cialis
Best way to take valium
Phentermine purchase online
Buy cialis in australia
Viagra prescription free
Cheap tramadol without a prescription
Buying phentermine in the uk
Valium online no prescription
Prednisone pharmacy
Viagra online overnight
Viagra pfizer price
Xanax buy uk
Overnight delivery of phentermine
Valium buy no prescription
Cheap viagra in india
Online prescription propecia
Generic viagra for sale
Buying prednisone
Cheap viagra generic
Buy xanax bars no prescription
Best price for phentermine
Xanax overnight delivery
Prednisone cheap
Buy viagra las vegas
Cialis for sale in canada
Phentermine usa
Low price cialis
About xanax pills
Female viagra uk
Tramadol without a prescription
Where can i buy phentermine 37.5 mg
Generic viagra reviews
About phentermine
Cheapest place to buy viagra online
Viagra online generic
Cialis 5mg tablets
Buy viagra online in south africa
Buy cheap propecia
Order cialis online
Online viagra cheap
Cialis from india
Buy cheap tramadol without prescription
Viagra pfizer canada
Xanax pills for sale
Phentermine without prescription mastercard
Propecia buy online
Viagra suppliers
Viagra mastercard
Best way to take cialis
Cost of cialis 20 mg
Order levitra without prescription
Xanax fedex
Buy phentermine hcl
Cialis prescription online
Order xanax
Where to buy phentermine without a prescription
Buy phentermine no prescription
Propecia online
Purchase phentermine without a prescription
Prednisone online pharmacy
Valium overnight delivery
Buy cheap cialis online
Valium online
Cheapest viagra in uk
Cialis pills
Valium prescription uk
Buy valium uk
Cialis 100mg pills
Xanax cost
Xanax drug generic
Buy propecia uk
20 mg valium effects
Prescription valium
Genuine viagra
Cialis online canada
Non prescription viagra
Cialis london
Buy real viagra
Buying cialis online
Phentermine tablets 37.5
Order xanax cheap
Viagra for sale usa
Cheap tramadol overnight delivery
Online viagra prescriptions
Tramadol no prescription next day
Cialis drug prices
Buy viagra online from canada
Generic valium 5mg
Buy generic viagra india
50 mg viagra online
Order phentermine cheap
10 mg valium effects
Buy phentermine hcl without prescription
Cialis brand
Viagra online with prescription
Tramadol 50mg tablets
Phentermine pills
Cheap phentermine without a prescription
Buy prednisone no prescription
Phentermine 37.5 without prescription fedex
50mg viagra
Phentermine 37.5mg tablets
Purchase phentermine online
Cheap phentermine no rx
Buy discount viagra online
Buy viagra online canadian pharmacy
Free viagra samples uk
Buy phentermine online with no prescription
Buying xanax without a prescription
Phentermine no rx
Generic viagra in the uk
Side effects of viagra
Ordering phentermine online
Generic phentermine 37.5 without prescription
Tramadol overnight fedex
Canada cialis online
Tramadol cod fedex
Cheap viagra uk
Xanax
Generic valium