PLCnext API Documentation 25.0.2.69
Public Member Functions | Static Public Attributes | Friends | List of all members
Arp::System::Commons::Xml::XmlSerializationContext Class Reference

XML context used during XML reading and writing to hold the context information More...

#include <XmlSerializationContext.hpp>

Inheritance diagram for Arp::System::Commons::Xml::XmlSerializationContext:
Inheritance graph

Public Member Functions

 XmlSerializationContext (XmlConfigDocument &document, Version docSchemaVersion=Version(1, 0))
 Constructs an XmlContext instance.
 
 XmlSerializationContext (XmlSerializationContext &arg)=default
 Copy contructor.
 
XmlSerializationContextoperator= (XmlSerializationContext &arg)=default
 Assignment operator.
 
 ~XmlSerializationContext (void)=default
 Destructs this instance and frees all resouces.
 
Stringoperator[] (const String &attributeName)
 operator [] to get and set attributes referenced by attributeName
 
const Stringoperator[] (const String &attributeName) const
 operator [] to get attributes referenced by attributeName
 
Version GetDocumentSchemaVersion (void) const
 returns the document schema version stored in this context More...
 
XmlConfigDocumentGetDocument (void)
 return the XmlConfigDocument this context was created for
 
void ReadDocumentContext (XmlReader &reader)
 reads the document context i.e. schema version from the XMlReader More...
 
void WriteDocumentContext (XmlWriter &writer) const
 writes the document context i.e. schema version with the XMlWriter More...
 
void InvalidXmlElementOccurs (XmlReader &reader, const char *xmlElementName)
 this operation should be called while xml serialisation when an unknown xml element is recognized More...
 
void MissingXmlElementOccurs (XmlReader &reader, const char *xmlElementName)
 this operation should be called while xml serialisation when ever an xml element is missing More...
 
void ReadIncludesElement (XmlReader &reader)
 Reads the include xml tags inside a configuration file to include further xml files
 
String ResolvePath (const char *documentPath)
 resolves a relative path into an absolute relative to the document path and replaces all placeholders
 
String ResolveRelativePath (const String &path)
 resolves a relative path into an absolute relative to the document path
 
String ResolvePlaceholder (const char *input)
 resolves a string with a placeholder (Enviroment variables)
 
DocumentTraits DetermineDocumentTraits (XmlReader &reader) const
 Determine document traits by checking if traits are already set.
 
void AddIncludeFile (const String &pathArg, const DocumentTraits &traits)
 Adds a xml file to the list of included files
 
void AddAttribute (const String &attributeName, const String &value)
 Adds an attribute to the context
 
bool HasAttribute (const String &attributeName)
 Checks if an attribute exists
 
bool HasAttributeValue (const String &attributeName, const String &expectedValue)
 Compares an attribute value
 
String GetAttributeValue (const String &attributeName)
 Returns an attribute value
 
const DocumentTraitsGetDocumentTraits (void) const
 Returns the traits of the current document
 

Static Public Attributes

static const char * IncludeXmlName = "Include"
 
static const char * IncludesXmlName = "Includes"
 

Friends

class MultiXmlConfigDocument
 

Detailed Description

XML context used during XML reading and writing to hold the context information

Member Function Documentation

◆ GetDocumentSchemaVersion()

Version Arp::System::Commons::Xml::XmlSerializationContext::GetDocumentSchemaVersion ( void  ) const

returns the document schema version stored in this context

The document schema version is read by ReadDocumentContext

Returns
the document schema version

◆ InvalidXmlElementOccurs()

void Arp::System::Commons::Xml::XmlSerializationContext::InvalidXmlElementOccurs ( XmlReader reader,
const char *  xmlElementName 
)

this operation should be called while xml serialisation when an unknown xml element is recognized

if the schema version of the file is greater then the schema version implemented a warning is logged otherwise a XmlException is thrown

◆ MissingXmlElementOccurs()

void Arp::System::Commons::Xml::XmlSerializationContext::MissingXmlElementOccurs ( XmlReader reader,
const char *  xmlElementName 
)

this operation should be called while xml serialisation when ever an xml element is missing

Exceptions
XmlExceptionIs thrown

◆ ReadDocumentContext()

void Arp::System::Commons::Xml::XmlSerializationContext::ReadDocumentContext ( XmlReader reader)

reads the document context i.e. schema version from the XMlReader

is used by XmlConfigDocument

◆ WriteDocumentContext()

void Arp::System::Commons::Xml::XmlSerializationContext::WriteDocumentContext ( XmlWriter writer) const

writes the document context i.e. schema version with the XMlWriter

is used by XmlConfigDocument


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