The wwXMLState class allows you to add and retrieve properties easily from an XML string with a couple of simple lines of code.
Example:
SET PROCEDURE TO wwXMLState
USE SomeTable
o = CREATEOBJECT("wwXMLState")
* **Set a value
o.LoadXML(SomeTable.XMLPropertiesMemo)
o.SetProperty("testproperty","new value","string","Testing")
REPLACE SomeTable.XMLPropertiesMemo with o.cXML
* **Retrieve a value
o.cXML = SomeTable.XMLPropertiesMemo
lcValue = o.GetProperty("testproperty")
The XML format for the property storage looks like this:
<properties>
<Test type="string" description="Test Value">Test Value</Test>
<Number type="float">123.33</Number>
<Bool type="boolean">1</Bool><Bool2 type="boolean">0</Bool2>
<date type="datetime">12/28/2000</date>
<datetime type="datetime">12/28/2000 1:07:25 AM</datetime>
</properties>
Based on: Relation Stored in: wwXMLState
Remarks
Requires the MSXML 3.0 parser in order to work. Note: Version 4.x and later of the MSXML parser may not work correctly due to some changes with the XPATH default namespaces.
The oDOM property is loaded in the Init of the class, so if you want to avoid reloading this object for every use of this class you should persist this object.
Class Members
Member | Description | |
---|---|---|
GetProperty |
Retrieves a property from the XML state store string stored in cXML. o.GetProperty(lcProperty) |
|
GetXML |
Returns the content of the current XML property state as a string. This vaue contains XML with all the properties. o.GetXML() |
|
LoadXML |
Loads an XML string or loads an XML document from a URL or file. o.LoadXML(lcXML, llUrl) |
|
SaveXML |
Saves the XML content to a file. o.SaveXML(lcFileName) |
|
SetProperty |
Sets a property in the XML state store saved in the cXML property. o.SetProperty(lcProperty, lcValue, lcType, lcDescription) |
|
cRootNode |
The name of the root node in the property storage XML. This will be the XML document root element. |
Requirements
Assembly: wwXmlState.prgSee also:
Class wwXMLState© West Wind Technologies, 1996-2024 • Updated: 08/21/15
Comment or report problem with topic