|
PLCnext API Documentation 24.0.0.71
|
Class to read an XML File. Non buffered reader, can only read forward More...
#include <XmlReader.hpp>
Public Member Functions | |
| XmlReader (void) | |
| Default contructor. | |
| XmlReader (XmlReader &&arg) | |
| Move contructor. | |
| ~XmlReader (void) | |
| Destructs this instance and frees all resources. | |
| String | GetElementLocalName (void) |
| Reads the local name of the current active element More... | |
| long | GetLineNumber () |
| Gets the actual line number of this XML reader More... | |
| const String & | GetDocumentFileName () |
| Gets the current document filename of this XML reader More... | |
| bool | Read () |
| Reads to the next element inside the xml file More... | |
| XmlNodeType | GetCurrentNodeType () |
| gets the type of the current xml element More... | |
| bool | IsEmptyElement () |
| test if the current element is an empty element More... | |
| int | GetCurrentDepth () |
| gets the current depth of the current element inside the xml document More... | |
| bool | Skip () |
| skips the current element with its whole subtree (use SkipElement() because naming is more clear) More... | |
| bool | SkipElement () |
| skips the current element with its whole subtree More... | |
| bool | SkipElementContent () |
| skips the content of current element with its whole subtree but does not read end element tag More... | |
| bool | MoveToElement () |
| Moves the position of the current instance to the node that contains the current Attribute node. More... | |
| bool | ReadToFollowing (const String &name) |
| reads the xml file until an element with name is reached or end of file is reached More... | |
| bool | ReadToDescendant (const String &name) |
| reads the xml file until an element with name is reached or the current element is closed reads to the next element with name included in current element More... | |
| bool | ReadToNextSibling (const String &name) |
| reads to the next element with name which is a sibling of the current element More... | |
| void | ReadStartElement (const char *elementName=nullptr) |
| reads to the next element and test if this is a start element with the given name More... | |
| bool | TryReadStartElement (const char *elementName=nullptr) |
| trys to read the next element and test if this is a start element with the given name More... | |
| bool | TryReadStartElement (String &elementName, bool conditioned=true) |
| trys to read the next element and returns the read element name as out argument More... | |
| void | ReadEndElement (void) |
| reads until the next end element is reached skips over an empty element | |
| bool | TryReadEndElement (void) |
| tries to read until the next end element is reached skips over an empty element More... | |
| String | ReadElementContent (void) |
| reads the content of the current element if a CDATA section is found, the CDATA enclosure is removed More... | |
| template<class T > | |
| T | ReadElementContent () |
| reads the content of the current element if a CDATA section is found, the CDATA enclosure is removed More... | |
| template<class T > | |
| T | GetAttributeValue (const char *attributeName) |
| reads an attribute value from the current element More... | |
| template<class T > | |
| Enum< T > | GetAttributeValueEnum (const char *attributeName) |
| reads an attribute value from the current element and converts the String to Enum<T> More... | |
| template<class T > | |
| T | GetAttributeValueOfEnum (const char *attributeName) |
| reads an attribute value from the current element and converts the String to Enum<T> More... | |
| template<class T > | |
| bool | TryGetAttributeValueEnum (const char *attributeName, T &value) |
| trys reads an attribute value from the current element and converts the String to Enum<T> More... | |
| template<class T > | |
| bool | TryGetAttributeValueEnum (const char *attributeName, Enum< T > &value) |
| trys reads an attribute value from the current element and converts the String to Enum<T> More... | |
| template<class T > | |
| bool | TryGetAttributeValueEnum (const char *attributeName, T defaultValue, Enum< T > &value) |
| tries to read an attribute value from the current element as enum if the attribute was not found or the conversation fails a defaultValue is used More... | |
| template<class T > | |
| T | GetAttributeValueDuration (const char *attributeName) |
| reads an attribute value from the current element and converts the String to std::chrono::duration i.e. Microseconds More... | |
| template<class T > | |
| bool | TryGetAttributeValueDuration (const char *attributeName, T &value) |
| trys reads an attribute value from the current element and converts the String to std::chrono::duration i.e. Microseconds More... | |
| template<class T > | |
| bool | TryGetAttributeValueDuration (const char *attributeName, T defaultValue, T &value) |
| tries to read an attribute value from the current element as std::crono::duration if the attribute was not found or the conversation fails a defaultValue is used More... | |
| template<class T > | |
| bool | TryGetAttributeValue (const char *attributeName, T &value) |
| tries to read an attribute value from the current element More... | |
| template<class T > | |
| bool | TryGetAttributeValue (const char *attributeName, T defaultValue, T &value) |
| tries to read an attribute value from the current element if the attribute was not found or the conversation fails a defaultValue is used More... | |
| void | EnableValidationException () |
| void | DisableValidationException () |
| template<typename... Args> | |
| XmlException | CreateException (const char *message, const Args &... args) |
| Creates an exception by prefixing the given message with current doc name and line number More... | |
| template<> | |
| bool | TryGetAttributeValue (const char *, bool &value) |
| template<> | |
| bool | TryGetAttributeValue (const char *attributeName, String &value) |
| template<> | |
| bool | TryGetAttributeValue (const char *attributeName, Chrono::Duration &value) |
| template<> | |
| bool | TryGetAttributeValue (const char *attributeName, uint8 &value) |
| template<> | |
| bool | TryGetAttributeValue (const char *attributeName, int8 &value) |
Static Public Member Functions | |
| static XmlReader | Create (const String &filename) |
| Creates a new Instance of the XmlReader More... | |
| static bool | TryCreate (const String &filename, XmlReader &reader) |
| Tries to creates a new Instance of the XmlReader More... | |
| static XmlReader | Create (const String &filename, const String &xsdFile) |
| Creates a new Instance of the XmlReader and enables Schema validation with the XSD schema at xsdFile More... | |
| static XmlReader | CreateForString (const String &buffer) |
| Creates a new Instance of the XmlReader reading from an in memory buffer More... | |
Class to read an XML File. Non buffered reader, can only read forward
Creates a new Instance of the XmlReader
| filename | The Filename the writer uses to write the xml data
|
|
static |
Creates a new Instance of the XmlReader and enables Schema validation with the XSD schema at xsdFile
| filename | The Filename the writer uses to write the xml data |
| xsdFile | Path to the XSD File with the XMl schema. the scheme is verified as the xml file is processed, so in every read call an schema error can occur |
| XmlException |
|
inline |
Creates an exception by prefixing the given message with current doc name and line number
| message | The message format of the exception message |
| args | The fomrat arguments to be inserted into message. |
|
static |
Creates a new Instance of the XmlReader reading from an in memory buffer
| buffer | Reference to the buffer to read from |
| XmlException |
|
inline |
reads an attribute value from the current element
| attributeName | the name of the attribute to read |
| XmlException | if the attribute was not found, or the conversion failed |
|
inline |
reads an attribute value from the current element and converts the String to std::chrono::duration i.e. Microseconds
| attributeName | the name of the enum attribute to read |
| XmlException | if the attribute was not found, or the conversion failed |
|
inline |
reads an attribute value from the current element and converts the String to Enum<T>
| attributeName | the name of the enum attribute to read |
| XmlException | if the attribute was not found, or the conversion failed |
|
inline |
reads an attribute value from the current element and converts the String to Enum<T>
| attributeName | the name of the enum attribute to read |
| XmlException | if the attribute was not found, or the conversion failed |
| int Arp::System::Commons::Xml::XmlReader::GetCurrentDepth | ( | ) |
gets the current depth of the current element inside the xml document
| XmlNodeType Arp::System::Commons::Xml::XmlReader::GetCurrentNodeType | ( | ) |
gets the type of the current xml element
|
inline |
Gets the current document filename of this XML reader
| String Arp::System::Commons::Xml::XmlReader::GetElementLocalName | ( | void | ) |
Reads the local name of the current active element
| long Arp::System::Commons::Xml::XmlReader::GetLineNumber | ( | ) |
Gets the actual line number of this XML reader
| bool Arp::System::Commons::Xml::XmlReader::IsEmptyElement | ( | ) |
test if the current element is an empty element
| bool Arp::System::Commons::Xml::XmlReader::MoveToElement | ( | ) |
Moves the position of the current instance to the node that contains the current Attribute node.
| bool Arp::System::Commons::Xml::XmlReader::Read | ( | ) |
Reads to the next element inside the xml file
|
inline |
reads the content of the current element if a CDATA section is found, the CDATA enclosure is removed
| String Arp::System::Commons::Xml::XmlReader::ReadElementContent | ( | void | ) |
reads the content of the current element if a CDATA section is found, the CDATA enclosure is removed
| void Arp::System::Commons::Xml::XmlReader::ReadStartElement | ( | const char * | elementName = nullptr | ) |
reads to the next element and test if this is a start element with the given name
| elementName | name against which the name of the start element is tested, if elementName is null the test is omitted |
| bool Arp::System::Commons::Xml::XmlReader::ReadToDescendant | ( | const String & | name | ) |
reads the xml file until an element with name is reached or the current element is closed reads to the next element with name included in current element
| name | name of the descendant element to move to |
| bool Arp::System::Commons::Xml::XmlReader::ReadToFollowing | ( | const String & | name | ) |
reads the xml file until an element with name is reached or end of file is reached
| name | name of the element to move to |
| bool Arp::System::Commons::Xml::XmlReader::ReadToNextSibling | ( | const String & | name | ) |
reads to the next element with name which is a sibling of the current element
| name | name of the sibling element to move to |
| bool Arp::System::Commons::Xml::XmlReader::Skip | ( | ) |
skips the current element with its whole subtree (use SkipElement() because naming is more clear)
| bool Arp::System::Commons::Xml::XmlReader::SkipElement | ( | ) |
skips the current element with its whole subtree
| bool Arp::System::Commons::Xml::XmlReader::SkipElementContent | ( | ) |
skips the content of current element with its whole subtree but does not read end element tag
|
static |
Tries to creates a new Instance of the XmlReader
| filename | The Filename the writer uses to write the xml data
|
|
inline |
tries to read an attribute value from the current element
| attributeName | the name of the attribute to read |
| value | where to store the value of the attribute |
|
inline |
tries to read an attribute value from the current element if the attribute was not found or the conversation fails a defaultValue is used
| attributeName | the name of the attribute to read |
| defaultValue | the default value to use in case of an error |
| value | where to store the value of the attribute |
|
inline |
trys reads an attribute value from the current element and converts the String to std::chrono::duration i.e. Microseconds
| attributeName | the name of the enum attribute to read |
| value | the value of the enum attribute with attributeName converted to std::chrono::duration |
|
inline |
tries to read an attribute value from the current element as std::crono::duration if the attribute was not found or the conversation fails a defaultValue is used
| attributeName | the name of the attribute to read |
| defaultValue | the default value to use in case of an error |
| value | where to store the value of the attribute |
|
inline |
trys reads an attribute value from the current element and converts the String to Enum<T>
| attributeName | the name of the enum attribute to read |
| value | the value of the enum attribute with attributeName converted to Enum<T> |
| XmlException | if the attribute was not found, or the conversion failed |
|
inline |
trys reads an attribute value from the current element and converts the String to Enum<T>
| attributeName | the name of the enum attribute to read |
| value | the value of the enum attribute with attributeName converted to Enum<T> |
| XmlException | if the attribute was not found, or the conversion failed |
|
inline |
tries to read an attribute value from the current element as enum if the attribute was not found or the conversation fails a defaultValue is used
| attributeName | the name of the attribute to read |
| defaultValue | the default value to use in case of an error |
| value | where to store the value of the attribute |
| bool Arp::System::Commons::Xml::XmlReader::TryReadEndElement | ( | void | ) |
tries to read until the next end element is reached skips over an empty element
| bool Arp::System::Commons::Xml::XmlReader::TryReadStartElement | ( | const char * | elementName = nullptr | ) |
trys to read the next element and test if this is a start element with the given name
| elementName | name against which the name of the start element is tested, if elementName is null the test is omitted |
| bool Arp::System::Commons::Xml::XmlReader::TryReadStartElement | ( | String & | elementName, |
| bool | conditioned = true |
||
| ) |
trys to read the next element and returns the read element name as out argument
| elementName | the current element name if a start element tag could be read. |