//======================================================================= /// <summary> /// Creates a driving property object using the XML describing the property. /// </summary> /// <param name="sXML">XML for the driving property containing the DDML type.</param> //======================================================================= public TCompDriver(String sXML) { TSDMLParser parser; XmlNode anode; String sBuf; sDescr = ""; sFullDescr = ""; parser = new TSDMLParser(sXML); anode = parser.firstElementChild(parser.rootNode(), "type"); initType = new TDDMLValue(parser, anode, ""); FName = parser.getAttrValue(parser.rootNode(), "name"); initType.Name = FName; sDescr = parser.getAttrValue(parser.rootNode(), "descr"); FMinConn = 1; // Default sBuf = parser.getAttrValue(parser.rootNode(), "minsrc"); if (sBuf.Trim().Length > 0) { FMinConn = Convert.ToInt32(sBuf); } FMaxConn = 1; // Default sBuf = parser.getAttrValue(parser.rootNode(), "maxsrc"); if (sBuf.Trim().Length > 0) { FMaxConn = Convert.ToInt32(sBuf); } anode = parser.firstElementChild(parser.rootNode(), "description"); if (anode != null) { sFullDescr = parser.getText(anode); } }
//======================================================================= /// <summary> /// Creates a component property from the XML description of a property. /// </summary> /// <param name="sXML">XML for the property containing the DDML type. e.g. /// <property name="name" access="read" init="F"> /// <type kind="string"><defval></defval> /// </type> /// </property> /// </param> //======================================================================= public TCompProperty(String sXML) { TSDMLParser parser; String access; XmlNode anode; //create a parser. (not very nice creating a second parser but....) parser = new TSDMLParser(sXML); anode = parser.firstElementChild(parser.rootNode(), "type"); InitValue = new TInitValue(parser, anode, ""); bRead = false; bWrite = false; bInit = false; sDescr = ""; sFullDescr = ""; Name = parser.getAttrValue(parser.rootNode(), "name"); InitValue.Name = Name; sDescr = parser.getAttrValue(parser.rootNode(), "descr"); access = parser.getAttrValue(parser.rootNode(), "access"); if (access == "both") { bRead = true; bWrite = true; } if ((access == "read") || (access.Length == 0)) { bRead = true; } if (access == "write") { bWrite = true; } if (parser.getAttrValue(parser.rootNode(), "init") == "T") { bInit = true; initialiseMembers(InitValue); } anode = parser.firstElementChild(parser.rootNode(), "description"); if (anode != null) { sFullDescr = parser.getText(anode); } }