|
Open PaperOpt
|
#include <XMLParser.h>
This class implements an XML pull parser. It is built on top of irrXML. Functions are provided to get the next element (skipping end tags, comments etc) and for parsing some of the basic types defined in the XML Schema.
A stack mechanism is used to prevent functions from reading beyond an endtag. Before a function handling an element is called, the tag name is pushed onto the stack. when the function returns the tag name is popped.
| XMLParser::XMLParser | ( | ) |
Constructor
| XMLParser::~XMLParser | ( | ) |
Destructor
| string XMLParser::getAttribute | ( | string | s | ) |
Gets an attribute of the current element. Note that any namespace declarations in the attribute are not considered a part of the attribute name.
I.e. getAttribute("type") will return the correct value even if the attribute is really called "xsi:type" or "asd:type" etc.
| s | name of the attribute to be returned. |
| float XMLParser::getAttributeAsFloat | ( | string | s | ) |
Gets an attribute of the current element as a float.
| s | name of the attribute to be returned. |
| an | exception if the attribute does not exist or if it could not be read. |

| int XMLParser::getAttributeAsInt | ( | string | s | ) |
Gets an attribute of the current element.
| s | name of the attribute to be returned. |
| string XMLParser::getElementName | ( | ) |
This method will return the name of the current tag.
| string XMLParser::getNextText | ( | void | ) |
This method is used to parse the text between a start tag and an end tag. This method should only be called if it is known that there is a text node after the tag the parses is currently at.
| void XMLParser::init | ( | string | xmlFile | ) |
This method initiates the XMLParser and should be called before using it.
| xmlFile | name of the XML file. |
| bool XMLParser::isCurElement | ( | char * | elm | ) |
Used to check which element the parser is at.
| elm | the name of the element to be checked against current. |
| BinaryFile * XMLParser::parseBinaryFile | ( | ) |
Parses a binaryFile element.
| bool XMLParser::parseBool | ( | ) |
Parses a bool element.
| DistributionComponents * XMLParser::parseComponentsDistribution | ( | ) |
Parses an componentsDistribution element.

| DistributionConstant * XMLParser::parseConstantDistribution | ( | ) |
Parses a constantDistribution element.
| Distribution * XMLParser::parseDistribution | ( | ) |
Parses a tableDistribution,ellipticDistribution, constantDistribution
| DistributionElliptic * XMLParser::parseEllipticDistribution | ( | ) |
Parses an ellipticDistribution element.
| float XMLParser::parseFloat | ( | ) |
Parses a float element.
| Array2D< float > * XMLParser::parseFloatArray | ( | ) |
Parses an floatArray element.

| int XMLParser::parseFloatList | ( | vector< float > & | list | ) |
Parses a floatList element.
| list | reference to the vector<float> where the values will be put. |
| Fluorescence * XMLParser::parseFluorescence | ( | vector< float > & | rLambda | ) |
Parses a fluorescence element.
| rLambda | the simulation wavelengths. |

| Array2D< float > * XMLParser::parseHeightMap | ( | float & | sizeX, |
| float & | sizeY | ||
| ) |
Parses a heightMap element.
| sizeX | pointer to a float that will be set to the size of the surface in X dir. |
| sizeY | pointer to a float that will be set to the size of the surface in Y dir. |
| int XMLParser::parseInt | ( | ) |
Parses an int element.
| reflectanceParameters * XMLParser::parseReflectance | ( | vector< float > & | rLambda | ) |
Parses a reflectance element.
| rLambda | the simulation wavelengths. |
| ScatteringParameters * XMLParser::parseScatteringProperties | ( | vector< float > & | rLambda | ) |
Parses a scatteringProperties element.
| string XMLParser::parseString | ( | ) |
Parses a string element.
| DistributionTable * XMLParser::parseTableDistribution | ( | ) |
Parses a tableDistribution element.

| TextFile * XMLParser::parseTextFile | ( | ) |
Parses a textFile element.
Parses a V3FloatArray element.

| void IO::XMLParser::popEndTag | ( | ) | [inline] |
Pops the tag that is on top of the stack.

| void IO::XMLParser::pushEndTag | ( | string | s | ) | [inline] |
Pushes a new end tag on the stack.
| s | name of the tag that will be pushed on the stack. |

| bool XMLParser::readNextTag | ( | ) |
Advances the parser to the next start tag, skipping comments and end tags. Will return false if it has reached the current endTag or if end of file has been reached.
