XML_Query2XML
[ class tree: XML_Query2XML ] [ index: XML_Query2XML ] [ all elements ]

Class: XML_Query2XML_ISO9075Mapper

Source Location: /XML_Query2XML-1.7.2/XML/Query2XML/ISO9075Mapper.php

Class Overview


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".


Author(s):

Version:

  • Release: 1.7.2

Copyright:

  • 2006 Lukas Feiler

Methods


Inherited Variables

Inherited Methods


Class Details

[line 65]
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                    |
 +----------------+------------------------+------------------------------------+



[ Top ]


Method Detail

map   [line 77]

string map( string $sqlIdentifier)

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

Parameters:

string   $sqlIdentifier   —  The SQL identifier as a UTF-8 string.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:43:31 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.