Gnash  0.8.11dev
Public Types | Public Member Functions | List of all members
gnash::XML_as Class Reference

Implements XML (AS2) and flash.xml.XMLDocument (AS3) class. More...

#include <XML_as.h>

Inheritance diagram for gnash::XML_as:
gnash::XMLNode_as gnash::Relay

Public Types

enum  ParseStatus {
  XML_OK = 0, XML_UNTERMINATED_CDATA = -2, XML_UNTERMINATED_XML_DECL = -3, XML_UNTERMINATED_DOCTYPE_DECL = -4,
  XML_UNTERMINATED_COMMENT = -5, XML_UNTERMINATED_ELEMENT = -6, XML_OUT_OF_MEMORY = -7, XML_UNTERMINATED_ATTRIBUTE = -8,
  XML_MISSING_CLOSE_TAG = -9, XML_MISSING_OPEN_TAG = -10
}
 
enum  LoadStatus { XML_LOADED_UNDEFINED = -1, XML_LOADED_FALSE = false, XML_LOADED_TRUE = true }
 
typedef std::string::const_iterator xml_iterator
 
- Public Types inherited from gnash::XMLNode_as
enum  NodeType {
  Element = 1, Attribute = 2, Text = 3, Cdata = 4,
  EntityRef = 5, Entity = 6, ProcInstr = 7, Comment = 8,
  Document = 9, DocType = 10, DocFragment = 11, Notation = 12
}
 
typedef std::list< XMLNode_as * > Children
 

Public Member Functions

 XML_as (as_object &object)
 Create an XML object. More...
 
 XML_as (as_object &object, const std::string &xml)
 
 ~XML_as ()
 
void toString (std::ostream &o, bool encode) const
 Convert the XML object to a string. More...
 
const std::string & getXMLDecl () const
 
void setXMLDecl (const std::string &xml)
 
const std::string & getDocTypeDecl () const
 
void setDocTypeDecl (const std::string &docType)
 
const std::string & getContentType () const
 
void setContentType (const std::string &contentType)
 
void parseXML (const std::string &xml)
 Parses an XML document into the specified XML object tree. More...
 
int status () const
 
void setStatus (ParseStatus st)
 
LoadStatus loaded () const
 
void setLoaded (LoadStatus st)
 
bool ignoreWhite () const
 Return current ignoreWhite property. More...
 
void ignoreWhite (bool ignore)
 Set ignoreWhite property. More...
 
- Public Member Functions inherited from gnash::XMLNode_as
 XMLNode_as (Global_as &gl)
 
virtual ~XMLNode_as ()
 
size_t length () const
 
const std::string & nodeName () const
 
const std::string & nodeValue () const
 
NodeType nodeType () const
 Get the type of an XML Node. More...
 
void nodeTypeSet (NodeType type)
 Set the type of an XML Node. More...
 
void nodeNameSet (const std::string &name)
 Set name of this node. More...
 
bool extractPrefix (std::string &prefix) const
 
void nodeValueSet (const std::string &value)
 Set value of this node. More...
 
void getNamespaceForPrefix (const std::string &prefix, std::string &ns) const
 Performs a recursive search of node attributes to find a match. More...
 
bool getPrefixForNamespace (const std::string &ns, std::string &prefix) const
 Performs a recursive search of node attributes to find a match. More...
 
void setNamespaceURI (const std::string &value)
 
const std::string & getNamespaceURI () const
 
bool descendsFrom (XMLNode_as *node) const
 Returns true if 'this' descends from the specified node. More...
 
bool hasChildNodes () const
 
XMLNode_asfirstChild () const
 
XMLNode_aslastChild () const
 
as_objectchildNodes ()
 
XMLNode_aspreviousSibling () const
 
XMLNode_asnextSibling () const
 
XMLNode_ascloneNode (bool deep) const
 Copy a node. More...
 
void appendChild (XMLNode_as *node)
 Append a child node to this XML object. More...
 
void removeChild (XMLNode_as *node)
 Remove a child node from this XML object. More...
 
XMLNode_asgetParent () const
 Get the parent XMLNode_as of this node. Can be 0. More...
 
void insertBefore (XMLNode_as *newnode, XMLNode_as *pos)
 Insert a node before a node. More...
 
as_objectgetAttributes () const
 Return the attributes object associated with this node. More...
 
