Difference between revisions of "XML"

From Lianjapedia
Jump to: navigation, search
Line 49: Line 49:
  
 
==XQuery functions==
 
==XQuery functions==
* [[XQUERY()]] Function to parse XML strings using XQuery notation.
+
* [[XQUERY()]] Function to parse XML strings using XPath notation.
  
 
* [[XQUERY_ATTRIBUTES()]] - Function to find and return a complete XML node and its attributes from a file previously opened using [[XQUERY_OPEN()]].
 
* [[XQUERY_ATTRIBUTES()]] - Function to find and return a complete XML node and its attributes from a file previously opened using [[XQUERY_OPEN()]].
Line 59: Line 59:
 
* [[XQUERY_DECODE()]] Function to return an object from an XML string.
 
* [[XQUERY_DECODE()]] Function to return an object from an XML string.
  
* [[XQUERY_FILE()]] Function to parse XML files using XQuery notation.
+
* [[XQUERY_FILE()]] Function to parse XML files using XPath notation.
  
 
* [[XQUERY_FIND()]] - Function to find and return an XML node value from a file previously opened using [[XQUERY_OPEN()]].
 
* [[XQUERY_FIND()]] - Function to find and return an XML node value from a file previously opened using [[XQUERY_OPEN()]].
Line 65: Line 65:
 
* [[XQUERY_NODE()]] - Function to find and return an XML node value from a file previously opened using [[XQUERY_OPEN()]].
 
* [[XQUERY_NODE()]] - Function to find and return an XML node value from a file previously opened using [[XQUERY_OPEN()]].
  
* [[XQUERY_OPEN()]] - Function to open an XML file for parsing using XQuery notation.
+
* [[XQUERY_OPEN()]] - Function to open an XML file for parsing using XPath notation.
  
 
* [[XQUERY_SELECT()]] - Function to query nodes by attribute and value from a file previously opened using [[XQUERY_OPEN()]].  
 
* [[XQUERY_SELECT()]] - Function to query nodes by attribute and value from a file previously opened using [[XQUERY_OPEN()]].  

Revision as of 05:05, 1 March 2016

Extensible Markup Language (XML) allows data and data structures to be defined in an agreed format so that they can be shared. Lianja and SQL commands support the export of Lianja data to XML format and the import of XML data into Lianja format. Lianja also includes a series of functions for accessing XML files and their associated Document Type Definition (DTD) files.


Format of XML files

The format for XML files can be either RECITAL or ADO (Microsoft® ActiveX® Data Objects). Any XML files created in the ADO format can be loaded with the Open method of an ADO Recordset object.

The default XMLFORMAT setting is ADO. The default XMLFORMAT setting can be changed using the SET XMLFORMAT command or overridden using the FORMAT clause on the SQL SELECT statement.

Note: The XMLFORMAT setting determines whether Lianja creates an accompanying DTD file when creating XML files. A DTD file is only created when XMLFORMAT is set to Lianja.


Exporting Lianja data in XML format

  • COPY TO ... TYPE XML - The COPY TO command allows records from the active table to be copied out in XML format (RECITAL/ADO).
  • SELECT ... SAVE AS XML - The SQL SELECT command allows data from one or more tables or views to be saved in XML format (RECITAL/ADO).
  • FETCH ... INTO XML - The SQL FETCH command allows individual rows from a SELECT statement to be saved into a RECITAL XML format file.
  • XML_SCATTER() - Save the contents of the current record in XML format to a character string.


Importing XML data into Lianja format

  • CREATE TABLE...FROM XML - The SQL CREATE command allows a Lianja table to be created from a structure or structure and data from an ADO XML format file.
  • INSERT...FROM XML - The SQL INSERT command allows a Lianja table to be updated with data from an ADO XML format file.
  • XML_GATHER() - Write the contents of a character string containing XML format data into the current record.


Functions for accessing XML and DTD files

  • XMLCOUNT() - Function to return the number of records from an XML file.
  • XMLCREATEDTD() - Function to create a Document Type Definition file for a particular table.
  • XMLFIRST() - Function to read the first record contained in the specified XML file.
  • XMLNEXT() - Function to read the next record contained in the XML file specified with the XMLFIRST() function.
  • XMLVALIDATE() - Function to return the number of records from an XML file.


Functions for passing objects between processes

  • XML_DECODE() - Convert a character string containing XML format data to an object.
  • XML_ENCODE() - Convert an object to a character string containing XML format data


XQuery functions

  • XQUERY() Function to parse XML strings using XPath notation.
  • XQUERY_FILE() Function to parse XML files using XPath notation.
  • XQUERY_OPEN() - Function to open an XML file for parsing using XPath notation.

Displaying an object as XML