|
Milo
0.1
Milo:EquationManipulationProgram
|
#include <xml.h>


Public Member Functions | |
| Parser (std::istream &in, const std::string &root) | |
| virtual | ~Parser () |
| bool | check (State state, const std::string &tag=std::string()) |
| Parser & | next (State state, const std::string &tag=std::string()) |
| void | finish () |
| const std::string & | getTag () const |
| bool | getAttribute (const std::string &name, std::string &value) |
| bool | hasAttributes () |
| bool | hasElement () |
| const std::string & | getElement () |
| void | syntaxError (const std::string &msg) |
Private Member Functions | |
| bool | EOL () const |
| void | next () |
| void | tokenize (std::istream &in) |
| void | tokenize (std::string xml) |
| void | parse_attributes (const std::string &nv) |
| void | parse (State &state, std::string &tag) |
Private Attributes | |
| std::vector< std::string > | m_tokens |
| Storage for XML tokens to be processed. | |
| unsigned int | m_pos |
| Index of current token being processed. | |
| std::unordered_map< std::string, std::string > | m_attributes |
| FSM | fsm |
| XML finite state machine. | |
| std::string | m_tag |
| last heder name tag processed | |
| std::string | m_element |
| last tag element processed | |
Parsing of XML tree from input stream. Inspector member functions getTag, getAttributes, getElement allow you to extract the XML information read in.
| XML::Parser::Parser | ( | std::istream & | in, |
| const std::string & | root | ||
| ) |
|
inlinevirtual |
| bool Parser::check | ( | State | state, |
| const std::string & | tag = std::string() |
||
| ) |
|
inlineprivate |
| void Parser::finish | ( | ) |
Finish parsing XML stream by classing all remaining footers. Assume that all remaining tags are footers and close them.
| bool Parser::getAttribute | ( | const std::string & | name, |
| std::string & | value | ||
| ) |
Looks for a attribute name and store its value in the argument value. All name/value pairs have been stores in m_attributes data member. If string value in name is found, store value in argument value.
| name | Name of attribute to be searched for. | |
| [out] | value | Value of attribute found. @ |
|
inline |
Return the last element in the last header/footer processed. Will be empty if no element was found.
|
inline |
Return the last tag processed by the stream. This is the current tag being processed. This is not cleared until a new header or footer is processed.
|
inline |
Checks for any attributes in the last header processed. Checks for non-empty attributes map which is clear when new header is parsed.
|
inline |
Checks for any element in last header/footer tags processed. If an element was found in last header/footer tag it is stored in m_element.
|
private |
|
private |
Parses the current token and save result in state and tag arguments. Will parse the current token, m_tokens[m_pos], and return the corresponding state and tag if appropiate. Mostly a helper function for Parser::next().
| [out] | state | Loaded with state of the current token. |
| [out] | tag | Loaded with tag of current token if appropiate otherwise empty. |
|
private |
Parses the attributes of a header tag. Expects a string containing name="value" pairs separated by white space. It then populates the m_attributes map with these name value pairs.
| nv | String containing mulitple name="value" pairs seperated by whitespace. |
| void Parser::syntaxError | ( | const std::string & | msg | ) |
|
private |
Tokenize the entire XML input stream. Reads from the stream tokenizing it. It reads line by line until it finds the character that will end the current XML tag which is then tokenized. Carriage returns are perserved and can be in name, value pairs and element tags.
| in | Character input stream containing XML. |
|
private |
Helper function for tokenize(std::istream&). This function is passed substrings which are further processed into tokens.
| xml | Substring from XML input stream. |
|
private |
Map of attributes of last header processed. The name/value pairs of the attributes from the last header processed, i.e. text="foo".
1.8.11