void setAttribute (const std::string &name, const std::string &value)
 Set a named attribute to a value. More...
 
void setObject (as_object *o)
 Associate an as_object with this XMLNode_as. More...
 
as_objectobject ()
 Return the object associated with this XMLNode_as. More...
 
- Public Member Functions inherited from gnash::Relay
virtual ~Relay ()=0
 
virtual void clean ()
 Handle any cleanup necessary before the Relay is destroyed. More...
 

Additional Inherited Members

- Protected Member Functions inherited from gnash::XMLNode_as
virtual void setReachable ()
 Mark reachable elements. More...
 
void clearChildren ()
 Clear all children, making sure unreferenced children are deleted. More...
 
- Protected Attributes inherited from gnash::XMLNode_as
Global_as_global
 

Detailed Description

Implements XML (AS2) and flash.xml.XMLDocument (AS3) class.

This class interface is identical in AS3 and AS2; it is probably included in AS3 for backward compatibility. The class definition is necessary because XML is encoded differently in AMF.

Member Typedef Documentation

§ xml_iterator

typedef std::string::const_iterator gnash::XML_as::xml_iterator

Member Enumeration Documentation

§ LoadStatus

Enumerator
XML_LOADED_UNDEFINED 
XML_LOADED_FALSE 
XML_LOADED_TRUE 

§ ParseStatus

Enumerator
XML_OK 
XML_UNTERMINATED_CDATA 
XML_UNTERMINATED_XML_DECL 
XML_UNTERMINATED_DOCTYPE_DECL 
XML_UNTERMINATED_COMMENT 
XML_UNTERMINATED_ELEMENT 
XML_OUT_OF_MEMORY 
XML_UNTERMINATED_ATTRIBUTE 
XML_MISSING_CLOSE_TAG 
XML_MISSING_OPEN_TAG 

Constructor & Destructor Documentation

§ XML_as() [1/2]

gnash::XML_as::XML_as ( as_object object)

Create an XML object.

An XMLDocument is always user-created, so always starts with an associated object.

References gnash::XMLNode_as::setObject().

Referenced by gnash::registerXMLNative().

§ XML_as() [2/2]

gnash::XML_as::XML_as ( as_object object,
const std::string &  xml 
)

§ ~XML_as()

gnash::XML_as::~XML_as ( )
inline

References gnash::key::o, and toString().

Member Function Documentation

§ getContentType()

const std::string& gnash::XML_as::getContentType ( ) const
inline

§ getDocTypeDecl()

const std::string& gnash::XML_as::getDocTypeDecl ( ) const
inline

§ getXMLDecl()

const std::string& gnash::XML_as::getXMLDecl ( ) const
inline

§ ignoreWhite() [1/2]

bool gnash::XML_as::ignoreWhite ( ) const
inline

Return current ignoreWhite property.

Referenced by ignoreWhite(), parseXML(), and gnash::registerXMLNative().

§ ignoreWhite() [2/2]

void gnash::XML_as::ignoreWhite ( bool  ignore)
inline

§ loaded()

LoadStatus gnash::XML_as::loaded ( ) const
inline

§ parseXML()

void gnash::XML_as::parseXML ( const std::string &  xml)

Parses an XML document into the specified XML object tree.

This reads in an XML file from disk and parses into into a memory resident tree which can be walked through later.

Calls to this function clear any precedently parsed data.

References _, gnash::XMLNode_as::clearChildren(), ignoreWhite(), gnash::log_error(), XML_MISSING_CLOSE_TAG, and XML_OK.

Referenced by gnash::registerXMLNative(), setContentType(), and XML_as().

§ setContentType()

void gnash::XML_as::setContentType ( const std::string &  contentType)
inline

References parseXML().

Referenced by gnash::registerXMLNative().

§ setDocTypeDecl()

void gnash::XML_as::setDocTypeDecl ( const std::string &  docType)
inline

§ setLoaded()

void gnash::XML_as::setLoaded ( LoadStatus  st)
inline

§ setStatus()

void gnash::XML_as::setStatus ( ParseStatus  st)
inline

§ setXMLDecl()

void gnash::XML_as::setXMLDecl ( const std::string &  xml)
inline

§ status()

int gnash::XML_as::status ( ) const
inline

§ toString()

void gnash::XML_as::toString ( std::ostream &  o,
bool  encode 
) const
virtual

The documentation for this class was generated from the following files: