Jameo Core Library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
jm::SAXParser Class Reference

This class represents an XML/HTML parser based on the SAX (Simple API for XML) principle. The advantage lies in the serial processing of tags. This abstract base class must be derived by the parsers and implement some methods. More...

Inheritance diagram for jm::SAXParser:
jm::Object

Public Member Functions

 SAXParser ()
 Constructor.
 
 ~SAXParser () override=default
 Destructor.
 
void parse (File &file)
 This method parses the given file.
 
void parse (const String &xml)
 This method parses the given string, which should be XML code.
 
virtual void characters (const String &characters)
 This method is called by the parser when it encounters letters.
 
virtual void endDocument ()
 This method is called by the parser when the end of the document is reached.
 
virtual void endElement (const String &uri, const String &localName, const String &qName)
 This method is called by the parser when the end of an element is reached.
 
virtual void endPrefixMapping (const String &prefix)
 End the scope of a prefix-URI mapping.
 
virtual void ignorableWhiteSpaces (const String &characters)
 This method is called by the parser when ignorable white spaces are encountered.
 
virtual void processingInstruction (const String &target, const String &data)
 Receive notification of a processing instruction.
 
virtual void skippedEntity (const String &name)
 Receive notification of a skipped entity.
 
virtual void startDocument ()
 This method is called at the beginning of the document.
 
virtual void startElement (const String &uri, const String &localName, const String &qName, const SAXAttributes &attributes)
 This method is called at the beginning of an element.
 
- Public Member Functions inherited from jm::Object
 Object () noexcept
 Constructor.
 
virtual ~Object () noexcept
 Destructor.
 
void release () noexcept
 Decreases the reference counter and releases the object immediately when the reference counter becomes 0.
 
Objectretain () noexcept
 Increases the reference counter of this object by 1.
 
Objectautorelease () noexcept
 Same function as release(), but releases the object with a delay if the reference counter is 0. AutoreleasePool::drain() must be called in the to release the object.
 
int32 referenceCount () const noexcept
 Returns the value of the reference counter.
 
virtual bool equals (const Object *other) const
 Comparison of objects.
 
virtual String displayName () const
 Returns the display name of the object intended to present to a user.
 
virtual void printDiffInfo (DiffOperation operation, Object *other) const
 Output method for outputting the diff results for the diff algorithm.
 
void setHighBit (bool status) noexcept
 
bool highBit () const noexcept
 

Detailed Description

This class represents an XML/HTML parser based on the SAX (Simple API for XML) principle. The advantage lies in the serial processing of tags. This abstract base class must be derived by the parsers and implement some methods.

Constructor & Destructor Documentation

◆ SAXParser()

jm::SAXParser::SAXParser ( )

Constructor.

◆ ~SAXParser()

jm::SAXParser::~SAXParser ( )
overridedefault

Destructor.

Member Function Documentation

◆ characters()

virtual void jm::SAXParser::characters ( const String characters)
virtual

This method is called by the parser when it encounters letters.

Parameters
charactersThe characters.

◆ endDocument()

virtual void jm::SAXParser::endDocument ( )
virtual

This method is called by the parser when the end of the document is reached.

◆ endElement()

virtual void jm::SAXParser::endElement ( const String uri,
const String localName,
const String qName 
)
virtual

This method is called by the parser when the end of an element is reached.

Parameters
uriThe URI of the element.
localNameThe local name of the element.
qNameThe qualified name of the element.

◆ endPrefixMapping()

virtual void jm::SAXParser::endPrefixMapping ( const String prefix)
virtual

End the scope of a prefix-URI mapping.

Parameters
prefixThe prefix that was being mapped.

◆ ignorableWhiteSpaces()

virtual void jm::SAXParser::ignorableWhiteSpaces ( const String characters)
virtual

This method is called by the parser when ignorable white spaces are encountered.

Parameters
charactersThe characters.

◆ parse() [1/2]

void jm::SAXParser::parse ( const String xml)

This method parses the given string, which should be XML code.

Parameters
xmlThe XML code to parse.

◆ parse() [2/2]

void jm::SAXParser::parse ( File file)

This method parses the given file.

Parameters
fileThe file to parse.

◆ processingInstruction()

virtual void jm::SAXParser::processingInstruction ( const String target,
const String data 
)
virtual

Receive notification of a processing instruction.

◆ skippedEntity()

virtual void jm::SAXParser::skippedEntity ( const String name)
virtual

Receive notification of a skipped entity.

◆ startDocument()

virtual void jm::SAXParser::startDocument ( )
virtual

This method is called at the beginning of the document.

◆ startElement()

virtual void jm::SAXParser::startElement ( const String uri,
const String localName,
const String qName,
const SAXAttributes attributes 
)
virtual

This method is called at the beginning of an element.

Parameters
uriThe URI of the element.
localNameThe local name of the element.
qNameThe qualified name of the element.
attributesThe attributes of the element.