Gnash  0.8.10
Public Types | Public Member Functions
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

List of all members.

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 Member Functions

 XML_as (as_object &object)
 Create an XML object.
 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.
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.
ParseStatus status () const
void setStatus (ParseStatus st)
LoadStatus loaded () const
void setLoaded (LoadStatus st)
bool ignoreWhite () const
 Return current ignoreWhite property.
void ignoreWhite (bool ignore)
 Set ignoreWhite property.

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

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

Member Enumeration Documentation

Enumerator:
XML_LOADED_UNDEFINED 
XML_LOADED_FALSE 
XML_LOADED_TRUE 
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

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().

gnash::XML_as::XML_as ( as_object object,
const std::string &  xml 
)
gnash::XML_as::~XML_as ( ) [inline]

Member Function Documentation

const std::string& gnash::XML_as::getContentType ( ) const [inline]
const std::string& gnash::XML_as::getDocTypeDecl ( ) const [inline]
const std::string& gnash::XML_as::getXMLDecl ( ) const [inline]
bool gnash::XML_as::ignoreWhite ( ) const [inline]

Return current ignoreWhite property.

Referenced by parseXML().

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

Set ignoreWhite property.

LoadStatus gnash::XML_as::loaded ( ) const [inline]
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 _, ignoreWhite(), XML_OK, and XML_MISSING_CLOSE_TAG.

Referenced by XML_as().

void gnash::XML_as::setContentType ( const std::string &  contentType) [inline]
void gnash::XML_as::setDocTypeDecl ( const std::string &  docType) [inline]
void gnash::XML_as::setLoaded ( LoadStatus  st) [inline]
void gnash::XML_as::setStatus ( ParseStatus  st) [inline]
void gnash::XML_as::setXMLDecl ( const std::string &  xml) [inline]
ParseStatus gnash::XML_as::status ( ) const [inline]
void gnash::XML_as::toString ( std::ostream &  o,
bool  encode 
) const [virtual]

Convert the XML object to a string.

This calls XMLNode::toString after adding an xmlDecl and docTypeDecl

Parameters:
oThe ostream to write the string to.
encodeWhether to URL encode the node values.

Reimplemented from gnash::XMLNode_as.

References gnash::key::i, gnash::XMLNode_as::firstChild(), and gnash::XMLNode_as::nextSibling().

Referenced by gnash::amf::Writer::writeObject().


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