1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xerces.internal.xpointer;
  23 
  24 import com.sun.org.apache.xerces.internal.xni.Augmentations;
  25 import com.sun.org.apache.xerces.internal.xni.QName;
  26 import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
  27 import com.sun.org.apache.xerces.internal.xni.XNIException;
  28 
  29 /**
  30  * <p>
  31  * Used for scheme specific parsing and evaluation of an XPointer expression.
  32  * This interface applies to both ShortHand and SchemeBased XPointer
  33  * expressions.
  34  * </p>
  35  *
  36  * @xerces.internal
  37  *
  38  */
  39 public interface XPointerPart {
  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      * Provides scheme specific parsing of a XPointer expression i.e.
  52      * the PointerPart or ShortHandPointer.
  53      *
  54      * @param  part A String representing the PointerPart or ShortHandPointer.
  55      * @throws XNIException Thrown if the PointerPart string does not conform to
  56      *         the syntax defined by its scheme.
  57      *
  58      */
  59     public void parseXPointer(String part) throws XNIException;
  60 
  61     /**
  62      * Evaluates an XML resource with respect to an XPointer expressions
  63      * by checking if it's element and attributes parameters match the
  64      * criteria specified in the xpointer expression.
  65      *
  66      * @param element - The name of the element.
  67      * @param attributes - The element attributes.
  68      * @param augs - Additional information that may include infoset augmentations
  69      * @param event - An integer indicating
  70      *                0 - The start of an element
  71      *                1 - The end of an element
  72      *                2 - An empty element call
  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 a resource fragment
  81      * specified as input else returns false.
  82      *
  83      * @return True if the xpointer expression matches a 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 to a non-element child
  92      * of the current resource fragment.
  93      *
  94      * @return True if the XPointer expression resolves to a non-element child
  95      *         of the current resource fragment.
  96      * @throws XNIException Thrown to signal an error
  97      *
  98      */
  99     public boolean isChildFragmentResolved() throws XNIException;
 100 
 101     /**
 102      * Returns a String containing the scheme name of the PointerPart
 103      * or the name of the ShortHand Pointer.
 104      *
 105      * @return A String containing the scheme name of the PointerPart.
 106      *
 107      */
 108     public String getSchemeName();
 109 
 110     /**
 111      * Returns a String containing the scheme data of the PointerPart.
 112      *
 113      * @return A String containing the scheme data of the PointerPart.
 114      *
 115      */
 116     public String getSchemeData();
 117 
 118     /**
 119      * Sets the scheme name of the PointerPart or the ShortHand Pointer name.
 120      *
 121      * @param schemeName A String containing the scheme name of the PointerPart.
 122      *
 123      */
 124     public void setSchemeName(String schemeName);
 125 
 126     /**
 127      * Sets the scheme data of the PointerPart.
 128      *
 129      * @param schemeData A String containing the scheme data of the PointerPart.
 130      *
 131      */
 132     public void setSchemeData(String schemeData);
 133 
 134 }