Class XML_Query2XML_ISO9075Mapper

Description

Maps SQL identifiers to XML names according to Final Committee Draft for ISO/IEC 9075-14:2005, section "9.1 Mapping SQL <identifier>s to XML Names".

ISO/IEC 9075-14:2005 is available online at http://www.sqlx.org/SQL-XML-documents/5FCD-14-XML-2004-07.pdf

A lot of characters are legal in SQL identifiers but cannot be used within XML names. To begin with, SQL identifiers can contain any Unicode character while XML names are limited to a certain set of characters. E.g the SQL identifier "<21yrs in age" obviously is not a valid XML name. '#', '{', and '}' are also not allowed. Fully escaped SQL identifiers also must not contain a column (':') or start with "xml" (in any case combination). Illegal characters are mapped to a string of the form _xUUUU_ where UUUU is the Unicode value of the character.

The following is a table of example mappings:

 +----------------+------------------------+------------------------------------+
 | SQL-Identifier | Fully escaped XML name | Comment                            |
 +----------------+------------------------+------------------------------------+
 | dept:id        | dept_x003A_id          | ":" is illegal                     |
 | xml_name       | _x0078_ml_name         | must not start with [Xx][Mm][Ll]   |
 | XML_name       | _x0058_ML_name         | must not start with [Xx][Mm][Ll]   |
 | hire date      | hire_x0020_date        | space is illegal too               |
 | Works@home     | Works_x0040_home       | "@" is illegal                     |
 | file_xls       | file_x005F_xls         | "_" gets mapped if followed by "x" |
 | FIRST_NAME     | FIRST_NAME             | no problem here                    |
 +----------------+------------------------+------------------------------------+

Located in /Query2XML/ISO9075Mapper.php (line 65)


	
			
Method Summary
static string map (string $sqlIdentifier)
Methods
static map (line 77)

This method maps an SQL identifier to an XML name according to FCD ISO/IEC 9075-14:2005.

  • return: The fully escaped XML name.
  • throws: XML_Query2XML_ISO9075Mapper_Exception If $sqlIdentifier was a malformed UTF-8 string.
  • access: public
static string map (string $sqlIdentifier)
  • string $sqlIdentifier: The SQL identifier as a UTF-8 string.

Documentation generated on Sun, 03 Apr 2011 13:13:08 +0200 by phpDocumentor 1.4.1