XML Rules Utility Library 1.0.7

Delphi 4 to 2009 and Kylix 3 Implementation

Dieter Köhler

LICENSE

The contents of the Extended Document Object Model files are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this files except in compliance with the License. You may obtain a copy of the License at "http://www.mozilla.org/MPL/"

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.

The Original Code is "dkXmlRulesUtils.pas".

The Initial Developer of the Original Code is Dieter Köhler (Heidelberg, Germany, "http://www.philo.de/"). Portions created by the Initial Developer are Copyright (C) 1999-2009 Dieter Köhler. All Rights Reserved.

Alternatively, the contents of this files may be used under the terms of the GNU General Public License Version 2 or later (the "GPL"), in which case the provisions of the GPL are applicable instead of those above. If you wish to allow use of your version of this files only under the terms of the GPL, and not to allow others to use your version of this files under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL or the GPL.

2004-2009


Table of Contents

Introduction
XML Rule Tests per Code Point
XML Rule Tests per WideChar
XML Rule Tests per WideString
XML-Namespace Rule Tests
Helper Functions
References

Introduction

The dkXmlRulesUtils unit implements functions that allow to test whether an ISO-10646-UCS4 code point, or a UTF-16LE WideChar or WideString belongs to the a certain XML character class as specified in [XML 1.0], [XML Namespaces] and [XML Namespaces Errata]. Note that some older XML character classes are obsolete with the appearance of the 5th ed. of [XML 1.0]. The respective functions are marked as deprecated. It is not recommended to use them, and they may be removed from the dkXmlRulesUtils unit in the future.

XML Rule Tests per Code Point

The following functions serve to test whether an ISO-10646-UCS4 code point UCS4 belongs to the respective XML character class. All functions return True if UCS4 belongs to the class, otherwise they return False.

  • function IsXmlBaseCharCodePoint(const UCS4: Longint): Boolean; deprecated;
  • function IsXmlCharCodePoint(const UCS4: Longint): Boolean;
  • function IsXmlCombiningCharCodePoint(const UCS4: Longint): Boolean; deprecated;
  • function IsXmlDecDigitCodePoint(const UCS4: Longint): Boolean;
  • function IsXmlDigitCodePoint(const UCS4: Longint): Boolean; deprecated;
  • function IsXmlEncNameFollowingCharCodePoint(const UCS4: Longint): Boolean;
  • function IsXmlEncNameLeadingCharCodePoint(const UCS4: Longint): Boolean;
  • function IsXmlExtenderCodePoint(const UCS4: Longint): Boolean; deprecated;
  • function IsXmlHexDigitCodePoint(const UCS4: Longint): Boolean;
  • function IsXmlIdeographicCodePoint(const UCS4: Longint): Boolean; deprecated;
  • function IsXmlLetterCodePoint(const UCS4: Longint): Boolean; deprecated;
  • function IsXmlNameCharCodePoint(const UCS4: Longint): Boolean;
  • function IsXmlNameStartCharCodePoint(const UCS4: Longint): Boolean;
  • function IsXmlWhiteSpaceCodePoint(const UCS4: Longint): Boolean;
  • function IsXmlWhiteSpaceOrNullCodePoint(const UCS4: Longint): Boolean;

XML Rule Tests per WideChar

The following functions serve to test whether a WideChar S belongs to the respective XML character class. All functions return True if S belongs to the class, otherwise they return False. Since the value to be tested is always of type WideChar characters out of the interval [$10000;$10FFFF] cannot be tested. Instead you can either use their low or their high surrogate.

  • function IsXmlBaseChar(const S: WideChar): Boolean; deprecated;
  • function IsXmlChar(const S: WideChar): Boolean;
  • function IsXmlCombiningChar(const S: WideChar): Boolean; deprecated;
  • function IsXmlDigit(const S: WideChar): Boolean; deprecated;
  • function IsXmlExtender(const S: WideChar): Boolean; deprecated;
  • function IsXmlIdeographic(const S: WideChar): Boolean; deprecated;
  • function IsXmlLetter(const S: WideChar): Boolean; deprecated;
  • function IsXmlNameChar(const S: WideChar): Boolean;
  • function IsXmlNameStartChar(const S: WideChar): Boolean;
  • function IsXmlPubidChar(const S: WideChar): Boolean;
  • function IsXmlWhiteSpace(const S: WideString): Boolean;
  • function IsXmlWhiteSpaceOrNull(const S: WideChar): Boolean;

