ws-woden-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sag...@apache.org
Subject svn commit: r809835 [8/11] - in /webservices/woden/trunk/java/woden-api: ./ src/ src/main/ src/main/java/ src/main/java/javax/ src/main/java/javax/xml/ src/main/java/javax/xml/namespace/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/ap...
Date Tue, 01 Sep 2009 05:54:21 GMT
Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/IntOrTokenAttr.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/IntOrTokenAttr.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/IntOrTokenAttr.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/IntOrTokenAttr.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.xml;
+
+
+/**
+ * This interface represents XML attribute information items of type 
+ * 'Union of xs:int, xs:token', for example
+ * the whttp:code extension attribute of binding <fault>.
+ * <p>
+ * The <code>isInt</code> and <code>isToken</code> methods determine whether 
+ * to call the <code>getInt</code> or <code>getToken</code> methods. 
+ * If the implementor object is initialized with an int,
+ * <code>isInt</code> will return 'true', <code>isToken</code> will return
+ * 'false', <code>getInt</code> will return the int value and <code>getToken</code> 
+ * will return null. If it is initialized with an xs:token, <code>isInt</code> 
+ * will return 'false', <code>isToken</code> will return 'true', <code>getInt</code> 
+ * will return null and <code>getToken</code> will return the token string.
+ * <p>
+ * If the implementor object is initialized with a null value (i.e. because
+ * of an attribute value conversion error or because the attribute value
+ * was empty in the WSDL),  the <code>getContents</code>, <code>getInt</code> 
+ * and <code>getToken</code> methods will return null and <code>isInt</code>, 
+ * <code>isToken</code> and <code>isValid</code> will return false.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface IntOrTokenAttr extends XMLAttr 
+{
+    public boolean isInt();
+    
+    public boolean isToken();
+    
+    public Integer getInt();
+    
+    public String getToken();
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameAttr.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameAttr.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameAttr.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameAttr.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This interface represents XML attribute information items of type xs:QName.
+ * If the attribute's string value cannot be converted into a QName object the
+ * getContent() and getQName() methods will return null and isValid() will return
+ * false.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface QNameAttr extends XMLAttr 
+{
+    public QName getQName();
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameListAttr.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameListAttr.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameListAttr.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameListAttr.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This interface represents XML attribute information items of type 
+ * xs:list of QNames. The string is converted into a collection of QNames,
+ * one for each valid name in the string. The QNames can be retrieved as an
+ * array of QName. If an error occurs converting a QName it will not be included
+ * in the array and the isValid() method will return false (even if there are 
+ * some valid QNames in the list). If no qnames can be converted from the string,
+ * getContent() and getQNames() will return null and isValid() will return false.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface QNameListAttr extends XMLAttr 
+{
+    public QName[] getQNames();
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameListOrTokenAttr.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameListOrTokenAttr.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameListOrTokenAttr.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameListOrTokenAttr.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This interface represents XML attribute information items of type 
+ * 'Union of list of xs:QName or xs:token', for example
+ * the wsoap:subcodes extension attribute of binding &lt;fault&gt;.
+ * <p>
+ * The <code>isQNameList</code> method can be used to determine whether
+ * to call the <code>getQNames</code> method or the <code>getToken</code>
+ * method. If the implementor object is initialized with a list of QNames,
+ * <code>isQNameList</code> will return 'true', <code>getQNames</code>
+ * will return an array of QName objects and <code>getToken</code> will return
+ * null. If it is initialized with a xs:token, <code>isQNameList</code> will 
+ * return 'false', <code>getQNames</code> will return null and 
+ * <code>getToken</code> will return the token string.
+ * <p>
+ * If the implementor object is initialized with a null value (i.e. because
+ * of an attribute value conversion error or because the attribute value
+ * was empty in the WSDL),  the <code>getContents</code>, 
+ * <code>getQNameList</code> and <code>getToken</code> methods will return null 
+ * and <code>isQNameList</code> and <code>isValid</code> will return false.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface QNameListOrTokenAttr extends XMLAttr 
+{
+    public boolean isQNameList();
+    
+    public boolean isToken();
+    
+    public QName[] getQNames();
+    
+    public String getToken();
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameOrTokenAttr.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameOrTokenAttr.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameOrTokenAttr.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/QNameOrTokenAttr.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This interface represents XML attribute information items of type 
+ * 'Union of xs:QName or xs:token', for example
+ * the wsoap:code extension attribute of binding &lt;fault&gt;.
+ * <p>
+ * The <code>isQName</code> method can be used to determine whether
+ * to call the <code>getQName</code> method or the <code>getToken</code>
+ * method. If the implementor object is initialized with a QName,
+ * <code>isQName</code> will return 'true', <code>getQName</code>
+ * will return the QName object and <code>getToken</code> will return
+ * null. If it is initialized with a xs:token, <code>isQName</code> will 
+ * return 'false', <code>getQName</code> will return null and 
+ * <code>getToken</code> will return the token string.
+ * <p>
+ * If the implementor object is initialized with a null value (i.e. because
+ * of an attribute value conversion error or because the attribute value
+ * was empty in the WSDL),  the <code>getContents</code>, 
+ * <code>getQName</code> and <code>getToken</code> methods will return null 
+ * and <code>isQName</code> and <code>isValid</code> will return false.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface QNameOrTokenAttr extends XMLAttr 
+{
+    public boolean isQName();
+    
+    public boolean isToken();
+    
+    public QName getQName();
+    
+    public String getToken();
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/StringAttr.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/StringAttr.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/StringAttr.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/StringAttr.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.xml;
+
+
+/**
+ * This interface represents XML attribute information items of type xs:string.
+ * If the object is initialized with a null value, the getContents() and getString()
+ * methods will return null and isValid() will return false.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface StringAttr extends XMLAttr 
+{
+    public String getString();
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/TokenAttr.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/TokenAttr.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/TokenAttr.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/TokenAttr.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.xml;
+
+
+/**
+ * This interface represents XML attribute information items of type xs:token.
+ * If the object is initialized with a null value, the getContents() and getToken()
+ * methods will return null and isValid() will return false.
+ * 
+ * TODO create org.apache.woden.types.Token based on the same class in org.apache.axis.types
+ * and modify the getToken method here to return Token instead of String.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface TokenAttr extends XMLAttr 
+{
+    public String getToken();
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/URIAttr.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/URIAttr.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/URIAttr.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/URIAttr.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.xml;
+
+import java.net.URI;
+
+/**
+ * This interface represents XML attribute information items of type xs:anyURI.
+ * If the attribute value cannot be converted into a java.net.URI the getContent()
+ * and getURI() methods will return null and isValid() will return false.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface URIAttr extends XMLAttr 
+{
+    public URI getURI();
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/UnknownAttr.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/UnknownAttr.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/UnknownAttr.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/UnknownAttr.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+
+/**
+ * This class represents extension attributes (those not in the WSDL namespace)
+ * that do not have a Java type registered in the Extension Registry.
+ * It treats the attribute's value as a string.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class UnknownAttr implements XMLAttr
+{
+    private QName fAttrType = null;
+    private Object fContent = null;
+    private String fExternalForm = null;
+    private boolean fValid = true;
+    private ErrorReporter fErrorReporter = null;
+
+    public UnknownAttr(XMLElement ownerEl, QName attrType, 
+            String attrValue, ErrorReporter errRpt) throws WSDLException
+    {
+        fErrorReporter = errRpt;
+        fAttrType = attrType;
+        fExternalForm = attrValue;
+        fContent = attrValue;
+        if(fContent == null) {
+            fValid = false;
+        }
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.XMLAttr#getAttributeType()
+     */
+    public QName getAttributeType() {
+        return fAttrType;
+    }
+
+    /* (non-Javadoc)
+    * @see org.apache.woden.xml.XMLAttr#getContent()
+    */
+    public Object getContent() {
+        return fContent;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.XMLAttr#toExternalForm()
+     */
+    public String toExternalForm() {
+        return fExternalForm;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.xml.XMLAttr#isValid()
+     */
+    public boolean isValid() {
+        return fValid;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/XMLAttr.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/XMLAttr.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/XMLAttr.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xml/XMLAttr.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.XMLElement;
+
+/**
+ * This interface represents an XML attribute information item. It can be initialized
+ * with the string value of an attribute and the implementation must convert the string into
+ * an object of the appropriate type. The getContent() method will return the converted 
+ * Object and the caller must cast this to the appropriate type. 
+ * If a conversion error occured because the string was not in the correct form, 
+ * the isValid() method will return false. The toExternalForm() method will return the
+ * attribute's original string value.
+ * 
+ * @author jkaputin@apache.org
+ */
+public interface XMLAttr 
+{
+    public QName getAttributeType();
+    
+    public Object getContent();
+    
+    public String toExternalForm();
+    
+    public boolean isValid();
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/ElementPointerPart.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/ElementPointerPart.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/ElementPointerPart.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/ElementPointerPart.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,264 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.woden.xpointer;
+
+import org.apache.woden.types.NCName;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.lang.StringBuffer;
+
+import java.lang.NumberFormatException;
+
+/**
+ * ElementPointerPart is a class which represents the element() scheme for the XPointer Framework.
+ * The specification is defined at <a href="http://www.w3.org/TR/xptr-element/">http://www.w3.org/TR/xptr-element/</a>
+ * 
+ * This class is immutable.
+ * 
+ * @author Dan Harvey (danharvey42@gmail.com)
+ *
+ */
+public class ElementPointerPart implements PointerPart {
+    private final NCName ncname;
+    private final List childSequence;
+    
+    /**
+     * Constructs an ElementPointerPart with only an elementID NCName.
+     * 
+     * @param elementID an NCName of the elementID to reference.
+     * @throws NullPointerException is a null elementID is given.
+     */
+    public ElementPointerPart(NCName elementID) {
+        if(elementID == null) {
+            throw new NullPointerException("The elementID argument is null.");
+        }
+        this.ncname = elementID;
+        this.childSequence = null;
+    }
+    
+    /**
+     * Constructs an ElementPointerPart with only a childSequence.
+     * 
+     * @param childSequence a List of Integers representing the child sequence.
+     * @throws NullPointerException if childSequence is null.
+     * @throws IllegalArgumentException if childSequence is empty or contains elements other than Integers.
+     */
+    public ElementPointerPart(List childSequence) {
+        if(childSequence == null) {
+            throw new NullPointerException("The childSequence argument is null.");
+        }
+        if(childSequence.isEmpty()) {
+            throw new IllegalArgumentException("The childSequence list is empty.");
+        }
+        for(Iterator it = childSequence.iterator(); it.hasNext();) {
+            if(!(it.next() instanceof Integer)){
+                throw new IllegalArgumentException("The childSequence list must only contain Integers.");
+            }
+        }
+        this.ncname = null;
+        this.childSequence = childSequence;
+    }
+    
+    /**
+     * Constructs an ElementPointerPart with both an NCName and a childSequence.
+     * 
+     * @param elementID an NCName of the elementID to reference.
+     * @param childSequence a List of Integers representing the child sequence.
+     * @throws NullPointerException if elementID or childSequence are null.
+     * @throws IllegalArgumentException if childSequence is empty or contains elements other than Integers.
+     */
+    public ElementPointerPart(NCName elementID, List childSequence) {
+        if(elementID == null) {
+            throw new NullPointerException("The elementID argument is null.");
+        }
+        if(childSequence == null) {
+            throw new NullPointerException("The childSequence argument is null.");
+        }
+        if(childSequence.isEmpty()) {
+            throw new IllegalArgumentException("The childSequence list is empty.");
+        }
+        for(Iterator it = childSequence.iterator(); it.hasNext();) {
+            Object integer = it.next();
+            if(!(integer instanceof Integer)){
+                throw new IllegalArgumentException("the childSequence list must only contain Integers.");
+            } else if (((Integer)integer).intValue() == 0){
+                throw new IllegalArgumentException("the childSequence list must only contain Integers bigger than 0.");
+            }
+        }
+        this.ncname = elementID;
+        this.childSequence = childSequence;
+    }
+    
+    /**
+     * Returns the NCName for this Element PointerPart.
+     * 
+     * @return an NCName if it exists in this Element PointerPart, otherwise null.
+     */
+    public NCName getNCName() {
+        return ncname;
+    }
+    
+    /**
+     * Returns the child sequence of this Element PointerPart.
+     * 
+     * @return a Integer[] of the child sequence for this element pointer part, or an empty array if none exists. 
+     */
+    public Integer[] getChildSequence() {
+        int size = childSequence.size();
+        Integer[] sequence = new Integer[size];
+        for(int i=0; i<size; i++) {
+            sequence[i] = (Integer)childSequence.get(i);
+        }
+        return sequence;
+    }
+    
+    /**
+     * Checks if this Element PointerPart has a NCName or not.
+     * 
+     * @return a boolean, true if it has a NCName or false if not.
+     */
+    public boolean hasNCName() {
+        return ncname != null;
+    }
+    
+    /**
+     * Checks if this Element PointerPart has a childSequence or not.
+     * 
+     * @return a boolean, true if this has a childSequence or false if not.
+     */
+    public boolean hasChildSequence() {
+        return childSequence != null;
+    }
+    
+    /*
+     *(non-Javadoc)
+     * @see org.apache.woden.xpointer.PointerPart#toString()
+     */
+    public String toString() {
+        String schemeData;
+        if (childSequence == null) {
+            schemeData = ncname.toString();
+        } else if (ncname == null) {
+            schemeData = serialiseChildSequence();
+        } else {
+            schemeData = ncname.toString() + serialiseChildSequence();
+        }
+        return "element(" + schemeData + ")";
+    }
+    
+    /**
+     * Serialises the child sequence and returns it as a string.
+     * 
+     * @return a String of the serialised child sequence.
+     */
+    private String serialiseChildSequence() {
+        StringBuffer buffer = new StringBuffer();
+        for(Iterator it = childSequence.iterator(); it.hasNext();) {
+            Integer child = (Integer)it.next();
+            buffer.append("/" + child.toString());
+        }
+        return buffer.toString();
+    }
+    
+    /**
+     * Deserialises the schemaData for an ElementPointerPart and constructs a new ElementPointerPart from it.
+     * 
+     * @param schemeData a String of the schemeaData parsed from the string XPointer.
+     * @return an ElementPointerPart representing the parsed schemaData.
+     * @throws IllegalArgumentException if the schemeData has invalid scheme syntax.
+     */
+    public static ElementPointerPart parseFromString(final String schemeData) throws InvalidXPointerException {
+        List childSequence = null;
+        NCName elementID = null;
+        int startChar;
+        int endChar;
+        
+        //Find an NCName if it exists?
+        startChar = schemeData.indexOf("/");
+        // -1 Only an NCName. 0 No NCName. > 1 An NCName.
+        
+        switch (startChar) {
+            case -1: //Only an NCName.
+                try {
+                    elementID = new NCName(schemeData);
+                }
+                catch (IllegalArgumentException e) {
+                    throw new InvalidXPointerException("Invalid NCName in the XPointer", schemeData);
+                }
+                return new ElementPointerPart(elementID);
+            case 0: //No NCName.
+                break;
+            default: //An NCName.
+                try {
+                    elementID = new NCName(schemeData.substring(0, startChar));
+                } catch (IllegalArgumentException e) {
+                    throw new InvalidXPointerException("Invalid NCName in the XPointer", schemeData, 0, startChar);
+                }
+                break;
+        }
+        
+        //Find remaining child sequence.
+        childSequence = new ArrayList();
+        
+        endChar = schemeData.indexOf("/", startChar+1);
+        // -1 Only single child sequence element. > 0 A childSequence.
+        
+        if (endChar < 0) { //Only single child sequence element.
+            childSequence.add(parseIntegerFromChildSequence(schemeData, startChar+1, schemeData.length()));
+        } else { //Multiple child sequence elements.
+            while(true) {
+                if (endChar < 0) {//Last integer.
+                    childSequence.add(parseIntegerFromChildSequence(schemeData, startChar+1, schemeData.length()));
+                    break;
+                } else { //Inner sequence integer.
+                    childSequence.add(parseIntegerFromChildSequence(schemeData, startChar+1, endChar));
+                    startChar = endChar;
+                    endChar = schemeData.indexOf("/", startChar+1);
+                }
+            }
+        }
+
+        if (elementID == null) { //Only a childSequence
+            return new ElementPointerPart(childSequence);
+        } else { //Both NCName and childSequence
+            return new ElementPointerPart(elementID, childSequence);
+        }
+    }
+
+    /**
+     * Parses a String for an integer between two indices and returns this as an Integer.
+     * 
+     * @param string a String to parse.
+     * @param start an int char index to the start of the Integer.
+     * @param end an int char index to the end of the Integer.
+     * @return an Integer resulting from parsing the given String in the index range.
+     * @throws IllegalArgumentException if the given char range does not contain an integer.
+     */
+    private static Integer parseIntegerFromChildSequence(String string, int start, int end) throws InvalidXPointerException{
+        if (start < end) { //Make sure sub string is not of zero length.
+            try { //Make sure the integer is valid.
+                return new Integer(string.substring(start, end));
+            } catch (NumberFormatException e) {
+                throw new InvalidXPointerException("The child sequence part contained a invalid integer.", string,  start, end);
+            }
+        } else {
+            throw new InvalidXPointerException("The child sequence part contained a empty item at " + String.valueOf(start), string, start, end);
+        }
+    }
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/InvalidXPointerException.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/InvalidXPointerException.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/InvalidXPointerException.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/InvalidXPointerException.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,141 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.woden.xpointer;
+
+/**
+ * This class represents Exceptions that can happen during parsing an XPointer Expression.
+ * 
+ * @author Dan Harvey <danharvey42@gmail.com>
+ *
+ */
+public class InvalidXPointerException extends Exception {
+    private static final long serialVersionUID = 0;
+    private final String fragment;
+    private final Integer startChar;
+    private final Integer endChar;
+    
+    /**
+     * Constructs a InvalidXPointerException with a message and fragment properties.
+     * 
+     * @param message a String message of error.
+     * @param fragment a String fragment of the cause.
+     */
+    public InvalidXPointerException(String message, String fragment) {
+        this(message, fragment, null, null, null);
+    }
+    
+    /**
+     * Constructs a InvalidXPointerException with a message and fragment properties.
+     * 
+     * It also has a Throwable argument to support exception chaining.
+     * 
+     * @param message a String message of error.
+     * @param fragment a String fragment of the cause of the error.
+     * @param cause a Throwable which caused this exception to be thrown.
+     */
+    public InvalidXPointerException(String message, String fragment, Throwable cause) {
+        this(message, fragment, null, null, cause);
+    }
+    
+    /**
+     * Constructs a InvalidXPointerException with a message and fragment properties,
+     * and index to the cause inside the fragment.
+     * 
+     * @param message a String message of error.
+     * @param fragment a String fragment of the cause of the error.
+     * @param startChar a int char index to the start of the cause in the fragment.
+     * @param endChar a int char index to the end of the cause in the fragment.
+     */
+    public InvalidXPointerException(String message, String fragment, int startChar, int endChar) {
+        this(message, fragment, new Integer(startChar), new Integer(endChar), null);
+    }
+    
+    /**
+     * Constructs a InvalidXPointerException with a message and fragment properties,
+     * and index to the cause inside the fragment.
+     * 
+     * It also has a Throwable argument to support exception chaining.
+     * 
+     * @param message a String message of error.
+     * @param fragment a String fragment of the cause of the error.
+     * @param startChar an int char index to the start of the cause in the fragment.
+     * @param endChar an int char index to the end of the cause in the fragment.
+     * @param cause a Throwable which caused the exception to be thrown.
+     */
+    public InvalidXPointerException(String message, String fragment, int startChar, int endChar, Throwable cause) {
+        this(message, fragment, new Integer(startChar), new Integer(endChar), cause);
+    }
+
+    /**
+     * Constructs a new InvalidXPointerException.
+     * This constructor is called by all of the above constructors and stores the in indexes and Integers internally.
+     * 
+     * @param message a String message of error.
+     * @param fragment a String fragment of the cause of the error.
+     * @param startChar an Integer char index to the start of the cause in the fragment.
+     * @param endChar an Integer char index to the end of the cause in the fragment.
+     * @param cause a Throwable which caused the exception to be thrown.
+     */
+    private InvalidXPointerException(String message, String fragment, Integer startChar, Integer endChar, Throwable cause) {
+        super(message, cause);
+        this.fragment = fragment;
+        this.startChar = startChar;
+        this.endChar = endChar;
+    }
+       
+    /**
+     * Returns the fragment String stored inside this exception.
+     * 
+     * @return a String fragment.
+     */
+    public String getFragment() {
+        return fragment;
+    }
+    
+    /**
+     * Returns the startChar index of the cause of this error in the fragment.
+     * 
+     * @return an Integer of the startChar index if one exists, otherwise null.
+     */
+    public Integer getStartChar() {
+        return startChar;
+    }
+    
+    /**
+     * Returns the endChar index of the cause of this error in the fragment.
+     * 
+     * @return an Integer of the startChar index if one exists, otherwise null.
+     */
+    public Integer getEndChar() {
+        return endChar;
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see java.lang.Throwable#toString()
+     */
+    public String toString() {
+        String postString;
+        if (startChar != null && endChar!= null) {
+            postString = "{XPointer: " + fragment + ", start: " + startChar.toString()+ ", end: " + endChar.toString() + ", substr: " + fragment.substring(startChar.intValue(), endChar.intValue()) + "}";
+        } else {
+            postString = "{XPointer: " + fragment + "}";
+        }
+        return "InvalidXPointerException: " + getMessage() + ". " + postString;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/PointerPart.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/PointerPart.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/PointerPart.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/PointerPart.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.woden.xpointer;
+
+/**
+ * Interface to be implemented by pointer parts (XPointer schemes).
+ */
+
+public interface PointerPart {
+    
+    /**
+     * Returns a String serialisation of this xpointer PointerPart.
+     * 
+     * @return a String containing the serialisation of this xpointer PointerPart.
+     */
+    public String toString();
+    
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointer.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointer.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointer.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointer.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,257 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.woden.xpointer;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+
+import java.util.Iterator;
+import java.lang.StringBuffer;
+
+import org.apache.woden.types.NCName;
+
+/**
+ * XPointer is a class which represents an XPointer defined in the XPointer Framework.
+ * This is specified at <a href="http://www.w3.org/TR/xptr-framework/">http://www.w3.org/TR/xptr-framework/</a>
+ * 
+ * @author Dan Harvey (danharvey42@gmail.com)
+ * 
+ */
+public class XPointer {
+    private static final String emptyString = "".intern();
+    private final Map prefixBindingContex;
+    private final Map namespaceBindingContex;
+    private NCName shorthandPointer;
+    private final List pointerParts;
+    
+    private static final NCName emptyNCName = new NCName(emptyString);
+    
+    private static final String NS_URI_XML = "http://www.w3.org/XML/1998/namespace";
+    private static final String NS_URI_XMLNS = "http://www.w3.org/2000/xmlns/";
+    private static final NCName NS_PREFIX_XMLNS = new NCName("xmlns");
+
+    /**
+     * Constructs a new XPointer.
+     * 
+     */
+    public XPointer() {
+        pointerParts = new ArrayList();
+        shorthandPointer = emptyNCName;
+        
+        //Setup prefix/namespace binding context.
+        prefixBindingContex = new HashMap();
+        namespaceBindingContex = new HashMap();
+        addPrefixNamespaceBinding(new NCName("xml"), NS_URI_XML);
+    }
+    
+    /**
+     * Constructs a new XPointer from the serialised string.
+     * 
+     * @param xpointerString a String form of the XPointer to deserialise.
+     */
+    public XPointer(String xpointerString) throws InvalidXPointerException {
+        this(); //Construct a new XPointer.
+        if (xpointerString == null || xpointerString.equals(emptyString))
+            throw new InvalidXPointerException("The XPointer string is either null or empty", emptyString);
+        XPointerParser.parseXPointer(xpointerString, this); //Parse the string and add the Pointers to the new XPointer.
+    }
+    
+    /**
+     * Appends a pointer part to the end of this XPointer.
+     * 
+     * @param pointerPart the Pointer Part to append.
+     * @throws UnsupportedOperationException() if a Shorthand Pointer is already set.
+     */
+    public void addPointerPart(PointerPart pointerPart) {
+        if(!shorthandPointer.equals(emptyNCName)) {
+            throw new UnsupportedOperationException("A Shortname Pointer already exists for this XPointer.");
+        } else {
+            pointerParts.add(pointerPart); 
+        }
+    }
+    
+    /**
+     * Inserts a pointer part at index of this XPointer.
+     * 
+     * @param pointerPart the Pointer Part to inserted.
+     * @param index an integer specifying the point to insert the pointer part.
+     * @throws UnsupportedOperationException() if a Shorthand Pointer is already set.
+     */
+    public void addPointerPart(int index, PointerPart pointerPart) {
+        if(hasShorthandPointer()) {
+            throw new UnsupportedOperationException("A Shortname Pointer already exists for this XPointer.");
+        }
+        if(index < 0 || index > pointerParts.size()) {
+            throw new IndexOutOfBoundsException("The index you gave is out of the bounds of the list of XPointers");
+        }
+        pointerParts.add(index, pointerPart); 
+    }
+    
+    /**
+     * Returns the pointer parts in this XPointer.
+     * 
+     * @return a PointerPart[] of type Object[] containing the pointer parts in this XPointer.
+     * @throws IllegalStateException if this XPointer has a shorthand pointer.
+     */
+    public Object[] getPointerParts() {
+        if (hasPointerParts()) {
+            int size = pointerParts.size();
+            Object[] parts = new Object[size]; //Ugly but it will have to do for Java 1.4
+            for(int i=0; i<size; i++) {
+                parts[i] = pointerParts.get(i);
+            }
+            return parts;
+        } else {
+            throw new IllegalStateException("This XPointer has a shorthand pointer.");
+        }
+    }
+    
+    /**
+     * Sets the Shorthand Pointer of this XPointer to the NCName given as an argument.
+     * 
+     * @param shorthandPointer an NCName of the Shorthand Pointer to set.
+     * @throws UnsupportedOperationException() is a PointerPart Pointer is already set.
+     */
+    public void setShorthandPointer(NCName shorthandPointer) {
+        if (hasPointerParts()) {
+            throw new UnsupportedOperationException("A PointerPart Pointer already exists for this XPointer");
+        }
+        if (shorthandPointer.equals(null)) {
+            throw new NullPointerException("The shorthandPointer argument is null");
+        }
+        
+        this.shorthandPointer = shorthandPointer;
+    }
+    
+    /**
+     * Returns the shorthandPointer in this XPointer.
+     * 
+     * @return an NCName containing the shorthand pointer for this XPointer.
+     * @throws IllegalStateException if this XPointer has a shorthand pointer.
+     */
+    public NCName getShorthandPointer() {
+        if (hasShorthandPointer()) {
+            return shorthandPointer;
+        } else {
+            throw new IllegalStateException("This XPointer has scheme based pointers.");
+        }
+    }
+    
+    /**
+     * Adds a Prefix/Namespace binding to this XPointers contex.
+     * 
+     * @param prefix a NCName of the prefix too bind to the namespace.
+     * @param namespace a String of the namespace to bind to the prefix.
+     * @throws NullPointerException if the prefix or namespace arguments are null.
+     * @throws IllegalArgumentException if the prefix or namespace are invalid as specified at <a href="http://www.w3.org/TR/xptr-framework/#nsContext">http://www.w3.org/TR/xptr-framework/#nsContext</a>
+     */
+    public void addPrefixNamespaceBinding(NCName prefix, String namespace) {
+        if (prefix == null)
+            throw new NullPointerException("The prefix argument provided has a null pointer.");
+        if (namespace == null)
+            throw new NullPointerException("The namespace argument provided has a null pointer.");
+        if (prefix.equals(NS_PREFIX_XMLNS))
+            throw new IllegalArgumentException("The xmlns prefix must not be bound to any namespace.");
+        if (namespace.equals(NS_URI_XMLNS))
+            throw new IllegalArgumentException("The " + NS_URI_XMLNS + " namespace must not be bound to any prefix.");
+        //Its a valid binding so add it to the binding contex.
+        prefixBindingContex.put(prefix, namespace);
+        namespaceBindingContex.put(namespace, prefix);
+    }
+    
+    /**
+     * Gets the Namespace the Prefix is bound to if the binding exists,
+     * otherwise it will return null.
+     * 
+     * @param prefix a NCName of the prefix bound to the namespace.
+     * @return A String of the namespace bound to this prefix or null if none exists.
+     */
+    public String getPrefixBinding(NCName prefix) {
+        return (String)prefixBindingContex.get(prefix);
+    }
+    
+    /**
+     * Gets Prefix the Namespace is bound to if the binding exists,
+     * otherwise it will return null.
+     * 
+     * @param namespace a String of the prefix bound to the prefix.
+     * @return A NCName of the prefix bound to this namespace or null if none exists.
+     */
+    public NCName getNamespaceBinding(String namespace) {
+        return (NCName)namespaceBindingContex.get(namespace);
+    }
+    
+    /**
+     * Checks whether a prefix is bound or not.
+     * 
+     * @param prefix A NCName of the prefix to check.
+     * @return a boolean value that is true if the binding exists, or false otherwise.
+     */
+    public boolean hasPrefixBinding(NCName prefix) {
+        return prefixBindingContex.containsKey(prefix);
+    }
+    
+    /**
+     * Checks whether a namespace is bound or not.
+     * 
+     * @param namespace A String of the namespace to check.
+     * @return a boolean value that is true if the binding exists, or false otherwise.
+     */
+    public boolean hasNamespaceBinding(String namespace) {
+        return namespaceBindingContex.containsKey(namespace);
+    }
+
+    /**
+     * Tests whether this XPointer has a shorthand pointer or not.
+     * 
+     * @return a boolean which is true if this XPointer contains an shorthand pointer, false otherwise.
+     */
+    public boolean hasShorthandPointer() {
+        return !shorthandPointer.equals(emptyNCName);
+    }
+    
+    /**
+     * Tests whether this XPointer has scheme based pointers or not.
+     * 
+     * @return a boolean which is true if this XPointer contains scheme based pointers, false otherwise.
+     */
+    public boolean hasPointerParts() {
+        return !pointerParts.isEmpty();
+    }
+    
+    /**
+     * Returns a String serialisation of this XPointer.
+     * 
+     * @return a String containing the serialisation of this XPointer
+     */
+    public String toString() {
+        if (shorthandPointer.equals(emptyNCName)) {
+            StringBuffer buffer = new StringBuffer();
+            Iterator parts = pointerParts.iterator();
+            while (parts.hasNext()) {
+                buffer.append(parts.next());
+            }
+            return buffer.toString();
+        } else {
+            return shorthandPointer.toString();
+        }
+    }
+    
+}
\ No newline at end of file

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointerParser.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointerParser.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointerParser.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XPointerParser.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,636 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.woden.xpointer;
+
+import java.util.Hashtable;
+
+import org.apache.woden.types.XMLChar;
+import org.apache.woden.types.NCName;
+
+/**
+ * This class parses a String to the XPointer Framework specification for shorthand and scheme based pointers.
+ * For scheme based pointers each know pointer part 
+ * 
+ * See the <a href="http://www.w3.org/TR/xptr-framework/">XPointer Framework Recommendation</a> for
+ * more information on the XPointer Framework, ShortHand and Scheme based Pointers.
+ * 
+ * This class based on the org.apache.xerces.xpointer.XPointerHandler class in the Apache Xerces Project
+ * for the core XPointer parsing code. It has been modified to be used inside the Woden XPointer model.
+ * 
+ * @author Dan Harvey (danharvey42@gmail.com)
+ *
+ */
+final class XPointerParser {
+
+    private static final String emptyString = "".intern();
+    /**
+     * Parses a String XPointer and stores the results into the given XPointer object.
+     * 
+     * @param xpointerString
+     * @param xpointer
+     * @throws InvalidXPointerException if the XPointer being parsed contains invalid syntax.
+     */
+    public static void parseXPointer(String xpointerString, XPointer xpointer) throws InvalidXPointerException{
+        final String ELEMENT_SCHEME_NAME = "element"; // Supported schemes
+        
+        final Tokens tokens = new Tokens(); // tokens
+
+        // scan the XPointer expression
+        int length = xpointerString.length();
+        boolean success = Scanner.scanExpr(tokens, xpointerString, 0, length);
+
+        if (!success)
+            throw new InvalidXPointerException("Invalid XPointer expression", xpointerString);
+
+        while (tokens.hasMore()) {
+            int token = tokens.nextToken();
+
+            switch (token) {
+            case Tokens.XPTRTOKEN_SHORTHAND: {
+
+                // The shorthand name
+                token = tokens.nextToken();
+                String shortHandPointerName = tokens.getTokenString(token);
+
+                if (shortHandPointerName == null)
+                    throw new InvalidXPointerException("Invalid Shorthand XPointer", xpointerString);
+
+                xpointer.setShorthandPointer(new NCName(shortHandPointerName));
+                break;
+                }
+            case Tokens.XPTRTOKEN_SCHEMENAME: {
+
+                // Retrieve the local name and prefix to form the scheme name
+                token = tokens.nextToken();
+                String prefix = tokens.getTokenString(token);
+                token = tokens.nextToken();
+                String localName = tokens.getTokenString(token);
+
+                String schemeName = prefix + localName;
+
+                // The next character should be an open parenthesis
+                int openParenCount = 0;
+                int closeParenCount = 0;
+
+                token = tokens.nextToken();
+                String openParen = tokens.getTokenString(token);
+                if (openParen != "XPTRTOKEN_OPEN_PAREN") {
+
+                    // can not have more than one ShortHand Pointer
+                    if (token == Tokens.XPTRTOKEN_SHORTHAND) {
+                        throw new InvalidXPointerException("MultipleShortHandPointers", xpointerString);
+                    } else {
+                        throw new InvalidXPointerException("Invalid XPointer Expression", xpointerString);
+                    }
+                }
+                openParenCount++;
+
+                // followed by zero or more ( and  the schemeData
+                String schemeData = null;
+                while (tokens.hasMore()) {
+                    token = tokens.nextToken();
+                    schemeData = tokens.getTokenString(token);
+                    if (schemeData != "XPTRTOKEN_OPEN_PAREN") {
+                        break;
+                    }
+                    openParenCount++;
+                }
+                token = tokens.nextToken();
+                schemeData = tokens.getTokenString(token);
+
+                // followed by the same number of )
+                if (tokens.hasMore()) {
+                    token = tokens.nextToken();
+                    String closeParen = tokens.getTokenString(token);
+                    if (closeParen != "XPTRTOKEN_CLOSE_PAREN")
+                        new InvalidXPointerException("SchemeDataNotFollowedByCloseParenthesis", xpointerString);
+                } else {
+                    new InvalidXPointerException("SchemeDataNotFollowedByCloseParenthesis", xpointerString);
+                }
+                
+                closeParenCount++;
+
+                while (tokens.hasMore()) {
+                    if (tokens.getTokenString(tokens.peekToken()) != "XPTRTOKEN_OPEN_PAREN") {
+                        break;
+                    }
+                    closeParenCount++;
+                }
+
+                // check if the number of open parenthesis are equal to the number of close parenthesis
+                if (openParenCount != closeParenCount) {
+                    throw new InvalidXPointerException("UnbalancedParenthesisInXPointerExpression", xpointerString);
+                }
+
+                // Perform scheme specific parsing of the pointer part, make this more generic for any pointer part?
+                if (schemeName.equals(ELEMENT_SCHEME_NAME)) {
+                    PointerPart elementSchemePointer = ElementPointerPart.parseFromString(schemeData);
+                    xpointer.addPointerPart(elementSchemePointer);
+                } //Else an unknown scheme.
+                break;
+            }
+            default:
+                throw new InvalidXPointerException("InvalidXPointerExpression", xpointerString);
+            }
+        }
+
+    }
+
+    /**
+     * List of XPointer Framework tokens.
+     * 
+     */
+    private static class Tokens {
+
+        /**
+         * XPointer Framework tokens
+         * [1] Pointer     ::= Shorthand | SchemeBased 
+         * [2] Shorthand   ::= NCName 
+         * [3] SchemeBased ::= PointerPart (S? PointerPart)* 
+         * [4] PointerPart ::= SchemeName '(' SchemeData ')' 
+         * [5] SchemeName  ::= QName 
+         * [6] SchemeData  ::= EscapedData* 
+         * [7] EscapedData ::= NormalChar | '^(' | '^)' | '^^' | '(' SchemeData ')' 
+         * [8] NormalChar  ::= UnicodeChar - [()^] 
+         * [9] UnicodeChar ::= [#x0-#x10FFFF]
+         *  
+         */
+        private static final int XPTRTOKEN_OPEN_PAREN = 0,
+                XPTRTOKEN_CLOSE_PAREN = 1, XPTRTOKEN_SHORTHAND = 2,
+                XPTRTOKEN_SCHEMENAME = 3, XPTRTOKEN_SCHEMEDATA = 4;
+
+        // Token count
+        private static final int INITIAL_TOKEN_COUNT = 1 << 8;
+
+        private int[] fTokens = new int[INITIAL_TOKEN_COUNT];
+
+        private int fTokenCount = 0;
+
+        // Current token position
+        private int fCurrentTokenIndex;
+
+        private Hashtable fTokenNames = new Hashtable();
+
+        /**
+         * Constructor 
+         * 
+         */
+        private Tokens() {
+
+            fTokenNames.put(new Integer(XPTRTOKEN_OPEN_PAREN),
+                    "XPTRTOKEN_OPEN_PAREN");
+            fTokenNames.put(new Integer(XPTRTOKEN_CLOSE_PAREN),
+                    "XPTRTOKEN_CLOSE_PAREN");
+            fTokenNames.put(new Integer(XPTRTOKEN_SHORTHAND),
+                    "XPTRTOKEN_SHORTHAND");
+            fTokenNames.put(new Integer(XPTRTOKEN_SCHEMENAME),
+                    "XPTRTOKEN_SCHEMENAME");
+            fTokenNames.put(new Integer(XPTRTOKEN_SCHEMEDATA),
+                    "XPTRTOKEN_SCHEMEDATA");
+        }
+
+        /**
+         * Returns the token String 
+         * @param token The index of the token
+         * @return String The token string
+         */
+        private String getTokenString(int token) {
+            return (String) fTokenNames.get(new Integer(token));
+        }
+
+        /**
+         * Add the specified string as a token
+         *  
+         * @param token The token string
+         */
+        private void addToken(String tokenStr) {
+            Integer tokenInt = (Integer) fTokenNames.get(tokenStr);
+            if (tokenInt == null) {
+                tokenInt = new Integer(fTokenNames.size());
+                fTokenNames.put(tokenInt, tokenStr);
+            }
+            addToken(tokenInt.intValue());
+        }
+
+        /**
+         * Add the specified int token
+         *  
+         * @param token The int specifying the token
+         */
+        private void addToken(int token) {
+            try {
+                fTokens[fTokenCount] = token;
+            } catch (ArrayIndexOutOfBoundsException ex) {
+                int[] oldList = fTokens;
+                fTokens = new int[fTokenCount << 1];
+                System.arraycopy(oldList, 0, fTokens, 0, fTokenCount);
+                fTokens[fTokenCount] = token;
+            }
+            fTokenCount++;
+        }
+
+
+
+        /**
+         * Returns true if the {@link #getNextToken()} method
+         * returns a valid token.
+         */
+        private boolean hasMore() {
+            return fCurrentTokenIndex < fTokenCount;
+        }
+
+        /**
+         * Obtains the token at the current position, then advance
+         * the current position by one.
+         * 
+         * throws If there's no such next token, this method throws
+         * <tt>new XNIException("XPointerProcessingError");</tt>.
+         */
+        private int nextToken() {
+            if (fCurrentTokenIndex == fTokenCount) {
+                throw new IndexOutOfBoundsException("There are no more tokens to return.");
+            }
+            return fTokens[fCurrentTokenIndex++];
+        }
+
+        /**
+         * Obtains the token at the current position, without advancing
+         * the current position.
+         * 
+         * If there's no such next token, this method throws
+         * <tt>new XNIException("XPointerProcessingError");</tt>.
+         */
+        private int peekToken() {
+            if (fCurrentTokenIndex == fTokenCount) {
+                throw new IndexOutOfBoundsException("There are no more tokens to return.");
+            }
+            return fTokens[fCurrentTokenIndex];
+        }
+    }
+
+    /**
+     * The XPointer expression scanner.  Scans the XPointer framework expression.
+     * 
+     */
+    private static class Scanner {
+
+        /**
+         * 7-bit ASCII subset
+         *
+         *  0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
+         *  0,  0,  0,  0,  0,  0,  0,  0,  0, HT, LF,  0,  0, CR,  0,  0,  // 0
+         *  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  // 1
+         * SP,  !,  ",  #,  $,  %,  &,  ',  (,  ),  *,  +,  ,,  -,  .,  /,  // 2
+         *  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  :,  ;,  <,  =,  >,  ?,  // 3
+         *  @,  A,  B,  C,  D,  E,  F,  G,  H,  I,  J,  K,  L,  M,  N,  O,  // 4
+         *  P,  Q,  R,  S,  T,  U,  V,  W,  X,  Y,  Z,  [,  \,  ],  ^,  _,  // 5
+         *  `,  a,  b,  c,  d,  e,  f,  g,  h,  i,  j,  k,  l,  m,  n,  o,  // 6
+         *  p,  q,  r,  s,  t,  u,  v,  w,  x,  y,  z,  {,  |,  },  ~, DEL  // 7
+         */
+        private static final byte CHARTYPE_INVALID = 0, // invalid XML character
+                CHARTYPE_OTHER = 1, // not special - one of "#%&;?\`{}~" or DEL
+                CHARTYPE_WHITESPACE = 2, // one of "\t\n\r " (0x09, 0x0A, 0x0D, 0x20)
+                CHARTYPE_CARRET = 3, // ^
+                CHARTYPE_OPEN_PAREN = 4, // '(' (0x28)
+                CHARTYPE_CLOSE_PAREN = 5, // ')' (0x29)
+                CHARTYPE_MINUS = 6, // '-' (0x2D)
+                CHARTYPE_PERIOD = 7, // '.' (0x2E)
+                CHARTYPE_SLASH = 8, // '/' (0x2F)
+                CHARTYPE_DIGIT = 9, // '0'-'9' (0x30 to 0x39)
+                CHARTYPE_COLON = 10, // ':' (0x3A)
+                CHARTYPE_EQUAL = 11, // '=' (0x3D)
+                CHARTYPE_LETTER = 12, // 'A'-'Z' or 'a'-'z' (0x41 to 0x5A and 0x61 to 0x7A)
+                CHARTYPE_UNDERSCORE = 13, // '_' (0x5F)
+                CHARTYPE_NONASCII = 14; // Non-ASCII Unicode codepoint (>= 0x80)
+
+        private static final byte[] fASCIICharMap = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2,
+                0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+                2, 1, 1, 1, 1, 1, 1, 1, 4, 5, 1, 1, 1, 6, 7, 8, 9, 9, 9, 9, 9,
+                9, 9, 9, 9, 9, 10, 1, 1, 11, 1, 1, 1, 12, 12, 12, 12, 12, 12,
+                12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+                12, 12, 12, 12, 1, 1, 1, 3, 13, 1, 12, 12, 12, 12, 12, 12, 12,
+                12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+                12, 12, 12, 1, 1, 1, 1, 1 };
+
+        /**
+         * Scans the XPointer Expression
+         * 
+         */
+        private static boolean scanExpr(Tokens tokens, String data, int currentOffset, int endOffset) throws InvalidXPointerException {
+            int ch;
+            int openParen = 0;
+            int closeParen = 0;
+            int nameOffset, dataOffset;
+            boolean isQName = false;
+            String name = null;
+            String prefix = null;
+            String schemeData = null;
+            StringBuffer schemeDataBuff = new StringBuffer();
+
+            while (true) {
+
+                if (currentOffset == endOffset) {
+                    break;
+                }
+                ch = data.charAt(currentOffset);
+
+                // 
+                while (ch == ' ' || ch == 0x0A || ch == 0x09 || ch == 0x0D) {
+                    if (++currentOffset == endOffset) {
+                        break;
+                    }
+                    ch = data.charAt(currentOffset);
+                }
+                if (currentOffset == endOffset) {
+                    break;
+                }
+
+                // 
+                // [1]    Pointer      ::=    Shorthand | SchemeBased  
+                // [2]    Shorthand    ::=    NCName  
+                // [3]    SchemeBased  ::=    PointerPart (S? PointerPart)* 
+                // [4]    PointerPart  ::=    SchemeName '(' SchemeData ')' 
+                // [5]    SchemeName   ::=    QName  
+                // [6]    SchemeData   ::=    EscapedData*  
+                // [7]    EscapedData  ::=    NormalChar | '^(' | '^)' | '^^' | '(' SchemeData ')'  
+                // [8]    NormalChar   ::=    UnicodeChar - [()^]  
+                // [9]    UnicodeChar  ::=    [#x0-#x10FFFF]
+                // [?]    QName        ::=    (NCName ':')? NCName
+                // [?]    NCName       ::=    (Letter | '_') (NCNameChar)*
+                // [?]    NCNameChar   ::=    Letter | Digit | '.' | '-' | '_'  (ascii subset of 'NCNameChar')
+                // [?]    Letter       ::=    [A-Za-z]                              (ascii subset of 'Letter')
+                // [?]    Digit        ::=    [0-9]                                  (ascii subset of 'Digit')
+                // 
+                byte chartype = (ch >= 0x80) ? CHARTYPE_NONASCII
+                        : fASCIICharMap[ch];
+
+                switch (chartype) {
+
+                case CHARTYPE_OPEN_PAREN: // '('
+                    addToken(tokens, Tokens.XPTRTOKEN_OPEN_PAREN);
+                    openParen++;
+                    ++currentOffset;
+                    break;
+
+                case CHARTYPE_CLOSE_PAREN: // ')'
+                    addToken(tokens, Tokens.XPTRTOKEN_CLOSE_PAREN);
+                    closeParen++;
+                    ++currentOffset;
+                    break;
+
+                case CHARTYPE_CARRET:
+                case CHARTYPE_COLON:
+                case CHARTYPE_DIGIT:
+                case CHARTYPE_EQUAL:
+                case CHARTYPE_LETTER:
+                case CHARTYPE_MINUS:
+                case CHARTYPE_NONASCII:
+                case CHARTYPE_OTHER:
+                case CHARTYPE_PERIOD:
+                case CHARTYPE_SLASH:
+                case CHARTYPE_UNDERSCORE:
+                case CHARTYPE_WHITESPACE:
+                    // Scanning SchemeName | Shorthand                   
+                    if (openParen == 0) {
+                        nameOffset = currentOffset;
+                        currentOffset = scanNCName(data, endOffset,
+                                currentOffset);
+
+                        if (currentOffset == nameOffset)
+                            throw new InvalidXPointerException("InvalidShortHandPointer", data);
+
+                        if (currentOffset < endOffset) {
+                            ch = data.charAt(currentOffset);
+                        } else {
+                            ch = -1;
+                        }
+
+                        name = data.substring(nameOffset, currentOffset).intern();
+                        prefix = emptyString;
+
+                        // The name is a QName => a SchemeName
+                        if (ch == ':') {
+                            if (++currentOffset == endOffset) {
+                                return false;
+                            }
+
+                            ch = data.charAt(currentOffset);
+                            prefix = name;
+                            nameOffset = currentOffset;
+                            currentOffset = scanNCName(data, endOffset,
+                                    currentOffset);
+
+                            if (currentOffset == nameOffset) {
+                                return false;
+                            }
+
+                            if (currentOffset < endOffset) {
+                                ch = data.charAt(currentOffset);
+                            } else {
+                                ch = -1;
+                            }
+
+                            isQName = true;
+                            name = data.substring(nameOffset, currentOffset).intern();
+                        }
+
+                        // REVISIT:
+                        if (currentOffset != endOffset) {
+                            addToken(tokens, Tokens.XPTRTOKEN_SCHEMENAME);
+                            tokens.addToken(prefix);
+                            tokens.addToken(name);
+                            isQName = false;
+                        } else if (currentOffset == endOffset) {
+                            // NCName => Shorthand
+                            addToken(tokens, Tokens.XPTRTOKEN_SHORTHAND);
+                            tokens.addToken(name);
+                            isQName = false;
+                        }
+
+                        // reset open/close paren for the next pointer part
+                        closeParen = 0;
+
+                        break;
+
+                    } else if (openParen > 0 && closeParen == 0 && name != null) {
+                        // Scanning SchemeData
+                        dataOffset = currentOffset;
+                        currentOffset = scanData(data, schemeDataBuff,
+                                endOffset, currentOffset);
+
+                        if (currentOffset == dataOffset)
+                            throw new InvalidXPointerException("InvalidSchemeDataInXPointer", data);
+
+                        if (currentOffset < endOffset) {
+                            ch = data.charAt(currentOffset);
+                        } else {
+                            ch = -1;
+                        }
+
+                        schemeData = schemeDataBuff.toString().intern();
+                        addToken(tokens, Tokens.XPTRTOKEN_SCHEMEDATA);
+                        tokens.addToken(schemeData);
+
+                        // reset open/close paren for the next pointer part
+                        openParen = 0;
+                        schemeDataBuff.delete(0, schemeDataBuff.length());
+
+                    } else {
+                        // ex. schemeName()
+                        // Should we throw an exception with a more suitable message instead??
+                        return false;
+                    }
+                }
+            } // end while
+            return true;
+        }
+
+        /** 
+         * Scans a NCName.  
+         * From Namespaces in XML 
+         * [5] NCName ::= (Letter | '_') (NCNameChar)*
+         * [6] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender
+         * 
+         * @param data A String containing the XPointer expression
+         * @param endOffset The int XPointer expression length  
+         * @param currentOffset An int representing the current position of the XPointer expression pointer
+         */
+        private static int scanNCName(String data, int endOffset, int currentOffset) {
+            int ch = data.charAt(currentOffset);
+            if (ch >= 0x80) {
+                if (!XMLChar.isNameStart(ch)) {
+                    return currentOffset;
+                }
+            } else {
+                byte chartype = fASCIICharMap[ch];
+                if (chartype != CHARTYPE_LETTER
+                        && chartype != CHARTYPE_UNDERSCORE) {
+                    return currentOffset;
+                }
+            }
+
+            //while (currentOffset++ < endOffset) {
+            while (++currentOffset < endOffset) {
+                ch = data.charAt(currentOffset);
+                if (ch >= 0x80) {
+                    if (!XMLChar.isName(ch)) {
+                        break;
+                    }
+                } else {
+                    byte chartype = fASCIICharMap[ch];
+                    if (chartype != CHARTYPE_LETTER
+                            && chartype != CHARTYPE_DIGIT
+                            && chartype != CHARTYPE_PERIOD
+                            && chartype != CHARTYPE_MINUS
+                            && chartype != CHARTYPE_UNDERSCORE) {
+                        break;
+                    }
+                }
+            }
+            return currentOffset;
+        }
+
+        /**
+         * Scans the SchemeData.
+         * [6]    SchemeData   ::=    EscapedData*  
+         * [7]    EscapedData  ::=    NormalChar | '^(' | '^)' | '^^' | '(' SchemeData ')'  
+         * [8]    NormalChar   ::=    UnicodeChar - [()^]  
+         * [9]    UnicodeChar  ::=    [#x0-#x10FFFF]
+         * 
+         */
+        private static int scanData(String data, StringBuffer schemeData,
+                int endOffset, int currentOffset) {
+            while (true) {
+
+                if (currentOffset == endOffset) {
+                    break;
+                }
+
+                int ch = data.charAt(currentOffset);
+                byte chartype = (ch >= 0x80) ? CHARTYPE_NONASCII
+                        : fASCIICharMap[ch];
+
+                if (chartype == CHARTYPE_OPEN_PAREN) {
+                    schemeData.append(ch);
+                    //schemeData.append(Tokens.XPTRTOKEN_OPEN_PAREN);
+                    currentOffset = scanData(data, schemeData, endOffset,
+                            ++currentOffset);
+                    if (currentOffset == endOffset) {
+                        return currentOffset;
+                    }
+
+                    ch = data.charAt(currentOffset);
+                    chartype = (ch >= 0x80) ? CHARTYPE_NONASCII
+                            : fASCIICharMap[ch];
+
+                    if (chartype != CHARTYPE_CLOSE_PAREN) {
+                        return endOffset;
+                    }
+                    schemeData.append((char) ch);
+                    ++currentOffset;//
+
+                } else if (chartype == CHARTYPE_CLOSE_PAREN) {
+                    return currentOffset;
+                    
+                } else  if (chartype == CHARTYPE_CARRET) {
+                    ch = data.charAt(++currentOffset);
+                    chartype = (ch >= 0x80) ? CHARTYPE_NONASCII
+                            : fASCIICharMap[ch];
+
+                    if (chartype != CHARTYPE_CARRET
+                            && chartype != CHARTYPE_OPEN_PAREN
+                            && chartype != CHARTYPE_CLOSE_PAREN) {
+                        break;
+                    }
+                    schemeData.append((char) ch);
+                    ++currentOffset;
+
+                } else {
+                    schemeData.append((char) ch);
+                    ++currentOffset;//
+                }
+            }
+
+            return currentOffset;
+        }
+
+        //
+        // Protected methods
+        //
+
+        /**
+         * This method adds the specified token to the token list. By
+         * default, this method allows all tokens. However, subclasses
+         * of the XPathExprScanner can override this method in order
+         * to disallow certain tokens from being used in the scanned
+         * XPath expression. This is a convenient way of allowing only
+         * a subset of XPath.
+         */
+        protected static void addToken(Tokens tokens, int token) {
+            if (token == Tokens.XPTRTOKEN_OPEN_PAREN
+                || token == Tokens.XPTRTOKEN_CLOSE_PAREN
+                || token == Tokens.XPTRTOKEN_SCHEMENAME
+                || token == Tokens.XPTRTOKEN_SCHEMEDATA
+                || token == Tokens.XPTRTOKEN_SHORTHAND) {
+            tokens.addToken(token);
+            return;
+            }
+            throw new IllegalArgumentException("InvalidXPointerToken");
+        }
+
+    } // class Scanner
+}

Added: webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XmlnsPointerPart.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XmlnsPointerPart.java?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XmlnsPointerPart.java (added)
+++ webservices/woden/trunk/java/woden-api/src/main/java/org/apache/woden/xpointer/XmlnsPointerPart.java Tue Sep  1 05:54:15 2009
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.woden.xpointer;
+
+import org.apache.woden.types.NCName;
+
+/**
+ * Represents a fragment identifier conforming to the XML Pointer Language Framework.
+ * 
+ * This class is based upon a class of the same name in the Apache Coccon.
+ *
+ * @author Dan Harvey (danharvey42@gmail.com)
+ */
+public class XmlnsPointerPart implements PointerPart {
+    private final NCName prefix;
+    private final String namespace;
+
+    public XmlnsPointerPart(NCName prefix, String namespace) {
+        if (prefix == null | namespace == null) {
+            throw new IllegalArgumentException();
+        }
+        this.prefix = prefix;
+        this.namespace = namespace;
+    }
+
+    public String toString() {
+        return "xmlns(" + prefix + "=" + namespace + ")";
+    }
+    
+    public void prefixNamespaces(XPointer xpointer) {
+        //This PointerPart does not have any namespaces.
+    }
+}

Added: webservices/woden/trunk/java/woden-api/src/main/resources/org/apache/woden/about-this-package
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-api/src/main/resources/org/apache/woden/about-this-package?rev=809835&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-api/src/main/resources/org/apache/woden/about-this-package (added)
+++ webservices/woden/trunk/java/woden-api/src/main/resources/org/apache/woden/about-this-package Tue Sep  1 05:54:15 2009
@@ -0,0 +1,5 @@
+Interfaces for the main functional components of the Woden API,
+such as factories, readers, writers, extension registry.
+Initially these may be WSDL 2.0 specific in places, but eventually
+this package should probably be WSDL-version independent - 
+i.e. the framework API that hides version specific interfaces.
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org


Mime
View raw message