15. XML in the OpenSCADA system (XMLNode)
XML in the OpenSACDA system is represented by the object of the XML-tag — XMLNode.
15.1. XML-tag (XMLNode)
Data:
Options for XML-file loading (enum — XMLNode::LoadFlgs):
- XMLNode::LD_Full — load XML full;
- XMLNode::LD_NoTxtSpcRemEnBeg — no remove spaces for begin and end tag's text, for not full mode.
Options of the function of XML-file generation (enum - XMLNode::SaveView):
- XMLNode::BrOpenPrev — insert the end of the line before the opening tag;
- XMLNode::BrOpenPast — insert the end of the line after the opening tag;
- XMLNode::BrClosePast — insert the end of the line after the closing tag;
- XMLNode::BrTextPast — insert the end of the line after the tag text;
- XMLNode::BrSpecBlkPast — insert the end of the line after the computed instruction;
- XMLNode::BrAllPast — insert the end of the line after the all elements;
- XMLNode::XMLHeader — insert the standard xml-header;
- XMLNode::Clean — result clean from comments and procedure insertions;
- XMLNode::XHTMLHeader — insert the standard XHTML-header;
- XMLNode::MissTagEnc — to miss for tags name encoding.
- XMLNode::MissAttrEnc — to miss for attributes name encoding.
Public methods:
- XMLNode( const string &name = "" ); — Initialization of the tag with the name name.
- XMLNode(const XMLNode &nd); — Copy constructor.
- XMLNode &operator=( const XMLNode &prm ); — Copying a branch of the XML-tree from prm.
- string name( ) const; — Tag's name.
- XMLNode* setName( const string &s ); — Setting the tag's name to s.
- string text( bool childs = false, bool recursive = false ) const; — Tag's text. childs — for text getting from special text nodes.
- XMLNode* setText( const string &s, bool childs = false ); — Setting the tag's text to s. childs — for set text to special text node.
- void attrList( vector<string> & list ) const; — The list of attributes list in the tag.
- XMLNode* attrDel( const string &name ); — Deleting of the attribute name.
- void attrClear( ); — Clear the tag's attributes.
- string attr( const string &name, bool caseSens = true ) const; — Getting the attribute name.
- XMLNode* setAttr( const string &name, const string &val ); — Setting/creation of the attribute name with the value val.
- void load( const string &vl, unsigned flg = 0, const string &cp = "UTF-8" ); — Load/parsing of the XML-file, with source encoding cp and flags flg.
- string save( unsigned flg = 0, const string &cp = "UTF-8" ); — Saving/creation of the XML-file with the formatting parameter flg and encoding to cp.
- XMLNode* clear( ); — Clear the tag (recursively, including all attachments).
- bool childEmpty( ) const; — Check for empty attached tags.
- unsigned childSize( ) const; — The number of attached tags.
- void childAdd( XMLNode *nd ); — Adding the attached tag.
- XMLNode* childAdd( const string &name = "" ); — Adding the attached tag.
- int childIns( unsigned id, XMLNode *nd ); — Insert of the attached tag to the position id.
- XMLNode* childIns( unsigned id, const string &name = "" ); — Insert of the attached tag with the name name to the position id.
- void childDel( const unsigned id ); — Deleting of the attached tag id.
- void childDel( XMLNode *nd ); — Deleting of the attached tag using its address nd.
- void childClear( const string &name = "" ); — Clear of the attached tag name.
- XMLNode* childGet( const int, bool noex = false ) const; — Getting the attached tag by its index number.
- XMLNode* childGet( const string &name, const int numb = 0, bool noex = false ) const; — Getting of the attached numb indexed tag by the tag's name name. noex indicates the prohibition of the generation of exception in the case of absence of the tag.
- XMLNode* childGet( const string &attr, const string &name, bool noex = false ) const; — Getting the attached numb indexed tag by its value name of the attribute attr. noex indicates the prohibition of the generation of exception in the case of absence of the tag.
- XMLNode* getElementBy( const string &attr, const string &val ); — Inner node search by value val of attribute attr.
- XMLNode* parent( ); — Parent tag of the tag.
- XMLNode* root( ); — Root tag of the tag.