diff --git a/src/dom/AttrImpl.cpp b/src/dom/AttrImpl.cpp index c05a6ac2032975a8dcbdbadeba476f61ab4c2a2b..c1f1e335015d643d5c12d2a67bd046280aa59461 100644 --- a/src/dom/AttrImpl.cpp +++ b/src/dom/AttrImpl.cpp @@ -57,6 +57,9 @@ /** * $Log$ + * Revision 1.3 2000/01/22 01:38:29 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.2 1999/11/30 21:16:24 roddey * Changes to add the transcode() method to DOMString, which returns a transcoded * version (to local code page) of the DOM string contents. And I changed all of the @@ -87,8 +90,8 @@ AttrImpl::AttrImpl(DocumentImpl *ownerDoc, const DOMString &aName) //DOM Level 2 AttrImpl::AttrImpl(DocumentImpl *ownerDoc, //DOM Level 2 - const DOMString &namespaceURI, const DOMString &qualifiedName) -: NodeImpl (ownerDoc, namespaceURI, qualifiedName, DOM_Node::ATTRIBUTE_NODE, false, DOMString()) + const DOMString &fNamespaceURI, const DOMString &qualifiedName) +: NodeImpl (ownerDoc, fNamespaceURI, qualifiedName, DOM_Node::ATTRIBUTE_NODE, false, DOMString()) { specified = true; ownerElement = null; //DOM Level 2 diff --git a/src/dom/DOM_Document.hpp b/src/dom/DOM_Document.hpp index 3fdb6c14ba443399b8cb82d42db6269decf352b3..497584796e1af899b7db5120bbfa5c65bdda5a03 100644 --- a/src/dom/DOM_Document.hpp +++ b/src/dom/DOM_Document.hpp @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.4 2000/01/22 01:38:29 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.3 2000/01/05 01:16:07 andyh * DOM Level 2 core, namespace support added. * @@ -460,11 +463,15 @@ public: const DOMString &qualifiedName); /** - * Creates an attribute of the given qualified name and - * namespace URI. If the given <CODE>namespaceURI</CODE> is <CODE>null</CODE> - * or an empty string and the <CODE>qualifiedName</CODE> has a prefix that is - * "xml", the created attribute is bound to the predefined namespace - * "http://www.w3.org/XML/1998/namespace". + * Creates an attribute of the given qualified name and namespace + * URI. If the given <code>namespaceURI</code> is <code>null</code> or + * an empty string and the <code>qualifiedName</code> has a prefix that is + * "xml", the created attribute is bound to the predefined namespace + * "http://www.w3.org/XML/1998/namespace". If + * the given <code>namespaceURI</code> is <code>null</code> or an empty + * string and the <code>qualifiedName</code> has a prefix that is "xmlns", + * the created attribute is bound to the predefined namespace + * "http://www.w3.org/2000/xmlns/". * @param namespaceURI The <em>namespace URI</em> of * the attribute to create. * @param qualifiedName The <em>qualified name</em> @@ -474,13 +481,18 @@ public: * INVALID_CHARACTER_ERR: Raised if the specified qualified name contains * an illegal character. * <br> - * NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is - * malformed, if the <CODE>qualifiedName</CODE> has a prefix that is - * "xml" and the <CODE>namespaceURI</CODE> is neither <CODE>null</CODE> - * nor an empty string nor "http://www.w3.org/XML/1998/namespace", or - * if the <CODE>qualifiedName</CODE> has a prefix that is "xmlns" but - * the <CODE>namespaceURI</CODE> is neither <CODE>null</CODE> nor an - * empty string. + * NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is + * malformed, if the <code>qualifiedName</code> has a prefix that is + * "xml" and the <code>namespaceURI</code> is neither + * <code>null</code> nor an empty string nor + * "http://www.w3.org/XML/1998/namespace", or if the + * <code>qualifiedName</code> has a prefix that is + * "xmlns" and the <code>namespaceURI</code> is neither + * <code>null</code> nor an empty string nor + * "http://www.w3.org/2000/xmlns/", or if the + * <code>qualifiedName</code> is "xmlns" but the + * <code>namespaceURI</code> is neither <code>null</code> nor an + * empty string. */ DOM_Attr createAttributeNS(const DOMString &namespaceURI, const DOMString &qualifiedName); diff --git a/src/dom/DOM_NamedNodeMap.cpp b/src/dom/DOM_NamedNodeMap.cpp index 4d8e09571cd0d2048227f836a2ea66ec3cf1e2f4..2b1b6e5d569a369891bb9497b79ef402bbde7885 100644 --- a/src/dom/DOM_NamedNodeMap.cpp +++ b/src/dom/DOM_NamedNodeMap.cpp @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.3 2000/01/22 01:38:29 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.2 2000/01/05 01:16:07 andyh * DOM Level 2 core, namespace support added. * @@ -160,7 +163,7 @@ DOM_Node DOM_NamedNodeMap::removeNamedItem(const DOMString &name) }; -DOM_Node DOM_NamedNodeMap::item(int index) +DOM_Node DOM_NamedNodeMap::item(unsigned long index) { return DOM_Node(fImpl->item(index)); }; diff --git a/src/dom/DOM_NamedNodeMap.hpp b/src/dom/DOM_NamedNodeMap.hpp index 8a3869b427920ee1aeddf67ad90b196897a6b3e2..f9a0c6500f270bd448e5d9e1848bfee314fd123f 100644 --- a/src/dom/DOM_NamedNodeMap.hpp +++ b/src/dom/DOM_NamedNodeMap.hpp @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.3 2000/01/22 01:38:29 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.2 2000/01/05 01:16:07 andyh * DOM Level 2 core, namespace support added. * @@ -200,7 +203,7 @@ public: * <code>NamedNodeMap</code>, or <code>null</code> if that is not a valid * index. */ - DOM_Node item(int index); + DOM_Node item(unsigned long index); //@} /** @name Get functions. */ diff --git a/src/dom/DOM_NodeList.cpp b/src/dom/DOM_NodeList.cpp index be14423a35f288a098b365861316b84f5619a9c7..2d3f7f9cd0b82c1442d62146056d93a127e72bb6 100644 --- a/src/dom/DOM_NodeList.cpp +++ b/src/dom/DOM_NodeList.cpp @@ -56,8 +56,11 @@ /** * $Log$ - * Revision 1.1 1999/11/09 01:09:01 twl - * Initial revision + * Revision 1.2 2000/01/22 01:38:29 andyh + * Remove compiler warnings in DOM impl classes + * + * Revision 1.1.1.1 1999/11/09 01:09:01 twl + * Initial checkin * * Revision 1.2 1999/11/08 20:44:20 rahul * Swat for adding in Product name and CVS comment log variable. @@ -142,7 +145,7 @@ bool DOM_NodeList::operator != (const DOM_NullPtr *nullPtr) const -DOM_Node DOM_NodeList::item(int index) const +DOM_Node DOM_NodeList::item(unsigned long index) const { return DOM_Node(fImpl->item(index)); }; diff --git a/src/dom/DOM_NodeList.hpp b/src/dom/DOM_NodeList.hpp index ddc85c8afe7d9e4c236c01001d278361b758e35c..3d41bf1c1e57685d03a71083fab5928269543d6d 100644 --- a/src/dom/DOM_NodeList.hpp +++ b/src/dom/DOM_NodeList.hpp @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.3 2000/01/22 01:38:29 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.2 2000/01/05 01:16:08 andyh * DOM Level 2 core, namespace support added. * @@ -183,7 +186,7 @@ public: * <code>NodeList</code>, or <code>null</code> if that is not a valid * index. */ - DOM_Node item(int index) const; + DOM_Node item(unsigned long index) const; /** * Returns the number of nodes in the list. diff --git a/src/dom/DeepNodeListImpl.cpp b/src/dom/DeepNodeListImpl.cpp index 8a9712bd8b1b992ea82843eb8a28266f25342f6f..b4bf9caede24dcbd2359e054dff8812b81869e2e 100644 --- a/src/dom/DeepNodeListImpl.cpp +++ b/src/dom/DeepNodeListImpl.cpp @@ -56,8 +56,11 @@ /** * $Log$ - * Revision 1.1 1999/11/09 01:08:42 twl - * Initial revision + * Revision 1.2 2000/01/22 01:38:29 andyh + * Remove compiler warnings in DOM impl classes + * + * Revision 1.1.1.1 1999/11/09 01:08:42 twl + * Initial checkin * * Revision 1.3 1999/11/08 20:44:23 rahul * Swat for adding in Product name and CVS comment log variable. @@ -82,20 +85,22 @@ DeepNodeListImpl::DeepNodeListImpl(NodeImpl *rootNod, const DOMString &tagNam) matchAll = tagName.equals(DStringPool::getStaticString("*", &kAstr)); this->namespaceURI = null; //DOM Level 2 this->matchAllURI = false; //DOM Level 2 + this->matchURIandTagname = false; //DOM Level 2 }; //DOM Level 2 DeepNodeListImpl::DeepNodeListImpl(NodeImpl *rootNod, - const DOMString &namespaceURI, const DOMString &localName) + const DOMString &fNamespaceURI, const DOMString &localName) { changes = 0; this->rootNode = rootNod; this->tagName = localName; nodes=new NodeVector(); matchAll = tagName.equals(DStringPool::getStaticString("*", &kAstr)); - this->namespaceURI = namespaceURI; - this->matchAllURI = namespaceURI.equals(DStringPool::getStaticString("*", &kAstr)); + this->namespaceURI = fNamespaceURI; + this->matchAllURI = fNamespaceURI.equals(DStringPool::getStaticString("*", &kAstr)); + this->matchURIandTagname = true; }; @@ -124,7 +129,7 @@ int DeepNodeListImpl::getLength() // irrelevant ones. Doing so in a really useful manner would seem // to involve a tree-walk in its own right, or maintaining our data // in a parallel tree. -NodeImpl *DeepNodeListImpl::item(int index) +NodeImpl *DeepNodeListImpl::item(unsigned long index) { NodeImpl *thisNode; @@ -134,8 +139,8 @@ NodeImpl *DeepNodeListImpl::item(int index) changes=rootNode->changes; } - if(index<nodes->size()) // In the cache - return nodes->elementAt(index); + if(index< (unsigned long) nodes->size()) // In the cache + return nodes->elementAt((int) index); else // Not yet seen { if(nodes->size()==0) // Pick up where we left off @@ -143,7 +148,7 @@ NodeImpl *DeepNodeListImpl::item(int index) else thisNode=nodes->lastElement(); - while(thisNode!=null && index>=nodes->size() && thisNode!=null) + while(thisNode!=null && index >= (unsigned long) nodes->size() && thisNode!=null) { thisNode=nextMatchingElementAfter(thisNode); if(thisNode!=null) @@ -195,7 +200,7 @@ NodeImpl *DeepNodeListImpl::nextMatchingElementAfter(NodeImpl *current) // Have we found an Element with the right tagName? // ("*" matches anything.) if (current != null && current != rootNode && current->isElementImpl()) { - if (namespaceURI == null) { //DOM Level 1 + if (!matchURIandTagname) { //DOM Level 1 if (matchAll || ((ElementImpl *)current)->getTagName().equals(tagName)) return current; } else { //DOM Level 2 diff --git a/src/dom/DeepNodeListImpl.hpp b/src/dom/DeepNodeListImpl.hpp index 728934e6ee91ffb471f0ac173852cf1a3268bbba..1b94eb72709c54612509b8e17d349491315c2f1b 100644 --- a/src/dom/DeepNodeListImpl.hpp +++ b/src/dom/DeepNodeListImpl.hpp @@ -59,6 +59,9 @@ /** * $Log$ + * Revision 1.3 2000/01/22 01:38:29 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.2 1999/12/21 07:47:06 robweir * Patches to support Xalan, where we need to create a * "special" DOM with subclassed Nodes. @@ -103,6 +106,7 @@ private: //DOM Level 2 DOMString namespaceURI; bool matchAllURI; + bool matchURIandTagname; //match both namespaceURI and tagName public: DeepNodeListImpl(NodeImpl *rootNode, const DOMString &tagName); @@ -110,7 +114,7 @@ public: const DOMString &namespaceURI, const DOMString &localName); virtual ~DeepNodeListImpl(); virtual int getLength(); - virtual NodeImpl *item(int index); + virtual NodeImpl *item(unsigned long index); private: virtual NodeImpl *nextMatchingElementAfter(NodeImpl *current); virtual void unreferenced(); diff --git a/src/dom/DocumentImpl.cpp b/src/dom/DocumentImpl.cpp index a35638e34e377625954e08d73b33d677de2bc771..640aaad66dbd7bf8308481ea4629af4304d80d1d 100644 --- a/src/dom/DocumentImpl.cpp +++ b/src/dom/DocumentImpl.cpp @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.6 2000/01/22 01:38:30 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.5 2000/01/19 21:39:19 andyh * DOM L2, fix problems with new style createDocument. * @@ -128,7 +131,7 @@ DocumentImpl::DocumentImpl(): NodeImpl(null, //DOM Level 2 -DocumentImpl::DocumentImpl(const DOMString &namespaceURI, +DocumentImpl::DocumentImpl(const DOMString &fNamespaceURI, const DOMString &qualifiedName, DocumentTypeImpl *doctype) : NodeImpl(null, null, DStringPool::getStaticString("#document", &nam), DOM_Node::DOCUMENT_NODE, false, null) { @@ -141,7 +144,7 @@ DocumentImpl::DocumentImpl(const DOMString &namespaceURI, appendChild(doctype); } docElement=null; - appendChild(createElementNS(namespaceURI, qualifiedName)); //root element + appendChild(createElementNS(fNamespaceURI, qualifiedName)); //root element namePool = new DStringPool(257); iterators = 0L; treeWalkers = 0L; @@ -173,7 +176,7 @@ NodeImpl *DocumentImpl::cloneNode(bool deep) { if (deep) for (NodeImpl *n=getFirstChild(); n!=null; n=n->getNextSibling()) { if (n -> isDocumentTypeImpl()) { - DocumentTypeImpl *doctype = ((DocumentTypeImpl *)n) -> export(newdoc, true); + DocumentTypeImpl *doctype = ((DocumentTypeImpl *)n) -> exportNode(newdoc, true); newdoc -> appendChild(doctype); newdoc -> docType = doctype; } else if (n -> isElementImpl()) { @@ -568,29 +571,29 @@ NodeImpl *DocumentImpl::importNode(NodeImpl *source, bool deep) }; -ElementImpl *DocumentImpl::createElementNS(const DOMString &namespaceURI, +ElementImpl *DocumentImpl::createElementNS(const DOMString &fNamespaceURI, const DOMString &qualifiedName) { if(!isXMLName(qualifiedName)) throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null); //DOMString pooledTagName = this->namePool->getPooledString(qualifiedName); - return new ElementImpl(this, namespaceURI, qualifiedName); + return new ElementImpl(this, fNamespaceURI, qualifiedName); } -AttrImpl *DocumentImpl::createAttributeNS(const DOMString &namespaceURI, +AttrImpl *DocumentImpl::createAttributeNS(const DOMString &fNamespaceURI, const DOMString &qualifiedName) { if(!isXMLName(qualifiedName)) throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null); - return new AttrImpl(this, namespaceURI, qualifiedName); + return new AttrImpl(this, fNamespaceURI, qualifiedName); } -DeepNodeListImpl *DocumentImpl::getElementsByTagNameNS(const DOMString &namespaceURI, - const DOMString &localName) +DeepNodeListImpl *DocumentImpl::getElementsByTagNameNS(const DOMString &fNamespaceURI, + const DOMString &fLocalName) { - return new DeepNodeListImpl(this, namespaceURI, localName); + return new DeepNodeListImpl(this, fNamespaceURI, fLocalName); } diff --git a/src/dom/DocumentTypeImpl.cpp b/src/dom/DocumentTypeImpl.cpp index d804ce7ce642a3f16cd1539b072c57c1b963b89c..c1b477297677064d2201575d88fa965864ca4526 100644 --- a/src/dom/DocumentTypeImpl.cpp +++ b/src/dom/DocumentTypeImpl.cpp @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.4 2000/01/22 01:38:30 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.3 2000/01/08 00:09:28 andyh * Correcf failures in DOMTest with entity references and read-only nodes. * Correct reference counting problem NamedNodeMap. @@ -98,10 +101,10 @@ DocumentTypeImpl::DocumentTypeImpl(DocumentImpl *ownerDoc, const DOMString &dtNa //Introduced in DOM Level 2 DocumentTypeImpl::DocumentTypeImpl(const DOMString &qualifiedName, - const DOMString &publicID, const DOMString &systemID, - const DOMString &internalSubset) + const DOMString &fPublicID, const DOMString &fSystemID, + const DOMString &fInternalSubset) : NodeImpl(null, qualifiedName, DOM_Node::DOCUMENT_TYPE_NODE, false, null), - publicID(publicID), systemID(systemID), internalSubset(internalSubset) + publicID(fPublicID), systemID(fSystemID), internalSubset(fInternalSubset) { entities = new NamedNodeMapImpl(null,null); notations= new NamedNodeMapImpl(null,null); @@ -231,7 +234,7 @@ void DocumentTypeImpl::setOwnerDocument(DocumentImpl *docImpl) /** Export this node to a different document docImpl. */ -DocumentTypeImpl *DocumentTypeImpl::export(DocumentImpl *docImpl, bool deep) +DocumentTypeImpl *DocumentTypeImpl::exportNode(DocumentImpl *docImpl, bool deep) { DocumentTypeImpl *doctype; if (localName != null) { //true if namespace involved, i.e. DOM Level 2 and after @@ -243,9 +246,9 @@ DocumentTypeImpl *DocumentTypeImpl::export(DocumentImpl *docImpl, bool deep) delete doctype -> entities; delete doctype -> notations; delete doctype -> elements; - doctype -> entities = entities -> export(docImpl); - doctype -> notations = notations -> export(docImpl); - doctype -> elements = elements -> export(docImpl); + doctype -> entities = entities -> exportNode(docImpl); + doctype -> notations = notations -> exportNode(docImpl); + doctype -> elements = elements -> exportNode(docImpl); } return doctype; } diff --git a/src/dom/DocumentTypeImpl.hpp b/src/dom/DocumentTypeImpl.hpp index fcacba4b71aefafd775c4d7ee7d8591a3ab3657d..55c427a557d2aecff487792a10b67324fcabd83a 100644 --- a/src/dom/DocumentTypeImpl.hpp +++ b/src/dom/DocumentTypeImpl.hpp @@ -59,6 +59,9 @@ /** * $Log$ + * Revision 1.4 2000/01/22 01:38:30 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.3 2000/01/08 00:09:28 andyh * Correcf failures in DOMTest with entity references and read-only nodes. * Correct reference counting problem NamedNodeMap. @@ -130,7 +133,7 @@ public: virtual DOMString getInternalSubset(); //internal use only virtual void setOwnerDocument(DocumentImpl *docImpl); - virtual DocumentTypeImpl *export(DocumentImpl *docImpl, bool deep); + virtual DocumentTypeImpl *exportNode(DocumentImpl *docImpl, bool deep); }; #endif diff --git a/src/dom/ElementImpl.cpp b/src/dom/ElementImpl.cpp index 5ef6175f101ea1746885f994034e08f726a52f8b..31f4ce52c8ff7d183ab6202504c9244d5cd40679 100644 --- a/src/dom/ElementImpl.cpp +++ b/src/dom/ElementImpl.cpp @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.4 2000/01/22 01:38:30 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.3 2000/01/05 01:16:08 andyh * DOM Level 2 core, namespace support added. * @@ -103,8 +106,8 @@ NodeImpl(ownerDoc, nam, DOM_Node::ELEMENT_NODE, false, null) //DOM Level 2 ElementImpl::ElementImpl(DocumentImpl *ownerDoc, - const DOMString &namespaceURI, const DOMString &qualifiedName) : -NodeImpl(ownerDoc, namespaceURI, qualifiedName, DOM_Node::ELEMENT_NODE, false, null) + const DOMString &fNamespaceURI, const DOMString &qualifiedName) : +NodeImpl(ownerDoc, fNamespaceURI, qualifiedName, DOM_Node::ELEMENT_NODE, false, null) { // If there is an ElementDefintion, set its Attributes up as @@ -291,24 +294,24 @@ void ElementImpl::setReadOnly(bool readOnl, bool deep) //Introduced in DOM Level 2 -DOMString ElementImpl::getAttributeNS(const DOMString &namespaceURI, - const DOMString &localName) +DOMString ElementImpl::getAttributeNS(const DOMString &fNamespaceURI, + const DOMString &fLocalName) { static DOMString *emptyString = 0; - AttrImpl * attr=(AttrImpl *)(attributes->getNamedItemNS(namespaceURI, localName)); + AttrImpl * attr=(AttrImpl *)(attributes->getNamedItemNS(fNamespaceURI, fLocalName)); return (attr==null) ? DStringPool::getStaticString("", &emptyString) : attr->getValue(); } -void ElementImpl::setAttributeNS(const DOMString &namespaceURI, - const DOMString &qualifiedName, const DOMString &value) +void ElementImpl::setAttributeNS(const DOMString &fNamespaceURI, + const DOMString &qualifiedName, const DOMString &fValue) { if (readOnly) throw DOM_DOMException( DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - AttrImpl *newAttr = (AttrImpl *) ownerDocument->createAttributeNS(namespaceURI, qualifiedName); - newAttr->setNodeValue(value); + AttrImpl *newAttr = (AttrImpl *) ownerDocument->createAttributeNS(fNamespaceURI, qualifiedName); + newAttr->setNodeValue(fValue); newAttr->setOwnerElement(this); AttrImpl *oldAttr = (AttrImpl *)attributes->setNamedItem(newAttr); @@ -320,14 +323,14 @@ void ElementImpl::setAttributeNS(const DOMString &namespaceURI, } -void ElementImpl::removeAttributeNS(const DOMString &namespaceURI, - const DOMString &localName) +void ElementImpl::removeAttributeNS(const DOMString &fNamespaceURI, + const DOMString &fLocalName) { if (readOnly) throw DOM_DOMException( DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - AttrImpl *att = (AttrImpl *) attributes->getNamedItemNS(namespaceURI, localName); + AttrImpl *att = (AttrImpl *) attributes->getNamedItemNS(fNamespaceURI, fLocalName); // Remove it (and let the NamedNodeMap recreate the default, if any) if (att != null) { attributes->removeNamedItemNS(namespaceURI, localName); @@ -338,10 +341,10 @@ void ElementImpl::removeAttributeNS(const DOMString &namespaceURI, } -AttrImpl *ElementImpl::getAttributeNodeNS(const DOMString &namespaceURI, - const DOMString &localName) +AttrImpl *ElementImpl::getAttributeNodeNS(const DOMString &fNamespaceURI, + const DOMString &fLocalName) { - return (AttrImpl *)(attributes->getNamedItemNS(namespaceURI, localName)); + return (AttrImpl *)(attributes->getNamedItemNS(fNamespaceURI, fLocalName)); } @@ -374,9 +377,9 @@ AttrImpl *ElementImpl::setAttributeNodeNS(AttrImpl *newAttr) } -DeepNodeListImpl *ElementImpl::getElementsByTagNameNS(const DOMString &namespaceURI, - const DOMString &localName) +DeepNodeListImpl *ElementImpl::getElementsByTagNameNS(const DOMString &fNamespaceURI, + const DOMString &fLocalName) { - return new DeepNodeListImpl(this,namespaceURI, localName); + return new DeepNodeListImpl(this,fNamespaceURI, fLocalName); } diff --git a/src/dom/NamedNodeMapImpl.cpp b/src/dom/NamedNodeMapImpl.cpp index 4b0cea369b49e059c636dc556f568626de8ccb21..9d5bd095500e67f0d684cf0b5bd6783803b5612c 100644 --- a/src/dom/NamedNodeMapImpl.cpp +++ b/src/dom/NamedNodeMapImpl.cpp @@ -56,6 +56,9 @@ /** * $Log$ + * Revision 1.6 2000/01/22 01:38:30 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.5 2000/01/08 00:09:28 andyh * Correcf failures in DOMTest with entity references and read-only nodes. * Correct reference counting problem NamedNodeMap. @@ -260,11 +263,11 @@ NodeImpl * NamedNodeMapImpl::getNamedItem(const DOMString &name) -NodeImpl * NamedNodeMapImpl::item(int index) +NodeImpl * NamedNodeMapImpl::item(unsigned long index) { reconcileDefaults(); - return (nodes != null && index < nodes->size()) ? - (NodeImpl *) (nodes->elementAt(index)) : null; + return (nodes != null && index < (unsigned long) nodes->size()) ? + (NodeImpl *) (nodes->elementAt((int) index)) : null; }; @@ -485,10 +488,10 @@ void NamedNodeMapImpl::setReadOnly(bool readOnl, bool deep) /** Export this object to a different document docImpl. */ -NamedNodeMapImpl *NamedNodeMapImpl::export(DocumentImpl *docImpl) +NamedNodeMapImpl *NamedNodeMapImpl::exportNode(DocumentImpl *docImpl) { bool deep = true; - NamedNodeMapImpl *newdefs = defaults == null ? null : defaults->export(docImpl); + NamedNodeMapImpl *newdefs = defaults == null ? null : defaults->exportNode(docImpl); NamedNodeMapImpl *newmap = new NamedNodeMapImpl(docImpl, newdefs); if (nodes != null) { diff --git a/src/dom/NamedNodeMapImpl.hpp b/src/dom/NamedNodeMapImpl.hpp index ea786620052225f70051061f608203dd84650acc..fffaba457260b8d9f40c573158dd8a674aea43e6 100644 --- a/src/dom/NamedNodeMapImpl.hpp +++ b/src/dom/NamedNodeMapImpl.hpp @@ -59,6 +59,9 @@ /** * $Log$ + * Revision 1.4 2000/01/22 01:38:30 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.3 2000/01/08 00:09:28 andyh * Correcf failures in DOMTest with entity references and read-only nodes. * Correct reference counting problem NamedNodeMap. @@ -122,7 +125,7 @@ public: virtual int findNamePoint(const DOMString &name); virtual int getLength(); virtual NodeImpl *getNamedItem(const DOMString &name); - virtual NodeImpl *item(int index); + virtual NodeImpl *item(unsigned long index); virtual void removeAll(); virtual NodeImpl *removeNamedItem(const DOMString &name); static void removeRef(NamedNodeMapImpl *); @@ -130,7 +133,7 @@ public: virtual void setReadOnly(bool readOnly, bool deep); //Introduced in DOM Level 2 - virtual NamedNodeMapImpl *export(DocumentImpl *docImpl); + virtual NamedNodeMapImpl *exportNode(DocumentImpl *docImpl); virtual int findNamePoint(const DOMString &namespaceURI, const DOMString &localName); virtual NodeImpl *getNamedItemNS(const DOMString &namespaceURI, diff --git a/src/dom/NodeImpl.cpp b/src/dom/NodeImpl.cpp index cb4b5306824d4d2d29a8213e3313d5b0ccb8948b..5d7f3c722d956bfff79de0f038f6a2538886ecd2 100644 --- a/src/dom/NodeImpl.cpp +++ b/src/dom/NodeImpl.cpp @@ -56,6 +56,9 @@ /** * $Log$ +* Revision 1.8 2000/01/22 01:38:30 andyh +* Remove compiler warnings in DOM impl classes +* * Revision 1.7 2000/01/19 21:39:19 andyh * DOM L2, fix problems with new style createDocument. * @@ -137,9 +140,10 @@ NodeImpl::NodeImpl(DocumentImpl *ownerDoc, //Introduced in DOM Level 2 NodeImpl::NodeImpl(DocumentImpl *ownerDoc, - const DOMString &namespaceURI, const DOMString &qualifiedName, short nTyp, + const DOMString &fNamespaceURI, const DOMString &qualifiedName, short nTyp, bool isLeafNod, const DOMString &initValue) { + static const DOMString xmlns("xmlns"); //need to revisit static initializer // Do we want to add isLeafNode to this? How about initial value? this->ownerDocument=ownerDoc; @@ -157,6 +161,9 @@ NodeImpl::NodeImpl(DocumentImpl *ownerDoc, throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); if (count == 0) { //count == 0 && index == -1 + if (nType == DOM_Node::ATTRIBUTE_NODE && this->name.equals(xmlns) && + fNamespaceURI != null && fNamespaceURI.length() != 0) + throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); this -> prefix = null; this -> localName = this -> name; } else { //count == 1 && 0 < index < qNameLen-1 @@ -164,7 +171,7 @@ NodeImpl::NodeImpl(DocumentImpl *ownerDoc, this -> localName = this->name.substringData(index+1, qNameLen-index-1); } - const DOMString& URI = mapPrefix(prefix, namespaceURI, nTyp); + const DOMString& URI = mapPrefix(prefix, fNamespaceURI, nTyp); this -> namespaceURI = URI == null ? DOMString(null) : URI.clone(); this->nType=nTyp; @@ -536,9 +543,9 @@ tree structure is legal. - NodeImpl *NodeImpl::item(int index) { + NodeImpl *NodeImpl::item(unsigned long index) { NodeImpl *node = firstChild; - for(int i=0; i<index && node!=null; ++i) + for(unsigned long i=0; i<index && node!=null; ++i) node = node->nextSibling; return node; }; @@ -716,7 +723,7 @@ DOMString NodeImpl::getLocalName() } -void NodeImpl::setPrefix(const DOMString &prefix) +void NodeImpl::setPrefix(const DOMString &fPrefix) { static const DOMString xml("xml"); static const DOMString xmlURI("http://www.w3.org/XML/1998/namespace"); @@ -724,26 +731,26 @@ void NodeImpl::setPrefix(const DOMString &prefix) if (readOnly) throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); - if(prefix != null && !DocumentImpl::isXMLName(prefix)) + if(fPrefix != null && !DocumentImpl::isXMLName(fPrefix)) throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null); if (localName == null) //if not Element or Attr node throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - if (prefix == null || prefix.length() == 0) { + if (fPrefix == null || fPrefix.length() == 0) { this -> prefix = null; name = localName; return; } - XMLCh *p = prefix.rawBuffer(); - for (int i = prefix.length(); --i >= 0;) + XMLCh *p = fPrefix.rawBuffer(); + for (int i = fPrefix.length(); --i >= 0;) if (*p++ == chColon) //prefix is malformed throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - if (prefix.equals(xml) && !namespaceURI.equals(xmlURI) || - prefix.equals(xmlns) && namespaceURI != null && namespaceURI.length() != 0) + if (fPrefix.equals(xml) && !namespaceURI.equals(xmlURI) || + fPrefix.equals(xmlns) && namespaceURI != null && namespaceURI.length() != 0) throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); - name = this -> prefix = prefix; + name = this -> prefix = fPrefix; name = name + chColon + localName; //nodeName is changed too } @@ -752,7 +759,7 @@ void NodeImpl::setPrefix(const DOMString &prefix) //--------------------------------------------------- // "xml" null, "" or xmlURI xmlURI // "xml" otherwise NAMESPACE_ERR -// "xmlns" null or "" namespaceURI (nType = ATTRIBUTE_NODE only) +// "xmlns" null or "" or xmlnsURI xmlnsURI (nType = ATTRIBUTE_NODE only) // "xmlns" otherwise NAMESPACE_ERR (nType = ATTRIBUTE_NODE only) // else any namesapceURI const DOMString& NodeImpl::mapPrefix(const DOMString &prefix, @@ -764,6 +771,7 @@ const DOMString& NodeImpl::mapPrefix(const DOMString &prefix, static const DOMString xml("xml"); static const DOMString xmlURI("http://www.w3.org/XML/1998/namespace"); static const DOMString xmlns("xmlns"); + static const DOMString xmlnsURI("http://www.w3.org/2000/xmlns/"); if (prefix == null) return namespaceURI; @@ -772,8 +780,8 @@ const DOMString& NodeImpl::mapPrefix(const DOMString &prefix, return xmlURI; throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); } else if (nType == DOM_Node::ATTRIBUTE_NODE && prefix.equals(xmlns)) { - if (namespaceURI == null || namespaceURI.length() == 0) - return namespaceURI; + if (namespaceURI == null || namespaceURI.length() == 0 || namespaceURI.equals(xmlnsURI)) + return xmlnsURI; throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); } else return namespaceURI; diff --git a/src/dom/NodeImpl.hpp b/src/dom/NodeImpl.hpp index 800bc30fcb87e295c590ec80967767182ee507a7..bd4191bfacfafe4224ef3e9a3b82d938679f4c92 100644 --- a/src/dom/NodeImpl.hpp +++ b/src/dom/NodeImpl.hpp @@ -59,6 +59,9 @@ /** * $Log$ + * Revision 1.4 2000/01/22 01:38:30 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.3 2000/01/05 01:16:08 andyh * DOM Level 2 core, namespace support added. * @@ -175,7 +178,7 @@ public: virtual bool hasChildNodes(); virtual NodeImpl *insertBefore(NodeImpl *newChild, NodeImpl *refChild); static bool isKidOK(NodeImpl *parent, NodeImpl *child); - virtual NodeImpl *item(int index); + virtual NodeImpl *item(unsigned long index); virtual void referenced(); virtual NodeImpl * removeChild(NodeImpl *oldChild); virtual NodeImpl *replaceChild(NodeImpl *newChild, NodeImpl *oldChild); diff --git a/src/dom/NodeListImpl.hpp b/src/dom/NodeListImpl.hpp index cd2edf1ca6f1d7c064bffa00d4035753748ef159..90f3afd67c0148dbc17ea1420e2ed43c50dcb4e6 100644 --- a/src/dom/NodeListImpl.hpp +++ b/src/dom/NodeListImpl.hpp @@ -58,6 +58,9 @@ /** * $Log$ + * Revision 1.3 2000/01/22 01:38:30 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.2 1999/12/21 07:47:07 robweir * Patches to support Xalan, where we need to create a * "special" DOM with subclassed Nodes. @@ -94,7 +97,7 @@ protected: NodeListImpl(); public: virtual ~NodeListImpl(); - virtual NodeImpl * item(int index) = 0; + virtual NodeImpl * item(unsigned long index) = 0; virtual int getLength() = 0; }; diff --git a/tests/DOM/DOMMemTest/DOMMemTest.cpp b/tests/DOM/DOMMemTest/DOMMemTest.cpp index 467ff4c74c119dcb2f9f33ccd9f62c4afe3c7032..55231d946884bd93b35d87a4a816dbd77e36947a 100644 --- a/tests/DOM/DOMMemTest/DOMMemTest.cpp +++ b/tests/DOM/DOMMemTest/DOMMemTest.cpp @@ -66,6 +66,9 @@ /** * $Log$ + * Revision 1.9 2000/01/22 01:38:32 andyh + * Remove compiler warnings in DOM impl classes + * * Revision 1.8 2000/01/20 20:37:25 andyh * Remove DEVENV_VCPP preprocessor variable everywhere. * It was obsolete, left over from an earlier configuration system. @@ -1212,18 +1215,30 @@ int main() // // Create a set of attributes and hang them on the root element. // - DOM_Element ela = doc.createAttrNS("http://nsa", "a:ela"); - rootEl.appendChild(ela); - DOM_Element elb = doc.createElementNS("http://nsb", "elb"); - rootEl.appendChild(elb); - DOM_Element elc = doc.createElementNS("", "elc"); - rootEl.appendChild(elc); - DOM_Element eld = doc.createElementNS("http://nsa", "d:ela"); - rootEl.appendChild(eld); - DOM_Element ele = doc.createElementNS("http://nse", "elb"); - rootEl.appendChild(ele); + DOM_Attr attra = doc.createAttributeNS("http://nsa", "a:attra"); + rootEl.setAttributeNodeNS(attra); + DOM_Attr attrb = doc.createAttributeNS("http://nsb", "attrb"); + rootEl.setAttributeNodeNS(attrb); + DOM_Attr attrc = doc.createAttributeNS("", "attrc"); + rootEl.setAttributeNodeNS(attrc); + DOM_Attr attrd = doc.createAttributeNS("http://nsa", "d:attra"); + rootEl.setAttributeNodeNS(attrd); + DOM_Attr attre = doc.createAttributeNS("http://nse", "attrb"); + rootEl.setAttributeNodeNS(attre); + // + // Check that the attribute nodes were created with the correct properties. + // + TASSERT(attra.getNodeName().equals("a.attra")); + TASSERT(attra.getNamespaceURI().equals("http://nsa")); + TASSERT(attra.getLocalName().equals("attra")); + TASSERT(attra.getName().equals("a.attra")); + TASSERT(attra.getNodeType() == DOM_Node::ATTRIBUTE_NODE); + TASSERT(attra.getNodeValue().equals("")); + TASSERT(attra.getPrefix().equals("a")); + TASSERT(attra.getSpecified() == true); + TASSERT(attra.getValue().equals("")); } TESTEPILOG;