Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

sp::tool::XMLParser Class Reference

#include <spToolXMLParser.hpp>

List of all members.

Classes

struct  SFileState
struct  SToken

Public Member Functions

 XMLParser ()
virtual ~XMLParser ()
bool loadFile (const io::stringc &Filename)
bool saveFile (const io::stringc &Filename, const SXMLTag &RootTag)
 Saves an XML file with the given root tag.
const SXMLTaggetRootTag () const
 Returns the main block which will be generated after reading an XML file.

Protected Types

enum  ETokenState { TOKENSTATE_NONE, TOKENSTATE_CHECK_COMMENT, TOKENSTATE_SEARCH_COMMENT_END, TOKENSTATE_STRING }
enum  ETokenTypes {
  TOKEN_UNKNOWN, TOKEN_SINGLE, TOKEN_STRING, TOKEN_NAME,
  TOKEN_TAG_START, TOKEN_TAG_END, TOKEN_TAG_CLOSE, TOKEN_BLANK
}

Protected Member Functions

c8 readChar ()
void storePrevChar ()
void jumpPrevChar ()
SToken readToken ()
bool readXML ()
bool readTag (bool &hasTagClosed)
bool readTagName (SToken &Token, io::stringc &Name)
bool writeTag (const SXMLTag &Tag, io::stringc &Tab)
bool isCharName (const c8 Character) const
void pushTag ()
void popTag ()
void pushTagName ()
void popTagName ()
void addAttribute (const io::stringc &Name)
io::stringc getLinesIndicate () const
bool printErrorLI (const io::stringc &Message) const
void printWarningLI (const io::stringc &Message) const

Protected Attributes

io::FileSystem FileSys_
io::FileFile_
io::stringc Line_
u32 LineColumn_
u32 LineRow_
SFileState PrevState_
io::stringc ParentTagName_
std::list< SXMLTag * > TagStack_
std::list< io::stringcTagNameStack_
SXMLTagCurTag_
SXMLTag RootTag_

Detailed Description

This is the class for XML file parsing. It also has a small function to write XML files. An XML file is always represented in one root XML tag.


Member Enumeration Documentation

Enumerator:
TOKENSTATE_NONE 
TOKENSTATE_CHECK_COMMENT 
TOKENSTATE_SEARCH_COMMENT_END 
TOKENSTATE_STRING 
Enumerator:
TOKEN_UNKNOWN 
TOKEN_SINGLE 

Single character (e.g. 't').

TOKEN_STRING 

String (e.g. "\"test"").

TOKEN_NAME 

Name (e.g. "test").

TOKEN_TAG_START 

Tag start character '<'.

TOKEN_TAG_END 

Tag end character '>'.

TOKEN_TAG_CLOSE 

Tag close character '/'.

TOKEN_BLANK 

' ' and ''


Constructor & Destructor Documentation

sp::tool::XMLParser::XMLParser (  ) 
virtual sp::tool::XMLParser::~XMLParser (  )  [virtual]

Member Function Documentation

void sp::tool::XMLParser::addAttribute ( const io::stringc Name  )  [protected]
io::stringc sp::tool::XMLParser::getLinesIndicate (  )  const [protected]
const SXMLTag& sp::tool::XMLParser::getRootTag (  )  const [inline]

Returns the main block which will be generated after reading an XML file.

bool sp::tool::XMLParser::isCharName ( const c8  Character  )  const [protected]
void sp::tool::XMLParser::jumpPrevChar (  )  [protected]
bool sp::tool::XMLParser::loadFile ( const io::stringc Filename  ) 

Loads an XML file (such as HTML websites).

Parameters:
Filename,: XML filename which is to be loaded.
Returns:
SXMLTag structure which represents the main block wherein all the data is stored.
void sp::tool::XMLParser::popTag (  )  [protected]
void sp::tool::XMLParser::popTagName (  )  [protected]
bool sp::tool::XMLParser::printErrorLI ( const io::stringc Message  )  const [protected]
void sp::tool::XMLParser::printWarningLI ( const io::stringc Message  )  const [protected]
void sp::tool::XMLParser::pushTag (  )  [protected]
void sp::tool::XMLParser::pushTagName (  )  [protected]
c8 sp::tool::XMLParser::readChar (  )  [protected]
bool sp::tool::XMLParser::readTag ( bool &  hasTagClosed  )  [protected]
bool sp::tool::XMLParser::readTagName ( SToken Token,
io::stringc Name 
) [protected]
SToken sp::tool::XMLParser::readToken (  )  [protected]
bool sp::tool::XMLParser::readXML (  )  [protected]
bool sp::tool::XMLParser::saveFile ( const io::stringc Filename,
const SXMLTag RootTag 
)

Saves an XML file with the given root tag.

void sp::tool::XMLParser::storePrevChar (  )  [protected]
bool sp::tool::XMLParser::writeTag ( const SXMLTag Tag,
io::stringc Tab 
) [protected]

Member Data Documentation

std::list<SXMLTag*> sp::tool::XMLParser::TagStack_ [protected]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines