XML API Statements

XMLProcessorHandle = XMLProcessor(ClassFactory);


Creates a new XML Processor. To destroy an XML Processor, simply invalidate the last reference to it.  If ClassFactory is valid it must be a module value to which all the data types, as specified by the schemas in the cache, can be added. It is recommended that this simply be an empty module with no code or variables.

If ClassFactory is a valid module value, the XML Processor will be a validating processor, otherwise the XML Processor will be a non-validating processor.

 

Succeeded = XMLAddSchema(XMLProcessorHandle, NamespaceURI, URL[, ErrorMessageOut])


Adds a schema to an XML Processor.  Each schema will be validated for standards conformance before being added to the cache.  NamespaceURI is a URI that specifies the namespace that the schema represents.  URL is the URL to fetch the schema from.  Returns 0 if it succeeds.  Otherwise returns a numeric specifying a Windows error code and sets the variable named in the optional ErrorMessageOut parameter to a text error message.  If the schema load succeeds, the types identified by the schema are added to the factory.

Succeeded = XMLParse(XMLProcessorHandle, XML, [, ErrorMessageOut [, InstanceOut]])

 

Parses the supplied XML using the specified XML Processor.  The XML may be either a stream or a text value.  If the text supplied (either in the text value or the stream) is identifiable as a URL, the XML is fetched from that URL. Returns 0 if it succeeds.  Otherwise returns a numeric specifying a Windows error code and sets the variable named in the optional ErrorMessageOut parameter to a text error message.

If InstanceOut is supplied, it must be a variable into which the object value of the instance created by parsing the XML will be placed. If the XML can be parsed, then this will receive a valid module tree, even if the actual validation fails. (i.e. to be considered valid, XML must pass more tests than simply whether or not it can be parsed) .

Succeeded = XMLWrite(XMLProcessorHandle, InstanceIn, XMLOut[, ErrorMessageOut])

Converts the instance of a type, specified by InstanceIn into XML.  The XML is in the form of a stream and is inserted to the stream passed in XMLOut, starting at its current position.  If XMLOut does not contain a stream, a new BufferStream is created and returned in XMLOut.  Returns 0 if it succeeds.  Otherwise returns a numeric specifying a Windows error code and sets the variable named in the optional ErrorMessageOut parameter to a text error message