01: package net.sf.saxon.om;
02:
03: /**
04: * The class checks names against the rules of the XML 1.1 and XML Namespaces 1.1 specification
05: */
06:
07: public final class Name11Checker extends NameChecker {
08:
09: public static final Name11Checker theInstance = new Name11Checker();
10:
11: public static final Name11Checker getInstance() {
12: return theInstance;
13: }
14:
15: /**
16: * Validate whether a given string constitutes a valid NCName, as defined in XML Namespaces.
17: *
18: * @param name the name to be tested
19: * @return true if the name is a lexically-valid NCName
20: */
21:
22: public boolean isValidNCName(String name) {
23: return XML11Char.isXML11ValidNCName(name);
24: }
25:
26: /**
27: * Test whether a character is a valid XML character
28: *
29: * @param ch the character to be tested
30: * @return true if this is a valid character in the selected version of XML
31: */
32:
33: public boolean isValidChar(int ch) {
34: return XML11Char.isXML11Valid(ch);
35: }
36:
37: /**
38: * Return the XML version supported by this NameChecker
39: *
40: * @return "1.1" as a string
41: */
42:
43: public String getXMLVersion() {
44: return "1.1";
45: }
46: }
47:
48: //
49: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
50: // you may not use this file except in compliance with the License. You may obtain a copy of the
51: // License at http://www.mozilla.org/MPL/
52: //
53: // Software distributed under the License is distributed on an "AS IS" basis,
54: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
55: // See the License for the specific language governing rights and limitations under the License.
56: //
57: // The Original Code is: all this file.
58: //
59: // The Initial Developer of the Original Code is Michael H. Kay.
60: //
61: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
62: //
63: // Contributor(s): none.
64: //
|