Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DocumentImpl.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DocumentImpl.java (revision 453842) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DocumentImpl.java (working copy) @@ -28,6 +28,7 @@ import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; import org.w3c.dom.Comment; +import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; @@ -63,10 +64,12 @@ private String version; private String actualEncoding; private String encoding; + private String documentURI; private boolean standalone; private boolean strictErrorChecking; private SymbolTable symbols; private boolean readOnly; + private DOMConfiguration domConfig; public DocumentImpl() { @@ -481,6 +484,14 @@ checkLoaded(); return actualEncoding; } + + public String getInputEncoding(){ + return getActualEncoding(); + } + + public void setInputEncoding(String s){ + setActualEncoding(s); + } public void setActualEncoding(String actualEncoding) { checkReadOnly(); @@ -498,7 +509,14 @@ checkLoaded(); this.encoding = encoding; } + + public String getXmlEncoding(){ + return getEncoding(); + } + public void setXmlEncoding(String s){ + setEncoding(s); + } public String getVersion() { checkLoaded(); return version; @@ -509,7 +527,15 @@ checkLoaded(); this.version = version; } - + + public String getXmlVersion(){ + return getVersion(); + } + + public void setXmlVersion(String s){ + setVersion(s); + } + public boolean getStandalone() { checkLoaded(); return standalone; @@ -520,8 +546,18 @@ checkLoaded(); this.standalone = standalone; } + + - public boolean getStrictErrorChecking() { + public boolean getXmlStandalone() { + return getStandalone(); + } + + public void setXmlStandalone(boolean flag) throws DOMException { + setStandalone(flag); + } + + public boolean getStrictErrorChecking() { checkLoaded(); return strictErrorChecking; } @@ -531,4 +567,34 @@ checkLoaded(); this.strictErrorChecking = strictErrorChecking; } + + public String getDocumentURI() { + return documentURI; + } + + public void setDocumentURI(String documentURI) { + this.documentURI = documentURI; + } + + + + public Node renameNode(Node n, String namespaceURI, String qualifiedName) throws DOMException { + throw new DOMException(DOMException.NOT_SUPPORTED_ERR,"This operation is not supported"); + + } + + public DOMConfiguration getDomConfig() { + return domConfig; + } + + public void normalizeDocument() { + + + } + + public void setDomConfig(DOMConfiguration domConfig) { + this.domConfig = domConfig; + } + + } Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/TextImpl.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/TextImpl.java (revision 453842) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/TextImpl.java (working copy) @@ -81,5 +81,20 @@ throw EX_INDEX_SIZE; } } + + public String getWholeText() { + // TODO Auto-generated method stub + return null; + } + + public boolean isElementContentWhitespace() { + // TODO Auto-generated method stub + return false; + } + + public Text replaceWholeText(String s) throws DOMException { + // TODO Auto-generated method stub + return null; + } } Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DOMImplementationImpl.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DOMImplementationImpl.java (revision 453842) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DOMImplementationImpl.java (working copy) @@ -30,7 +30,12 @@ * @version CVS $Revision$, $Date$ */ public final class DOMImplementationImpl implements DOMImplementation { - private static final String[][] FEATURES = { + public Object getFeature(String s, String s1) { + // TODO Auto-generated method stub + return null; + } + + private static final String[][] FEATURES = { {"XML", "1.0"}, {"XML", "2.0"}, {"Traversal", "2.0"}, Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/NodeImpl.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/NodeImpl.java (revision 453842) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/NodeImpl.java (working copy) @@ -30,8 +30,11 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.w3c.dom.UserDataHandler; +import org.w3c.dom.events.Event; import java.util.HashMap; +import java.util.Hashtable; /** * NodeImpl implements the foundation of the Xindice compressed DOM. @@ -295,6 +298,11 @@ : null; } + + public boolean dispatchEvent(Event event) { + return false; + } + /** * Inserts the node newChild before the existing child node * refChild. If refChild is null, @@ -920,4 +928,240 @@ public String toString() { return TextWriter.toString(this); } + + public short compareDocumentPosition(Node node) throws DOMException { + if(this == node) + return 0; + else if(node instanceof NodeImpl){ + + return (short) Math.signum(this.key.hashCode() - ((NodeImpl) node).key.hashCode()); + }else + return (short) Math.signum(this.hashCode() - node.hashCode()); + + } + + + public Object getFeature(String s, String s1) { + return null; + } + + public String getTextContent() throws DOMException { + return getNodeValue(); + } + + + public Object setUserData(String s, Object obj, UserDataHandler userdatahandler) { + if(obj == null){ + if(userData != null){ + Hashtable hTable = (Hashtable) userData.get(this); + return hTable.get(s); + } + return null; + }else{ + + Hashtable t; + if(userData == null){ + userData = new HashMap(); + t = new Hashtable(); + userData.put(this, t); + }else { + t = (Hashtable) userData.get(this); + if(t== null){ + t = new Hashtable(); + userData.put(this, t); + } + } + + return t.put(s, new UserDataObject(obj,userdatahandler)); + + } + } + + public String getBaseURI() { + return null; + } + + public boolean isEqualNode(Node arg) { + if (arg == this) { + return true; + } + if (arg.getNodeType() != getNodeType()) { + return false; + } + // in theory nodeName can't be null but better be careful + // who knows what other implementations may be doing?... + if (getNodeName() == null) { + if (arg.getNodeName() != null) { + return false; + } + } + else if (!getNodeName().equals(arg.getNodeName())) { + return false; + } + + if (getLocalName() == null) { + if (arg.getLocalName() != null) { + return false; + } + } + else if (!getLocalName().equals(arg.getLocalName())) { + return false; + } + + if (getNamespaceURI() == null) { + if (arg.getNamespaceURI() != null) { + return false; + } + } + else if (!getNamespaceURI().equals(arg.getNamespaceURI())) { + return false; + } + + if (getPrefix() == null) { + if (arg.getPrefix() != null) { + return false; + } + } + else if (!getPrefix().equals(arg.getPrefix())) { + return false; + } + + if (getNodeValue() == null) { + if (arg.getNodeValue() != null) { + return false; + } + } + else if (!getNodeValue().equals(arg.getNodeValue())) { + return false; + } + + + return true; + } + + public void setTextContent(String textContent) + throws DOMException { + setNodeValue(textContent); + } + + public String lookupPrefix(String namespaceURI){ + + // REVISIT: When Namespaces 1.1 comes out this may not be true + // Prefix can't be bound to null namespace + if (namespaceURI == null) { + return null; + } + + short type = this.getNodeType(); + + switch (type) { + case Node.ELEMENT_NODE: { + this.getNamespaceURI(); // to flip out children + return lookupNamespacePrefix(namespaceURI); + } + case Node.DOCUMENT_NODE:{ + return((NodeImpl)((Document)this).getDocumentElement()).lookupPrefix(namespaceURI); + } + + case Node.ENTITY_NODE : + case Node.NOTATION_NODE: + case Node.DOCUMENT_FRAGMENT_NODE: + case Node.DOCUMENT_TYPE_NODE: + // type is unknown + return null; + case Node.ATTRIBUTE_NODE:{ + if (getOwnerDocument()!= null && getOwnerDocument().getNodeType() == Node.ELEMENT_NODE) { + return getOwnerDocument().lookupPrefix(namespaceURI); + + } + return null; + } + default:{ + NodeImpl ancestor = (NodeImpl)getParentNode(); + if (ancestor != null) { + return ancestor.lookupPrefix(namespaceURI); + } + return null; + } + + } + } + + public boolean isDefaultNamespace(String namespaceURI){ + // REVISIT: remove casts when DOM L3 becomes REC. + short type = this.getNodeType(); + switch (type) { + case Node.ELEMENT_NODE: { + String namespace = this.getNamespaceURI(); + String prefix = this.getPrefix(); + + // REVISIT: is it possible that prefix is empty string? + if (prefix == null || prefix.length() == 0) { + if (namespaceURI == null) { + return (namespace == namespaceURI); + } + return namespaceURI.equals(namespace); + } + if (this.hasAttributes()) { + ElementImpl elem = (ElementImpl)this; + NodeImpl attr = (NodeImpl)elem.getAttributeNodeNS("http://www.w3.org/2000/xmlns/", "xmlns"); + if (attr != null) { + String value = attr.getNodeValue(); + if (namespaceURI == null) { + return (namespace == value); + } + return namespaceURI.equals(value); + } + } + + NodeImpl ancestor = (NodeImpl)getParentNode(); + if (ancestor != null) { + return ancestor.isDefaultNamespace(namespaceURI); + } + return false; + } + case Node.DOCUMENT_NODE:{ + return((NodeImpl)((Document)this).getDocumentElement()).isDefaultNamespace(namespaceURI); + } + + case Node.ENTITY_NODE : + case Node.NOTATION_NODE: + case Node.DOCUMENT_FRAGMENT_NODE: + case Node.DOCUMENT_TYPE_NODE: + // type is unknown + return false; + case Node.ATTRIBUTE_NODE:{ + if (getOwnerDocument()!=null && getOwnerDocument().getNodeType() == Node.ELEMENT_NODE) { + return getOwnerDocument().isDefaultNamespace(namespaceURI); + + } + return false; + } + default:{ + NodeImpl ancestor = (NodeImpl)getParentNode(); + if (ancestor != null) { + return ancestor.isDefaultNamespace(namespaceURI); + } + return false; + } + + } + + + } + + class UserDataObject{ + + UserDataHandler handler; + Object node; + + UserDataObject(Object node, UserDataHandler handler){ + this.node = node; + this.handler = handler; + + } + + } + + } Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/ContainerNodeImpl.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/ContainerNodeImpl.java (revision 453842) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/ContainerNodeImpl.java (working copy) @@ -29,6 +29,7 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; +import org.w3c.dom.TypeInfo; import org.w3c.dom.traversal.DocumentTraversal; import org.w3c.dom.traversal.NodeFilter; import org.w3c.dom.traversal.NodeIterator; Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/ElementImpl.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/ElementImpl.java (revision 453842) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/ElementImpl.java (working copy) @@ -31,6 +31,7 @@ import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; +import org.w3c.dom.TypeInfo; import java.io.IOException; import java.util.HashSet; @@ -42,8 +43,28 @@ */ public final class ElementImpl extends ContainerNodeImpl implements Element { - private static final Log log = LogFactory.getLog(ElementImpl.class); + public TypeInfo getSchemaTypeInfo() { + // TODO Auto-generated method stub + return null; + } + public void setIdAttribute(String s, boolean flag) throws DOMException { + // TODO Auto-generated method stub + + } + + public void setIdAttributeNode(Attr attr, boolean flag) throws DOMException { + // TODO Auto-generated method stub + + } + + public void setIdAttributeNS(String s, String s1, boolean flag) throws DOMException { + // TODO Auto-generated method stub + + } + + private static final Log log = LogFactory.getLog(ElementImpl.class); + // private static final String SRC_NS = XMLNS_PREFIX + ":src"; // private static final String SRC_COL = "src:" + NodeSource.SOURCE_COL; // private static final String SRC_KEY = "src:" + NodeSource.SOURCE_KEY; Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DOMStringListImpl.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DOMStringListImpl.java (revision 0) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DOMStringListImpl.java (revision 0) @@ -0,0 +1,30 @@ +package org.apache.xindice.xml.dom; + +import java.util.Vector; + +import org.w3c.dom.DOMStringList; + +public class DOMStringListImpl implements DOMStringList { + + private Vector fList = new Vector(5,1); + + public boolean contains(String s) { + return fList.contains(s); + } + + public int getLength() { + return fList.size(); + } + + public String item(int i) { + try + { + return (String)fList.elementAt(i); + } + catch(ArrayIndexOutOfBoundsException arrayindexoutofboundsexception) + { + return null; + } + } + +} Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DOMConfigurationImpl.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DOMConfigurationImpl.java (revision 0) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/DOMConfigurationImpl.java (revision 0) @@ -0,0 +1,29 @@ +package org.apache.xindice.xml.dom; + +import org.w3c.dom.DOMConfiguration; +import org.w3c.dom.DOMException; +import org.w3c.dom.DOMStringList; + +public class DOMConfigurationImpl implements DOMConfiguration { + + + public boolean canSetParameter(String s, Object obj) { + return false; + } + + public Object getParameter(String s) throws DOMException { + // TODO Auto-generated method stub + return null; + } + + public DOMStringList getParameterNames() { + // TODO Auto-generated method stub + return null; + } + + public void setParameter(String s, Object obj) throws DOMException { + // TODO Auto-generated method stub + + } + +} Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/AttrImpl.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/AttrImpl.java (revision 453842) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/AttrImpl.java (working copy) @@ -22,17 +22,41 @@ import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.Node; +import org.w3c.dom.TypeInfo; +import org.w3c.dom.UserDataHandler; /** * AttrImpl * * @version CVS $Revision$, $Date$ */ -public final class AttrImpl extends ContainerNodeImpl implements Attr { +public final class AttrImpl extends ContainerNodeImpl implements Attr, TypeInfo { - private boolean specified = true; + private boolean specified = true; private short symbolID = -1; + + protected String typeName; + + protected Object type; + + /** DTD namespace. **/ + static final String DTD_URI = "http://www.w3.org/TR/REC-xml"; + + public String getTypeName() { + return (String) typeName; + } + + public String getTypeNamespace() { + return DTD_URI; + } + + public boolean isDerivedFrom(String s, String s1, int i) { + return false; + } + + + public AttrImpl() { } @@ -164,4 +188,26 @@ return null; } } + + public TypeInfo getSchemaTypeInfo() { + return this; + } + + public boolean isId() { + // TODO Auto-generated method stub + return false; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + public Object getType() { + return type; + } + + public void setType(Object type) { + this.type = type; + this.typeName = type.toString(); + } } Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/EntityImpl.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/EntityImpl.java (revision 453842) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/dom/EntityImpl.java (working copy) @@ -27,7 +27,22 @@ * @version CVS $Revision$, $Date$ */ public final class EntityImpl extends NodeImpl implements Entity { - private String encoding = null; + public String getInputEncoding() { + // TODO Auto-generated method stub + return null; + } + + public String getXmlEncoding() { + // TODO Auto-generated method stub + return null; + } + + public String getXmlVersion() { + // TODO Auto-generated method stub + return null; + } + + private String encoding = null; private String version = null; public EntityImpl() { Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/jaxp/DocumentBuilderFactoryImpl.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/jaxp/DocumentBuilderFactoryImpl.java (revision 453842) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/xml/jaxp/DocumentBuilderFactoryImpl.java (working copy) @@ -18,10 +18,14 @@ package org.apache.xindice.xml.jaxp; +import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; + + import java.util.HashMap; + import java.util.Map; /** @@ -30,8 +34,19 @@ * @version CVS $Revision$, $Date$ */ public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory { - private Map attrs = new HashMap(); + private Map attrs = new HashMap(); + @Override + public boolean getFeature(String s) throws ParserConfigurationException { + throw new ParserConfigurationException("SAXParser implementation static"); + } + @Override + public void setFeature(String s, boolean flag) throws ParserConfigurationException { + + } + + + public void setAttribute(String name, Object value) { attrs.put(name, value); } Index: I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/core/Collection.java =================================================================== --- I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/core/Collection.java (revision 453430) +++ I:/Workspaces/lib.plugins/org.apache.xindice/src/org/apache/xindice/core/Collection.java (working copy) @@ -565,9 +565,14 @@ } if (!(entry instanceof Document)) { - throw new DBException(FaultCodes.COL_INVALID_RESULT, - "Resource '" + key + "' in collection '" + - getCanonicalName() + "' is not a document"); + if (log.isErrorEnabled()) { + log.error("FaultCode: FaultCodes.COL_INVALID_RESULT - \tMessage: Resource '" + key + "' in collection '" + getCanonicalName() + "' is not a document"); + } + if(log.isDebugEnabled()){ + log.debug("Message", + new DBException(FaultCodes.COL_INVALID_RESULT,"Resource '" + key + "' in collection '" + getCanonicalName() + "' is not a document")); + } + return null; } return (Document) entry;