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 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::BrPrcInstrPast - 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 xml-header with the version;
- XMLNode::InclNode - service flag for the identification of the root of XML-tree while saving.
- 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 &operator=( 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( ) const; - Tag's text.
- XMLNode* setText( const string &s ); - Setting the tag's text to <s>.
- 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 ) const; - Getting the attribute <name>.
- XMLNode* setAttr( const string &name, const string &val ); - Setting/creation of the attribute <name> with the value <val>.
- void prcInstrList( vector<string> &list ) const; - List of executable instructions <list> in the tag.
- void prcInstrDel( const string &target ); - Deleting of the executable instruction <target> from the tag.
- void prcInstrClear( ); - Clear the tag's instructions.
- string prcInstr( const string &target ) const; - Getting the executable instruction <target> of the tag.
- XMLNode* setPrcInstr( const string &target, const string &val ); - Setting the executable instruction of the tag <target>.
- void load( const string &vl ); - Load/parsing of the XML-file.
- string save( unsigned char flgs = 0 ); - Saving/creation of the XML-file with the formatting parameter <flgs>.
- XMLNode* clear( ); - Clear the tag (recursively, including all attachments).
- bool childEmpty( ) const; - Check for empty attached tags.
- int 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* parent( ); - Parent tag of the tag.