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 package com.sun.org.apache.xerces.internal.xpointer;
  21 
  22 import com.sun.org.apache.xerces.internal.xni.Augmentations;
  23 import com.sun.org.apache.xerces.internal.xni.QName;
  24 import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
  25 import com.sun.org.apache.xerces.internal.xni.XNIException;
  26 
  27 /**
  28  * <p>
  29  * Used for scheme specific parsing and evaluation of an XPointer expression.
  30  * This interface applies to both ShortHand and SchemeBased XPointer
  31  * expressions.
  32  * </p>
  33  *
  34  * @xerces.internal
  35  *
  36  */
  37 public interface XPointerPart {
  38 
  39     // The start element event
  40     public static final int EVENT_ELEMENT_START = 0;
  41 
  42     // The end element event
  43     public static final int EVENT_ELEMENT_END = 1;
  44 
  45     // The empty element event
  46     public static final int EVENT_ELEMENT_EMPTY = 2;
  47 
  48     /**
  49      * Provides scheme specific parsing of a XPointer expression i.e.
  50      * the PointerPart or ShortHandPointer.
  51      *
  52      * @param  xpointer A String representing the PointerPart or ShortHandPointer.
  53      * @throws XNIException Thrown if the PointerPart string does not conform to
  54      *         the syntax defined by its scheme.
  55      *
  56      */
  57     public void parseXPointer(String part) throws XNIException;
  58 
  59     /**
  60      * Evaluates an XML resource with respect to an XPointer expressions
  61      * by checking if it's element and attributes parameters match the
  62      * criteria specified in the xpointer expression.
  63      *
  64      * @param element - The name of the element.
  65      * @param attributes - The element attributes.
  66      * @param augs - Additional information that may include infoset augmentations
  67      * @param event - An integer indicating
  68      *                0 - The start of an element
  69      *                1 - The end of an element
  70      *                2 - An empty element call
  71      * @throws XNIException Thrown to signal an error
  72      *
  73      */
  74     public boolean resolveXPointer(QName element, XMLAttributes attributes,
  75             Augmentations augs, int event) throws XNIException;
  76 
  77     /**
  78      * Returns true if the XPointer expression resolves to a resource fragment
  79      * specified as input else returns false.
  80      *
  81      * @return True if the xpointer expression matches a fragment in the resource
  82      *         else returns false.
  83      * @throws XNIException Thrown to signal an error
  84      *
  85      */
  86     public boolean isFragmentResolved() throws XNIException;
  87 
  88     /**
  89      * Returns true if the XPointer expression resolves to a non-element child
  90      * of the current resource fragment.
  91      *
  92      * @return True if the XPointer expression resolves to a non-element child
  93      *         of the current resource fragment.
  94      * @throws XNIException Thrown to signal an error
  95      *
  96      */
  97     public boolean isChildFragmentResolved() throws XNIException;
  98 
  99     /**
 100      * Returns a String containing the scheme name of the PointerPart
 101      * or the name of the ShortHand Pointer.
 102      *
 103      * @return A String containing the scheme name of the PointerPart.
 104      *
 105      */
 106     public String getSchemeName();
 107 
 108     /**
 109      * Returns a String containing the scheme data of the PointerPart.
 110      *
 111      * @return A String containing the scheme data of the PointerPart.
 112      *
 113      */
 114     public String getSchemeData();
 115 
 116     /**
 117      * Sets the scheme name of the PointerPart or the ShortHand Pointer name.
 118      *
 119      * @param schemeName A String containing the scheme name of the PointerPart.
 120      *
 121      */
 122     public void setSchemeName(String schemeName);
 123 
 124     /**
 125      * Sets the scheme data of the PointerPart.
 126      *
 127      * @param schemeData A String containing the scheme data of the PointerPart.
 128      *
 129      */
 130     public void setSchemeData(String schemeData);
 131 
 132 }