~ubuntu-branches/ubuntu/karmic/libxerces2-java/karmic

« back to all changes in this revision

Viewing changes to src/org/apache/xerces/impl/xs/identity/XPathMatcher.java

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-12-04 17:37:55 UTC
  • mfrom: (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20061204173755-hb6ybrrrk097zhx7
Tags: 2.8.1-1ubuntu1
* Merge with Debian unstable; remaining changes:
  - Build -gcj package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * The Apache Software License, Version 1.1
3
 
 *
4
 
 *
5
 
 * Copyright (c) 2001, 2002 The Apache Software Foundation.
6
 
 * All rights reserved.
7
 
 *
8
 
 * Redistribution and use in source and binary forms, with or without
9
 
 * modification, are permitted provided that the following conditions
10
 
 * are met:
11
 
 *
12
 
 * 1. Redistributions of source code must retain the above copyright
13
 
 *    notice, this list of conditions and the following disclaimer.
14
 
 *
15
 
 * 2. Redistributions in binary form must reproduce the above copyright
16
 
 *    notice, this list of conditions and the following disclaimer in
17
 
 *    the documentation and/or other materials provided with the
18
 
 *    distribution.
19
 
 *
20
 
 * 3. The end-user documentation included with the redistribution,
21
 
 *    if any, must include the following acknowledgment:
22
 
 *       "This product includes software developed by the
23
 
 *        Apache Software Foundation (http://www.apache.org/)."
24
 
 *    Alternately, this acknowledgment may appear in the software itself,
25
 
 *    if and wherever such third-party acknowledgments normally appear.
26
 
 *
27
 
 * 4. The names "Xerces" and "Apache Software Foundation" must
28
 
 *    not be used to endorse or promote products derived from this
29
 
 *    software without prior written permission. For written
30
 
 *    permission, please contact apache@apache.org.
31
 
 *
32
 
 * 5. Products derived from this software may not be called "Apache",
33
 
 *    nor may "Apache" appear in their name, without prior written
34
 
 *    permission of the Apache Software Foundation.
35
 
 *
36
 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37
 
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38
 
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39
 
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
40
 
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41
 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42
 
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43
 
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44
 
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45
 
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46
 
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47
 
 * SUCH DAMAGE.
48
 
 * ====================================================================
49
 
 *
50
 
 * This software consists of voluntary contributions made by many
51
 
 * individuals on behalf of the Apache Software Foundation and was
52
 
 * originally based on software copyright (c) 1999, International
53
 
 * Business Machines, Inc., http://www.apache.org.  For more
54
 
 * information on the Apache Software Foundation, please see
55
 
 * <http://www.apache.org/>.
 
2
 * Copyright 2001, 2002,2004,2005 The Apache Software Foundation.
 
3
 * 
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 * 
 
8
 *      http://www.apache.org/licenses/LICENSE-2.0
 
9
 * 
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
56
15
 */
57
16
 
58
17
package org.apache.xerces.impl.xs.identity;
59
18
 
60
19
import org.apache.xerces.impl.Constants;
61
20
import org.apache.xerces.impl.xpath.XPath;
62
 
import org.apache.xerces.xs.XSTypeDefinition;
63
21
import org.apache.xerces.util.IntStack;
64
22
import org.apache.xerces.xni.QName;
65
23
import org.apache.xerces.xni.XMLAttributes;
66
24
import org.apache.xerces.xs.AttributePSVI;
 
25
import org.apache.xerces.xs.ShortList;
 
26
import org.apache.xerces.xs.XSTypeDefinition;
 
27
import org.xml.sax.SAXException;
67
28
 
68
29
 
69
30
/**
70
31
 * XPath matcher.
71
32
 *
 
33
 * @xerces.internal 
 
34
 *
72
35
 * @author Andy Clark, IBM
73
36
 *
74
 
 * @version $Id: XPathMatcher.java,v 1.22 2004/02/10 21:26:03 kohsuke Exp $
 
37
 * @version $Id: XPathMatcher.java 320342 2005-05-09 21:03:33Z ankitp $
75
38
 */
76
39
public class XPathMatcher {
77
40
 
190
153
 
191
154
    // a place-holder method; to be overridden by subclasses
192
155
    // that care about matching element content.
193
 
    protected void handleContent(XSTypeDefinition type, boolean nillable, Object value) { 
 
156
    protected void handleContent(XSTypeDefinition type, boolean nillable, Object value, short valueType, ShortList itemValueType) { 
194
157
    } 
195
158
 
196
159
    /**
198
161
     * XPath expression. Subclasses can override this method to
199
162
     * provide default handling upon a match.
200
163
     */
201
 
    protected void matched(Object actualValue, boolean isNil) {
 
164
    protected void matched(Object actualValue, short valueType, ShortList itemValueType, boolean isNil) {
202
165
        if (DEBUG_METHODS3) {
203
166
            System.out.println(toString()+"#matched(\""+actualValue+"\")");
204
167
        }
210
173
 
211
174
    /**
212
175
     * The start of the document fragment.
213
 
     *
214
 
     * @param context The namespace scope in effect at the
215
 
     *                start of this document fragment.
216
176
     */
217
177
    public void startDocumentFragment(){
218
178
        if (DEBUG_METHODS) {
230
190
        }
231
191
 
232
192
 
233
 
    } // startDocumentFragment(SymbolTable)
 
193
    } // startDocumentFragment()
234
194
 
235
195
    /**
236
196
     * The start of an element. If the document specifies the start element
239
199
     *
240
200
     * @param element    The name of the element.
241
201
     * @param attributes The element attributes.
242
 
     * @param type: The element's type
243
202
     *
244
203
     * @throws SAXException Thrown by handler to signal an error.
245
204
     */
369
328
                                if(j==i) {
370
329
                                    AttributePSVI attrPSVI = (AttributePSVI)attributes.getAugmentations(aIndex).getItem(Constants.ATTRIBUTE_PSVI);
371
330
                                    fMatchedString = attrPSVI.getActualNormalizedValue();
372
 
                                    matched(fMatchedString, false);
 
331
                                    matched(fMatchedString, attrPSVI.getActualNormalizedValueType(), attrPSVI.getItemValueTypes(), false);
373
332
                                }
374
333
                            }
375
334
                            break;
410
369
       * @param value - actual value
411
370
       *        the typed value of the content of this element. 
412
371
       */
413
 
    public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object value ) {
 
372
    public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object value, short valueType, ShortList itemValueType) {
414
373
        if (DEBUG_METHODS2) {
415
374
            System.out.println(toString()+"#endElement("+
416
375
                               "element={"+element+"},"+
437
396
                // match element content.  This permits
438
397
                // them a way to override this to do nothing
439
398
                // and hopefully save a few operations.
440
 
                handleContent(type, nillable, value);
 
399
                handleContent(type, nillable, value, valueType, itemValueType);
441
400
                fMatched[i] = 0;
442
401
            }
443
402