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

Flash / Flex / ActionScript
1. Animation
2. Array
3. Class
4. Data Type
5. Development
6. Function
7. Graphics
8. Language
9. Network
10. Regular Expressions
11. Statement
12. String
13. TextField
14. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Flash / Flex / ActionScript » 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);
    }
  }
}

        
Related examples in the same category
1. Create a namespace
2. Create a reference to the default Namespace using the Namespace constructor:
3. As with element and attribute names, we can use the properties wildcard (*) with namespaces.
4. Working with XML Namespaces
5. Get xml namespace
6. Two Namespace objects are considered equal if, and only if, they have the same namespace name, regardless of their prefix.
7. Working with Namespaces in ActionScript
8. Namespace with prefix
9. Namespace objects return their URI value by default when the toString() method is used
10. Get prefix and uri from a namespace
11. Use the namespaceDelarations() method to return an Array of all the namespaces defined for a given element.
12. Using the :: Operator with namespace
w__w_w.__j___a___v__a2s__.__c_o_m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.