Creating Namespace-Qualified Elements and Attributes : Namespace : XML Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » XML » Namespace »

 

Creating Namespace-Qualified Elements and Attributes


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){


        var htmlNS:Namespace = new Namespace("html","http://www.w3.org/1999/xhtml");
        var shopNS:Namespace = new Namespace("shop","http://www.example.com/furniture");
        // Set the default namespace
        default xml namespace = htmlNS;
        // Create the root element
        var catalog:XML = <html/>;
        
        catalog.addNamespace(shopNS);
        catalog.head.title = "Catalog";
        catalog.body.shopNS::table = "";
        catalog.body.shopNS::table.@shopNS::id = "4875";
        catalog.body.shopNS::table.table = "";
        catalog.body.shopNS::table.table.@border = "1";
        catalog.body.shopNS::table.table.tr.td = "Item";
        catalog.body.shopNS::table.table.tr.td[1"Price";
        catalog.body.shopNS::table.table.tr.@align = "center";
        catalog.body.shopNS::table.table.tr[1"";
        catalog.body.shopNS::table.table.tr[1].@align = "left";
        catalog.body.shopNS::table.table.tr[1].td.shopNS::desc ="Table";
        catalog.body.shopNS::table.table.tr[1].td[1"";
        catalog.body.shopNS::table.table.tr[1].td[1].shopNS::price = "9.99";

        trace(catalog);
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo XML
» Namespace