Actionscript/XML

From Gnash Project Wiki

Jump to: navigation, search

Contents

XML

As of Feb 9, 2006, I implemented the node creation methods for the XML class. All that is remaining to be done are the toString method, and the other two routines used to send XML data. -- rob

Now that the basic functionality has been moved to the XMLNode class, I'd like to use that as a base class for the XML class one of these days... The XML class implements the parser, whereas XNLNode just holds data.

It is also now possible to use the builtin ActionScript methods to build up a DOM tree of nodes with tags and content. createElement creates the tag, and then createTextNode becomes the data part of the XML.

Unimplemented

  • properties:
    • contentType : String
    • docTypeDecl : String
    • idMap : Object
    • ignoreWhite : Boolean
    • loaded : Boolean
    • status : Number
    • xmlDecl : String
  • method XML::toString()
  • event onData: is coded but the code is not linked in anywhere.
  • event onLoad: appears from the code to be implemented.
  • event onHTTPStatus

Implemented

  • method XML.load
  • method XML.parseXML
  • method XML.getBytesTotal
  • method XML.hasChildNodes
  • method XML.getBytesTotal
  • method XML.getBytesLoaded
  • method XML.appendChild
  • method XML.cloneNode
  • method XML.createElement
  • method XML.createTextElement
  • property XML::nodeName
  • property XML::nodeValue

Notes

XML.load

The way this is currently implemented, it won't handle a true URL where it needs to grab a file off of another web site. This initial implementation is limited to reading disk files, or parsing XML messasges in memory.

XML.getBytesTotal

This currently returns the size of the XML file or message correctly.

XML.getBytesLoaded

With the current limitation of disk or memory (network) based XML data, the bytes loaded is the same as the total bytes. When support for loading from a URL is added, this will then actually reflect the counts of how many bytes have been retrieved from the URL.

XML.hasChildNodes

This correctly returns the number of children for the current XML node.

XML.appendChild

This correctly appends a node as a child to the XML node.

XML.cloneNode

This correctly creates a new node with the specified node's data.

XML.createElement

This correctly creates a new XMLNode. The value passed in becomes the tag name.

XML.createTextElement

This correctly create a new Text node. The value passed in becomes the data part of the XML tag.