286N/A * reserved comment block 286N/A * DO NOT REMOVE OR ALTER! 286N/A * Copyright 2005 The Apache Software Foundation. 286N/A * Licensed under the Apache License, Version 2.0 (the "License"); 286N/A * you may not use this file except in compliance with the License. 286N/A * You may obtain a copy of the License at 286N/A * Unless required by applicable law or agreed to in writing, software 286N/A * distributed under the License is distributed on an "AS IS" BASIS, 286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 286N/A * See the License for the specific language governing permissions and 286N/A * limitations under the License. 286N/A * Implements the XPointerPart interface for element() scheme specific processing. 286N/A // The Scheme Name i.e element 286N/A // The scheme Data & child sequence 286N/A // Should we attempt to resolve the ChildSequence from the 286N/A // current element position. If a ShortHand Pointer is present 286N/A // attempt to resolve relative to the short hand pointer. 286N/A // Has the element been found 286N/A // Was only an empty element found 286N/A // If a shorthand pointer is present and resolved 286N/A // The depth at which the element was found 286N/A // The XPointer element child sequence 286N/A // The current child position 286N/A // The current child depth 286N/A // The current element's child sequence 286N/A // Stores if the Fragment was resolved by the pointer 286N/A // Stores if the Fragment was resolved by the pointer 286N/A // The XPointer Error reporter 286N/A // The XPointer Error Handler 286N/A // ************************************************************************ 286N/A // ************************************************************************ 286N/A // ************************************************************************ 286N/A // XPointerPart implementation 286N/A // ************************************************************************ 286N/A * Parses the XPointer expression and tokenizes it into Strings 286N/A * delimited by whitespace. 286N/A * @see com.sun.org.apache.xerces.internal.xpointer.XPointerProcessor#parseXPointer(java.lang.String) 286N/A // scan the element() XPointer expression 286N/A // Initialize a temp arrays to the size of token count which should 286N/A // be atleast twice the size of child sequence, to hold the ChildSequence. 286N/A // Traverse the scanned tokens 286N/A // Note: Only a single ShortHand pointer can be present 286N/A // Create a new ShortHandPointer 286N/A // Initialize the arrays to the number of elements in the ChildSequence. 286N/A * Returns the scheme name i.e element 286N/A * @see com.sun.org.apache.xerces.internal.xpointer.XPointerPart#getSchemeName() 286N/A * Returns the scheme data 286N/A * @see com.sun.org.apache.xerces.internal.xpointer.XPointerPart#getSchemeData() 286N/A * @see com.sun.org.apache.xerces.internal.xpointer.XPointerPart#setSchemeName(java.lang.String) 286N/A * @see com.sun.org.apache.xerces.internal.xpointer.XPointerPart#setSchemeData(java.lang.String) 286N/A * Responsible for resolving the element() scheme XPointer. If a ShortHand 286N/A * Pointer is present and it is successfully resolved and if a child 286N/A * sequence is present, the child sequence is resolved relative to it. 286N/A * @see com.sun.org.apache.xerces.internal.xpointer.XPointerProcessor#resolveXPointer(com.sun.org.apache.xerces.internal.xni.QName, com.sun.org.apache.xerces.internal.xni.XMLAttributes, com.sun.org.apache.xerces.internal.xni.Augmentations, int event) 286N/A // if a ChildSequence exisits, resolve child elements 286N/A // if an element name exists 286N/A // resolve ShortHand Pointer 286N/A // Added here to skip the ShortHand pointer corresponding to 286N/A // an element if one exisits and start searching from its child 286N/A // if only a resolved shorthand pointer exists 286N/A * Matches the current element position in the document tree with the 286N/A * element position specified in the element XPointer scheme. 286N/A * @return boolean - true if the current element position in the document 286N/A * tree matches theelement position specified in the element XPointer 286N/A // need to resize fCurrentChildSequence 286N/A // Increase the size by a factor of 2 (?) 286N/A // reset the current child position 286N/A //if (!fSchemeNameFound) { 286N/A // reset array position of last child 286N/A // Donot check for empty elements if the empty element is 286N/A // a child of a found parent element 286N/A //if (!fIsElementFound) { 286N/A * Matches the current position of the element being visited by checking 286N/A * its position and previous elements against the element XPointer expression. 286N/A * If a match is found it return true else false. 286N/A // If the number of elements in the ChildSequence is greater than the 286N/A // current child depth, there is not point in checking further 286N/A // If a shorthand pointer is not present traverse the children 286N/A // If a shorthand pointer is present traverse the children 286N/A // ignoring the first element of the CurrenChildSequence which 286N/A // contains the ShortHand pointer element and compare 286N/A // ensure fCurrentChildSequence is large enough 286N/A // ignore the first element of fCurrentChildSequence 286N/A * Returns true if the node matches or is a child of a matching element() 286N/A * @see com.sun.org.apache.xerces.internal.xpointer.XPointerProcessor#isFragmentResolved() 286N/A // Return true if the Fragment was resolved and the current Node depth 286N/A // is greater than or equal to the depth at which the element was found 286N/A * Returns true if the XPointer expression resolves to a non-element child 286N/A * of the current resource fragment. 286N/A * @see com.sun.org.apache.xerces.internal.xpointer.XPointerPart#isChildFragmentResolved() 286N/A // if only a shorthand pointer was present 286N/A * Reports an XPointer error 286N/A /*fErrorReporter.reportError(XPointerMessageFormatter.XPOINTER_DOMAIN, 286N/A key, arguments, XMLErrorReporter.SEVERITY_ERROR); 286N/A * Initializes error handling objects 286N/A * Initializes the element scheme processor 286N/A // ************************************************************************ 286N/A // element() Scheme expression scanner 286N/A // ************************************************************************ 286N/A * List of XPointer Framework tokens. 286N/A * @author Neil Delima, IBM 286N/A * XPointer element() scheme 286N/A * [1] ElementSchemeData ::= (NCName ChildSequence?) | ChildSequence 286N/A * [2] ChildSequence ::= ('/' [1-9] [0-9]*)+ 286N/A "XPTRTOKEN_ELEM_CHILD" };
286N/A // Current token position 286N/A * @param symbolTable SymbolTable 286N/A "XPTRTOKEN_ELEM_NCNAME");
286N/A "XPTRTOKEN_ELEM_CHILD");
286N/A * Returns the token String 286N/A * @param token The index of the token 286N/A * @return String The token string 286N/A * Returns the token String 286N/A * @param token The index of the token 286N/A * @return String The token string 286N/A * Add the specified string as a token 286N/A * @param token The token string 286N/A * Add the specified int token 286N/A * @param token The int specifying the token 286N/A * Resets the current position to the head of the token list. 286N/A * Returns true if the {@link #getNextToken()} method 286N/A * returns a valid token. 286N/A * Obtains the token at the current position, then advance 286N/A * the current position by one. 286N/A * If there's no such next token, this method throws 286N/A * <tt>new XNIException("InvalidXPointerExpression");</tt>. 286N/A * Obtains the token at the current position, without advancing 286N/A * the current position. 286N/A * If there's no such next token, this method throws 286N/A * <tt>new XNIException("InvalidXPointerExpression");</tt>. 286N/A * Obtains the token at the current position as a String. 286N/A * If there's no current token or if the current token 286N/A * is not a string token, this method throws 286N/A * If there's no such next token, this method throws 286N/A * <tt>new XNIException("InvalidXPointerExpression");</tt>. 286N/A * Returns the number of tokens. 286N/A * The XPointer expression scanner. Scans the XPointer framework expression. 286N/A * 0 1 2 3 4 5 6 7 8 9 A B C D E F 286N/A * 0, 0, 0, 0, 0, 0, 0, 0, 0, HT, LF, 0, 0, CR, 0, 0, // 0 286N/A * 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1 286N/A * SP, !, ", #, $, %, &, ', (, ), *, +, ,, -, ., /, // 2 286N/A * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, :, ;, <, =, >, ?, // 3 286N/A * @, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, // 4 286N/A * P, Q, R, S, T, U, V, W, X, Y, Z, [, \, ], ^, _, // 5 286N/A * `, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, // 6 286N/A * p, q, r, s, t, u, v, w, x, y, z, {, |, }, ~, DEL // 7 286N/A CHARTYPE_OTHER =
1,
// A valid XML character (possibly invalid NCNameChar) that does not fall in one of the other categories 286N/A private final byte[]
fASCIICharMap = {
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
1,
286N/A 0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
286N/A 1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
4,
5,
5,
5,
5,
5,
286N/A 5,
5,
5,
5,
5,
1,
1,
1,
1,
1,
1,
1,
6,
6,
6,
6,
6,
6,
6,
6,
6,
286N/A 6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
1,
1,
1,
1,
286N/A 7,
1,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
6,
286N/A 6,
6,
6,
6,
6,
6,
6,
1,
1,
1,
1,
1 };
286N/A * Constructs an XPath expression scanner. 286N/A * @param symbolTable SymbolTable 286N/A // save pool and tokens 286N/A }
// <init>(SymbolTable) 286N/A * Scans the XPointer Expression 286N/A // [1] ElementSchemeData ::= (NCName ChildSequence?) | ChildSequence 286N/A // [2] ChildSequence ::= ('/' [1-9] [0-9]*)+ 286N/A // if last character is '/', break and report an error 286N/A // ChildSequence ::= ('/' [1-9] [0-9]*)+ 286N/A // An invalid child sequence character 286N/A // Scan the ShortHand Pointer NCName 286N/A * From Namespaces in XML 286N/A * [5] NCName ::= (Letter | '_') (NCNameChar)* 286N/A * [6] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender 286N/A * @param data A String containing the XPointer expression 286N/A * @param endOffset The int XPointer expression length 286N/A * @param currentOffset An int representing the current position of the XPointer expression pointer 286N/A * This method adds the specified token to the token list. By 286N/A * default, this method allows all tokens. However, subclasses 286N/A * of the XPathExprScanner can override this method in order 286N/A * to disallow certain tokens from being used in the scanned 286N/A * XPath expression. This is a convenient way of allowing only