Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ipe::XmlParser Class Reference

#include <ipexml.h>

Inherited by ipe::ImlParser.

Public Member Functions

 XmlParser (DataSource &source)
virtual ~XmlParser ()
int parsePosition () const
String parseToTag ()
bool parseAttributes (XmlAttributes &attr, bool qm=false)
bool parsePCDATA (String tag, String &pcdata)
bool isTagChar (int ch)
void getChar ()
bool eos ()
void skipWhitespace ()

Protected Member Functions

String parseToTagX ()

Protected Attributes

String iTopElement
int iCh
int iPos

Detailed Description

Base class for XML stream parsing.

This is the base class for Ipe's XML parser. It only provides some utility functions for parsing tags and PCDATA. Derived classes implement the actual parsing using recursive descent parsers—after experimenting with various schemes for XML parsing, this seems to work best for Ipe.

Tag names and attribute names must consist of ASCII letters only. Only entities for '&', '<', and '>' are recognized.

Constructor & Destructor Documentation

◆ XmlParser()

XmlParser::XmlParser ( DataSource source)

Construct with a data source.

References getChar(), and iPos.

◆ ~XmlParser()

XmlParser::~XmlParser ( )

Virtual destructor, so one can destroy through pointer.

Member Function Documentation

◆ parsePosition()

int ipe::XmlParser::parsePosition ( ) const

References iPos.

◆ parseToTag()

String XmlParser::parseToTag ( )

◆ parseAttributes()

bool XmlParser::parseAttributes ( XmlAttributes attr,
bool  qm = false 

◆ parsePCDATA()

bool XmlParser::parsePCDATA ( String  tag,
String pcdata 


Checks whether the data is terminated by </tag>, and returns with stream past the >.

References eos(), getChar(), iCh, ipe::String::size(), and skipWhitespace().

Referenced by ipe::ImlParser::parseBitmap(), ipe::ImlParser::parseDocument(), ipe::ImlParser::parseObject(), ipe::ImlParser::parsePage(), and ipe::ImlParser::parseStyle().

◆ isTagChar()

bool ipe::XmlParser::isTagChar ( int  ch)

Referenced by parseAttributes(), and parseToTagX().

◆ getChar()

void ipe::XmlParser::getChar ( )

◆ eos()

bool ipe::XmlParser::eos ( )

◆ skipWhitespace()

void XmlParser::skipWhitespace ( )

References eos(), getChar(), and iCh.

Referenced by parseAttributes(), parsePCDATA(), and parseToTagX().

◆ parseToTagX()

String XmlParser::parseToTagX ( )

Parse whitespace and the name of a tag.

If the tag is a closing tag, skips > and returns with stream after that. Otherwise, returns with stream just after the tag name.

Comments and <!TAG .. > are skipped silently.

References eos(), getChar(), iCh, isTagChar(), and skipWhitespace().

Referenced by parseToTag().

Member Data Documentation

◆ iSource

DataSource& ipe::XmlParser::iSource

Referenced by getChar().

◆ iTopElement

String ipe::XmlParser::iTopElement

◆ iCh

int ipe::XmlParser::iCh

◆ iPos

int ipe::XmlParser::iPos

Referenced by getChar(), parsePosition(), and XmlParser().

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