4D v16.3DOM Parse XML source |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
DOM Parse XML source
DOM Parse XML source
The DOM Parse XML source command parses a document containing an XML structure and returns a reference for this document. The command can validate (or not) the document via a DTD or an XML schema (XML Schema Definition (XSD) document). Note: Execution of the DOM Parse XML source command is synchronous. In the document parameter, you can pass:
The Boolean parameter validation indicates whether or not to validate the structure.
If you pass True in validation and omit the third parameter, the command attempts to validate the XML structure via a DTD or XSD reference found in the structure itself. Validation can be indirect: if the structure contains a reference to a DTD file that itself contains a reference to an XSD file, the command attempts to carry out both validations. The third parameter indicates a specific DTD or an XML schema for document parsing. If you use this parameter, the command does not take the DTD referred to in the XML document into account. Validation by DTD
Validation by schema If validation cannot be performed (no DTD or XSD, incorrect URL, etc.), an error is generated. The Error system variable indicates the error number. You can intercept this error using a method installed by the ON ERR CALL command. The command returns a 16-character string (ElementRef) making up the reference in the memory of the document virtual structure. This reference should be used with other XML parsing commands. Important: Once you no longer have any need for it, remember to call the DOM CLOSE XML command with this reference in order to free up the memory. Opening an XML document located on disk, without validation: $xml_Struct_Ref:=DOM Parse XML source("C:\\import.xml") Opening an XML document located next to the database structure file, without validation: $xml_Struct_Ref:=DOM Parse XML source("import.xml") Opening an XML document located on disk and validation using a DTD on the disk: $xml_Struct_Ref:=DOM Parse XML source("C:\\import.xml";True;"C:\\import_dtd.xml") Opening an XML document located at a specific URL, without validation: $xml_Struct_Ref:=DOM Parse XML source("http://www.4D.com/xml/import.xml") If the command has been correctly executed, the system variable OK is set to 1. Otherwise, it is set to 0.
See also
|
PROPERTIES
Product: 4D HISTORY
Modified: 4D v11 SQL ARTICLE USAGE
4D Language Reference ( 4D v16) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||