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 } | 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 * The XPointerProcessor is responsible for parsing an XPointer 32 * expression and and providing scheme specific resolution of 33 * the document fragment pointed to be the pointer. 34 * </p> 35 * 36 * @xerces.internal 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 public void parseXPointer(String xpointer) throws XNIException; 61 62 /** 63 * Evaluates an XML resource with respect to an XPointer expressions 64 * by checking if it's element and attributes parameters match the 65 * criteria specified in the xpointer expression. 66 * 67 * @param element - The name of the element. 68 * @param attributes - The element attributes. 69 * @param augs - Additional information that may include infoset augmentations 70 * @param event - An integer indicating 71 * 0 - The start of an element 72 * 1 - The end of an element 73 * 2 - An empty element call 74 * @return true if the element was resolved by the xpointer 75 * @throws XNIException Thrown to signal an error 76 */ 77 public boolean resolveXPointer(QName element, XMLAttributes attributes, 78 Augmentations augs, int event) throws XNIException; 79 80 /** 81 * Returns true if the XPointer expression resolves to the current resource fragment 82 * or Node which is part of the input resource being streamed else returns false. 83 * 84 * @return True if the xpointer expression matches a node/fragment in the resource 85 * else returns false. 86 * @throws XNIException Thrown to signal an error 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 public boolean isXPointerResolved() throws XNIException; 99 100 } |