001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.xerces.xpointer;
019:
020: import org.apache.xerces.xni.Augmentations;
021: import org.apache.xerces.xni.QName;
022: import org.apache.xerces.xni.XMLAttributes;
023: import org.apache.xerces.xni.XNIException;
024:
025: /**
026: * <p>
027: * The XPointerProcessor is responsible for parsing an XPointer
028: * expression and and providing scheme specific resolution of
029: * the document fragment pointed to be the pointer.
030: * </p>
031: *
032: * @xerces.internal
033: *
034: * @version $Id: XPointerProcessor.java 447248 2006-09-18 05:25:21Z mrglavas $
035: *
036: */
037: public interface XPointerProcessor {
038:
039: // The start element event
040: public static final int EVENT_ELEMENT_START = 0;
041:
042: // The end element event
043: public static final int EVENT_ELEMENT_END = 1;
044:
045: // The empty element event
046: public static final int EVENT_ELEMENT_EMPTY = 2;
047:
048: /**
049: * Parses an XPointer expression. It performs scheme specific processing
050: * depending on the pointer parts and sets up a Vector of XPointerParts
051: * in the order (left-to-right) they appear in the XPointer expression.
052: *
053: * @param xpointer A String representing the xpointer expression.
054: * @throws XNIException Thrown if the xpointer string does not conform to
055: * the XPointer Framework syntax or the syntax of the pointer part does
056: * not conform to its definition for its scheme.
057: *
058: */
059: public void parseXPointer(String xpointer) throws XNIException;
060:
061: /**
062: * Evaluates an XML resource with respect to an XPointer expressions
063: * by checking if it's element and attributes parameters match the
064: * criteria specified in the xpointer expression.
065: *
066: * @param element - The name of the element.
067: * @param attributes - The element attributes.
068: * @param augs - Additional information that may include infoset augmentations
069: * @param event - An integer indicating
070: * 0 - The start of an element
071: * 1 - The end of an element
072: * 2 - An empty element call
073: * @return true if the element was resolved by the xpointer
074: * @throws XNIException Thrown to signal an error
075: *
076: */
077: public boolean resolveXPointer(QName element,
078: XMLAttributes attributes, Augmentations augs, int event)
079: throws XNIException;
080:
081: /**
082: * Returns true if the XPointer expression resolves to the current resource fragment
083: * or Node which is part of the input resource being streamed else returns false.
084: *
085: * @return True if the xpointer expression matches a node/fragment in the resource
086: * else returns false.
087: * @throws XNIException Thrown to signal an error
088: *
089: */
090: public boolean isFragmentResolved() throws XNIException;
091:
092: /**
093: * Returns true if the XPointer expression resolves any subresource of the
094: * input resource.
095: *
096: * @return True if the xpointer expression matches a fragment in the resource
097: * else returns false.
098: * @throws XNIException Thrown to signal an error
099: *
100: */
101: public boolean isXPointerResolved() throws XNIException;
102:
103: }
|