18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xerces.internal.impl.xs.identity;
22
23 import com.sun.org.apache.xerces.internal.impl.xpath.XPathException;
24 import com.sun.org.apache.xerces.internal.util.SymbolTable;
25 import com.sun.org.apache.xerces.internal.util.XMLChar;
26 import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
27 import com.sun.org.apache.xerces.internal.xni.QName;
28 import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
29 import com.sun.org.apache.xerces.internal.xs.ShortList;
30 import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
31
32 /**
33 * Schema identity constraint selector.
34 *
35 * @xerces.internal
36 *
37 * @author Andy Clark, IBM
38 * @version $Id: Selector.java,v 1.7 2010-11-01 04:39:57 joehw Exp $
39 */
40 public class Selector {
41
42 //
43 // Data
44 //
45
46 /** XPath. */
47 protected final Selector.XPath fXPath;
48
49 /** Identity constraint. */
50 protected final IdentityConstraint fIdentityConstraint;
51
52 // the Identity constraint we're the matcher for. Only
53 // used for selectors!
54 protected IdentityConstraint fIDConstraint;
55
56 //
57 // Constructors
58 //
89 return new Selector.Matcher(fXPath, activator, initialDepth);
90 } // createMatcher(FieldActivator):XPathMatcher
91
92 //
93 // Object methods
94 //
95
96 /** Returns a string representation of this object. */
97 public String toString() {
98 return fXPath.toString();
99 } // toString():String
100
101 //
102 // Classes
103 //
104
105 /**
106 * Schema identity constraint selector XPath expression.
107 *
108 * @author Andy Clark, IBM
109 * @version $Id: Selector.java,v 1.7 2010-11-01 04:39:57 joehw Exp $
110 */
111 public static class XPath
112 extends com.sun.org.apache.xerces.internal.impl.xpath.XPath {
113
114 //
115 // Constructors
116 //
117
118 /** Constructs a selector XPath expression. */
119 public XPath(String xpath, SymbolTable symbolTable,
120 NamespaceContext context) throws XPathException {
121 super(normalize(xpath), symbolTable, context);
122 // verify that an attribute is not selected
123 for (int i=0;i<fLocationPaths.length;i++) {
124 com.sun.org.apache.xerces.internal.impl.xpath.XPath.Axis axis =
125 fLocationPaths[i].steps[fLocationPaths[i].steps.length-1].axis;
126 if (axis.type == XPath.Axis.ATTRIBUTE) {
127 throw new XPathException("c-selector-xpath");
128 }
129 }
|
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xerces.internal.impl.xs.identity;
22
23 import com.sun.org.apache.xerces.internal.impl.xpath.XPathException;
24 import com.sun.org.apache.xerces.internal.util.SymbolTable;
25 import com.sun.org.apache.xerces.internal.util.XMLChar;
26 import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
27 import com.sun.org.apache.xerces.internal.xni.QName;
28 import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
29 import com.sun.org.apache.xerces.internal.xs.ShortList;
30 import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
31
32 /**
33 * Schema identity constraint selector.
34 *
35 * @xerces.internal
36 *
37 * @author Andy Clark, IBM
38 */
39 public class Selector {
40
41 //
42 // Data
43 //
44
45 /** XPath. */
46 protected final Selector.XPath fXPath;
47
48 /** Identity constraint. */
49 protected final IdentityConstraint fIdentityConstraint;
50
51 // the Identity constraint we're the matcher for. Only
52 // used for selectors!
53 protected IdentityConstraint fIDConstraint;
54
55 //
56 // Constructors
57 //
88 return new Selector.Matcher(fXPath, activator, initialDepth);
89 } // createMatcher(FieldActivator):XPathMatcher
90
91 //
92 // Object methods
93 //
94
95 /** Returns a string representation of this object. */
96 public String toString() {
97 return fXPath.toString();
98 } // toString():String
99
100 //
101 // Classes
102 //
103
104 /**
105 * Schema identity constraint selector XPath expression.
106 *
107 * @author Andy Clark, IBM
108 */
109 public static class XPath
110 extends com.sun.org.apache.xerces.internal.impl.xpath.XPath {
111
112 //
113 // Constructors
114 //
115
116 /** Constructs a selector XPath expression. */
117 public XPath(String xpath, SymbolTable symbolTable,
118 NamespaceContext context) throws XPathException {
119 super(normalize(xpath), symbolTable, context);
120 // verify that an attribute is not selected
121 for (int i=0;i<fLocationPaths.length;i++) {
122 com.sun.org.apache.xerces.internal.impl.xpath.XPath.Axis axis =
123 fLocationPaths[i].steps[fLocationPaths[i].steps.length-1].axis;
124 if (axis.type == XPath.Axis.ATTRIBUTE) {
125 throw new XPathException("c-selector-xpath");
126 }
127 }
|