1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Copyright 2005 The Apache Software Foundation.
   7  *
   8  * Licensed under the Apache License, Version 2.0 (the "License");
   9  * you may not use this file except in compliance with the License.
  10  * You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xerces.internal.xpointer;
  22 
  23 import com.sun.org.apache.xerces.internal.xni.Augmentations;
  24 import com.sun.org.apache.xerces.internal.xni.QName;
  25 import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
  26 import com.sun.org.apache.xerces.internal.xni.XNIException;
  27 
  28 /**
  29  * <p>
  30  * The XPointerProcessor is responsible for parsing an XPointer
  31  * expression and and providing scheme specific resolution of
  32  * the document fragment pointed to be the pointer.
  33  * </p>
  34  *
  35  * @xerces.internal
  36  *
  37  *
  38  */
  39 public interface XPointerProcessor {
  40 
  41     // The start element event
  42     public static final int EVENT_ELEMENT_START = 0;
  43 
  44     // The end element event
  45     public static final int EVENT_ELEMENT_END = 1;
  46 
  47     // The empty element event
  48     public static final int EVENT_ELEMENT_EMPTY = 2;
  49 
  50     /**
  51      * Parses an XPointer expression.  It performs scheme specific processing
  52      * depending on the pointer parts and sets up a Vector of XPointerParts
  53      * in the order (left-to-right) they appear in the XPointer expression.
  54      *
  55      * @param  xpointer A String representing the xpointer expression.
  56      * @throws XNIException Thrown if the xpointer string does not conform to
  57      *         the XPointer Framework syntax or the syntax of the pointer part does
  58      *         not conform to its definition for its scheme.
  59      *
  60      */
  61     public void parseXPointer(String xpointer) throws XNIException;
  62 
  63     /**
  64      * Evaluates an XML resource with respect to an XPointer expressions
  65      * by checking if it's element and attributes parameters match the
  66      * criteria specified in the xpointer expression.
  67      *
  68      * @param element - The name of the element.
  69      * @param attributes - The element attributes.
  70      * @param augs - Additional information that may include infoset augmentations
  71      * @param event - An integer indicating
  72      *                0 - The start of an element
  73      *                1 - The end of an element
  74      *                2 - An empty element call
  75      * @return true if the element was resolved by the xpointer
  76      * @throws XNIException Thrown to signal an error
  77      *
  78      */
  79     public boolean resolveXPointer(QName element, XMLAttributes attributes,
  80             Augmentations augs, int event) throws XNIException;
  81 
  82     /**
  83      * Returns true if the XPointer expression resolves to the current resource fragment
  84      * or Node which is part of the input resource being streamed else returns false.
  85      *
  86      * @return True if the xpointer expression matches a node/fragment in the resource
  87      *         else returns false.
  88      * @throws XNIException Thrown to signal an error
  89      *
  90      */
  91     public boolean isFragmentResolved() throws XNIException;
  92 
  93     /**
  94      * Returns true if the XPointer expression resolves any subresource of the
  95      * input resource.
  96      *
  97      * @return True if the xpointer expression matches a fragment in the resource
  98      *         else returns false.
  99      * @throws XNIException Thrown to signal an error
 100      *
 101      */
 102     public boolean isXPointerResolved() throws XNIException;
 103 
 104 }