XML Rule Tests per WideString

The following functions serve to test whether a WideString S belongs to the respective XML string type. All functions return True if S belongs to the type, otherwise they return False.

  • function IsXmlAttValue(const S: WideString): Boolean;
  • function IsXmlCData(const S: WideString): Boolean;
  • function IsXmlCharData(const S: WideString): Boolean;
  • function IsXmlCharRef(const S: WideString): Boolean;
  • function IsXmlChars(const S: WideString): Boolean;
  • function IsXmlComment(const S: WideString): Boolean;
  • function IsXmlEncName(const S: WideString): Boolean;
  • function IsXmlEntityRef(const S: WideString): Boolean;
  • function IsXmlEntityValue(const S: WideString): Boolean;
  • function IsXmlEntityValueChars(const S: WideString): Boolean;
  • function IsXmlName(const S: WideString): Boolean;
  • function IsXmlNames(const S: WideString): Boolean;
  • function IsXmlNmtoken(const S: WideString): Boolean;
  • function IsXmlNmtokens(const S: WideString): Boolean;
  • function IsXmlPEReference(const S: WideString): Boolean;
  • function IsXmlPITarget(const S: WideString): Boolean;
  • function IsXmlPredefinedEntityName(const S: WideString): Boolean;
  • function IsXmlPubidChars(const S: WideString): Boolean;
  • function IsXmlPubidLiteral(const S: WideString): Boolean;
  • function IsXmlReference(const S: WideString): Boolean;
  • function IsXmlS(const S: WideString): Boolean;
  • function IsXmlStringType(const S: WideString): Boolean;
  • function IsXmlSystemChars(const S: WideString): Boolean;
  • function IsXmlSystemLiteral(const S: WideString): Boolean;
  • function IsXmlTokenizedType(const S: WideString): Boolean;
  • function IsXmlVersionNum(const S: WideString): Boolean;

XML-Namespace Rule Tests

The following functions serve to test whether a WideChar S or a WideString S belongs to the respective XML-namespace string type. All functions return True if S belongs to the type, otherwise they return False.

  • function IsXmlDefaultAttName(const S: WideString): Boolean;
  • function IsXmlLocalPart(const S: WideString): Boolean;
  • function IsXmlNCName(const S: WideString): Boolean;
  • function IsXmlNCNameChar(const S: WideChar): Boolean;
  • function IsXmlNCNameStartChar(const S: WideChar): Boolean;
  • function IsXmlNSAttName(const S: WideString): Boolean;
  • function IsXmlPrefix(const S: WideString): Boolean;
  • function IsXmlPrefixedAttName(const S: WideString): Boolean;
  • function IsXmlQName(const S: WideString): Boolean;

Helper Functions

  • function GetXmlWhitespaceWideString: WideString; 

References

[ISO/IEC 10646] ISO (International Organization for Standardization): ISO/IEC 10646-1993 (E). Information technology – Universal Multiple-Octet Coded Character Set (UCS) – Part 1: Architecture and Basic Multilingual Plane, [Geneva]: International Organization for Standardization, 1993 (+ amendments AM 1–7).

[Unicode 3.0] The Unicode Consortium: The Unicode Standard Version 3.0, Reading (Mass.): Addison-Wesley, 2000.

[XML Namespaces] W3C (World Wide Web Consortium): Namespaces in XML 1.0 (Second Edition), REC-xml-names-20060816, ed. Tim Bray, Dave Hollander Andrew Layman and Richard Tobin, 16. Aug. 2006, see "http://www.w3.org/TR/2006/REC-xml-names-20060816/".

[XML Namespaces Errata] W3C (World Wide Web Consortium): Namespaces in XML 1.0 (Second Edition) Errata, 20 November 2008, see "http://www.w3.org/XML/2006/xml-names-errata".

[XML 1.0] W3C (World Wide Web Consortium): Extensible Markup Language (XML) 1.0 (Fifth Edition), REC-xml-20081126, ed. Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, and François Yergeau, 28.11.2008, see "http://www.w3.org/TR/2008/REC-xml-20081126/".