KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > xpointer > XPointerProcessor


1 /*
2  * Copyright 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.
15  */

16
17 package org.apache.xerces.xpointer;
18
19 import org.apache.xerces.xni.Augmentations;
20 import org.apache.xerces.xni.QName;
21 import org.apache.xerces.xni.XMLAttributes;
22 import org.apache.xerces.xni.XNIException;
23
24 /**
25  * <p>
26  * The XPointerProcessor is responsible for parsing an XPointer
27  * expression and and providing scheme specific resolution of
28  * the document fragment pointed to be the pointer.
29  * </p>
30  *
31  * @xerces.internal
32  *
33  * @version $Id: XPointerProcessor.java,v 1.1 2005/06/17 22:00:20 nddelima Exp $
34  *
35  */

36 public interface XPointerProcessor {
37
38     // The start element event
39
public static final int EVENT_ELEMENT_START = 0;
40
41     // The end element event
42
public static final int EVENT_ELEMENT_END = 1;
43
44     // The empty element event
45
public static final int EVENT_ELEMENT_EMPTY = 2;
46
47     /**
48      * Parses an XPointer expression. It performs scheme specific processing
49      * depending on the pointer parts and sets up a Vector of XPointerParts
50      * in the order (left-to-right) they appear in the XPointer expression.
51      *
52      * @param xpointer A String representing the xpointer expression.
53      * @throws XNIException Thrown if the xpointer string does not conform to
54      * the XPointer Framework syntax or the syntax of the pointer part does
55      * not conform to its definition for its scheme.
56      *
57      */

58     public void parseXPointer(String JavaDoc xpointer) throws XNIException;
59
60     /**
61      * Evaluates an XML resource with respect to an XPointer expressions
62      * by checking if it's element and attributes parameters match the
63      * criteria specified in the xpointer expression.
64      *
65      * @param element - The name of the element.
66      * @param attributes - The element attributes.
67      * @param augs - Additional information that may include infoset augmentations
68      * @param event - An integer indicating
69      * 0 - The start of an element
70      * 1 - The end of an element
71      * 2 - An empty element call
72      * @return true if the element was resolved by the xpointer
73      * @throws XNIException Thrown to signal an error
74      *
75      */

76     public boolean resolveXPointer(QName element, XMLAttributes attributes,
77             Augmentations augs, int event) throws XNIException;
78
79     /**
80      * Returns true if the XPointer expression resolves to the current resource fragment
81      * or Node which is part of the input resource being streamed else returns false.
82      *
83      * @return True if the xpointer expression matches a node/fragment in the resource
84      * else returns false.
85      * @throws XNIException Thrown to signal an error
86      *
87      */

88     public boolean isFragmentResolved() throws XNIException;
89
90     /**
91      * Returns true if the XPointer expression resolves any subresource of the
92      * input resource.
93      *
94      * @return True if the xpointer expression matches a fragment in the resource
95      * else returns false.
96      * @throws XNIException Thrown to signal an error
97      *
98      */

99     public boolean isXPointerResolved() throws XNIException;
100     
101 }
Popular Tags