tng 2002/12/20 14:10:58 Modified: c/src/xercesc/dom/deprecated AttrNSImpl.cpp DOM_DOMImplementation.cpp DocumentImpl.cpp DocumentImpl.hpp ElementNSImpl.cpp XMLDeclImpl.cpp c/src/xercesc/dom/impl DOMAttrNSImpl.cpp DOMDocumentImpl.cpp DOMDocumentImpl.hpp DOMDocumentTypeImpl.cpp DOMElementNSImpl.cpp DOMImplementationImpl.cpp Log: XML 1.1 Revision Changes Path 1.4 +2 -2 xml-xerces/c/src/xercesc/dom/deprecated/AttrNSImpl.cpp Index: AttrNSImpl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/AttrNSImpl.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- AttrNSImpl.cpp 4 Nov 2002 15:04:44 -0000 1.3 +++ AttrNSImpl.cpp 20 Dec 2002 22:10:57 -0000 1.4 @@ -155,7 +155,7 @@ if (namespaceURI == null || localName.equals(xmlns)) { throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null); } - if (prefix != null && !DocumentImpl::isXMLName(prefix)) { + if (prefix != null && !((DocumentImpl *)this->getOwnerDocument())->isXMLName(prefix)) { throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR, null); } 1.4 +4 -3 xml-xerces/c/src/xercesc/dom/deprecated/DOM_DOMImplementation.cpp Index: DOM_DOMImplementation.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DOM_DOMImplementation.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DOM_DOMImplementation.cpp 4 Nov 2002 15:04:44 -0000 1.3 +++ DOM_DOMImplementation.cpp 20 Dec 2002 22:10:57 -0000 1.4 @@ -65,6 +65,7 @@ #include "DocumentImpl.hpp" #include "DocumentTypeImpl.hpp" #include "DStringPool.hpp" +#include <xercesc/util/XMLChar.hpp> #include <xercesc/util/PlatformUtils.hpp> #include <xercesc/util/XMLRegisterCleanup.hpp> @@ -209,8 +210,8 @@ DOM_DocumentType DOM_DOMImplementation::createDocumentType(const DOMString &qualifiedName, const DOMString &publicId, const DOMString &systemId) -{ - if(!DocumentImpl::isXMLName(qualifiedName)) +{ + if(!XMLChar1_0::isValidName(qualifiedName.rawBuffer(), XMLString::stringLen(qualifiedName.rawBuffer()))) throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null); return DOM_DocumentType(new DocumentTypeImpl(null, qualifiedName, publicId, systemId)); } 1.5 +2 -19 xml-xerces/c/src/xercesc/dom/deprecated/DocumentImpl.cpp Index: DocumentImpl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DocumentImpl.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DocumentImpl.cpp 4 Nov 2002 15:04:44 -0000 1.4 +++ DocumentImpl.cpp 20 Dec 2002 22:10:57 -0000 1.5 @@ -448,24 +448,7 @@ bool DocumentImpl::isXMLName(const DOMString &s) { - const XMLCh *nam; - int length; - int i; - - length = s.length(); - if (length == 0) - return false; - - nam = s.rawBuffer(); - if (!XMLReader::isFirstNameChar(nam[0])) - return false; - - for (i=1; i<length; i++) - { - if (!XMLReader::isNameChar(nam[i])) - return false; - } - return true; + return XMLChar1_0::isValidName(s.rawBuffer(),s.length()); }; 1.4 +2 -2 xml-xerces/c/src/xercesc/dom/deprecated/DocumentImpl.hpp Index: DocumentImpl.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DocumentImpl.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DocumentImpl.hpp 4 Nov 2002 15:04:44 -0000 1.3 +++ DocumentImpl.hpp 20 Dec 2002 22:10:57 -0000 1.4 @@ -201,7 +201,7 @@ virtual ElementImpl *getDocumentElement(); virtual DeepNodeListImpl *getElementsByTagName(const DOMString & tagname); virtual NodeImpl *insertBefore(NodeImpl *newChild, NodeImpl *refChild); - static bool isXMLName(const DOMString & s); + bool isXMLName(const DOMString & s); virtual void referenced(); virtual NodeImpl *removeChild(NodeImpl *oldChild); virtual void unreferenced(); 1.4 +2 -2 xml-xerces/c/src/xercesc/dom/deprecated/ElementNSImpl.cpp Index: ElementNSImpl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/ElementNSImpl.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ElementNSImpl.cpp 4 Nov 2002 15:04:44 -0000 1.3 +++ ElementNSImpl.cpp 20 Dec 2002 22:10:57 -0000 1.4 @@ -140,7 +140,7 @@ DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null); } - if (prefix != null && !DocumentImpl::isXMLName(prefix)) { + if (prefix != null && !((DocumentImpl *)this->getOwnerDocument())->isXMLName(prefix)) { throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR, null); } 1.4 +2 -2 xml-xerces/c/src/xercesc/dom/deprecated/XMLDeclImpl.cpp Index: XMLDeclImpl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/XMLDeclImpl.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- XMLDeclImpl.cpp 4 Nov 2002 15:04:44 -0000 1.3 +++ XMLDeclImpl.cpp 20 Dec 2002 22:10:57 -0000 1.4 @@ -72,7 +72,7 @@ XMLDeclImpl::XMLDeclImpl(DocumentImpl *ownerDoc) : ChildNode(ownerDoc), - version(DOMString(XMLUni::fgSupportedVersion)), + version(DOMString(XMLUni::fgVersion1_0)), encoding (DOMString(XMLUni::fgUTF8EncodingString)), standalone (DOMString(XMLUni::fgNoString)) { 1.10 +3 -3 xml-xerces/c/src/xercesc/dom/impl/DOMAttrNSImpl.cpp Index: DOMAttrNSImpl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMAttrNSImpl.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- DOMAttrNSImpl.cpp 4 Nov 2002 15:07:34 -0000 1.9 +++ DOMAttrNSImpl.cpp 20 Dec 2002 22:10:58 -0000 1.10 @@ -129,7 +129,7 @@ if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull || XMLString::equals(fLocalName, xmlns)) throw DOMException(DOMException::NAMESPACE_ERR, 0); - if (prefix != 0 && !DOMDocumentImpl::isXMLName(prefix)) + if (prefix != 0 && !((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(prefix)) throw DOMException(DOMException::INVALID_CHARACTER_ERR,0); if (prefix == 0 || prefix[0] == chNull) { @@ -241,7 +241,7 @@ delete[] newName; // Before we carry on, we should check if the prefix or localName are valid XMLName - if (!DOMDocumentImpl::isXMLName(fPrefix) || !DOMDocumentImpl::isXMLName(fLocalName)) + if (!((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fPrefix) || !((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fLocalName)) throw DOMException(DOMException::NAMESPACE_ERR, 0); } 1.28 +7 -13 xml-xerces/c/src/xercesc/dom/impl/DOMDocumentImpl.cpp Index: DOMDocumentImpl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMDocumentImpl.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- DOMDocumentImpl.cpp 4 Nov 2002 15:07:34 -0000 1.27 +++ DOMDocumentImpl.cpp 20 Dec 2002 22:10:58 -0000 1.28 @@ -465,17 +465,10 @@ bool DOMDocumentImpl::isXMLName(const XMLCh *s) { - // revist. This function probably already exists in the scanner. - if (!XMLReader::isFirstNameChar(s[0])) - return false; - - const XMLCh *p; - for (p=s+1; *p!=0; p++) - { - if (!XMLReader::isNameChar(*p)) - return false; - } - return true; + if (XMLString::equals(fVersion, XMLUni::fgVersion1_1)) + return XMLChar1_1::isValidName(s, XMLString::stringLen(s)); + else + return XMLChar1_0::isValidName(s, XMLString::stringLen(s)); }; @@ -894,7 +887,8 @@ void DOMDocumentImpl::setVersion(const XMLCh* version){ if ((version && *version) && - !XMLString::equals(version, XMLUni::fgSupportedVersion)) + !XMLString::equals(version, XMLUni::fgVersion1_0) && + !XMLString::equals(version, XMLUni::fgVersion1_1)) throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0); fVersion = cloneString(version); 1.13 +2 -2 xml-xerces/c/src/xercesc/dom/impl/DOMDocumentImpl.hpp Index: DOMDocumentImpl.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMDocumentImpl.hpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- DOMDocumentImpl.hpp 5 Nov 2002 21:44:37 -0000 1.12 +++ DOMDocumentImpl.hpp 20 Dec 2002 22:10:58 -0000 1.13 @@ -177,7 +177,7 @@ virtual DOMElement* getDocumentElement() const; virtual DOMNodeList* getElementsByTagName(const XMLCh * tagname) const; virtual DOMImplementation* getImplementation() const; - static bool isXMLName(const XMLCh * s); + bool isXMLName(const XMLCh * s); virtual DOMNodeIterator* createNodeIterator(DOMNode *root, unsigned long whatToShow, DOMNodeFilter* filter, 1.20 +11 -3 xml-xerces/c/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp Index: DOMDocumentTypeImpl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- DOMDocumentTypeImpl.cpp 4 Nov 2002 15:07:34 -0000 1.19 +++ DOMDocumentTypeImpl.cpp 20 Dec 2002 22:10:58 -0000 1.20 @@ -62,6 +62,7 @@ #include <xercesc/dom/DOMNode.hpp> #include <xercesc/dom/DOMException.hpp> #include <xercesc/util/XMLUniDefs.hpp> +#include <xercesc/util/XMLChar.hpp> #include "DOMNamedNodeMapImpl.hpp" #include "DOMDocumentImpl.hpp" @@ -136,8 +137,15 @@ newName[index] = chNull; // Before we carry on, we should check if the prefix or localName are valid XMLName - if (!DOMDocumentImpl::isXMLName(newName) || !DOMDocumentImpl::isXMLName(qualifiedName+index+1)) - throw DOMException(DOMException::NAMESPACE_ERR, 0); + if (ownerDoc) { + if (!((DOMDocumentImpl*)ownerDoc)->isXMLName(newName) || !((DOMDocumentImpl*)ownerDoc)->isXMLName(qualifiedName+index+1)) + throw DOMException(DOMException::NAMESPACE_ERR, 0); + } + else { + // document is not there yet, so assume XML 1.0 + if (!XMLChar1_0::isValidName(newName, index) || !XMLChar1_0::isValidName(qualifiedName+index+1, XMLString::stringLen(qualifiedName)-index-1)) + throw DOMException(DOMException::NAMESPACE_ERR, 0); + } if (index >= 3999) delete[] newName; 1.11 +3 -3 xml-xerces/c/src/xercesc/dom/impl/DOMElementNSImpl.cpp Index: DOMElementNSImpl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMElementNSImpl.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- DOMElementNSImpl.cpp 4 Nov 2002 15:07:34 -0000 1.10 +++ DOMElementNSImpl.cpp 20 Dec 2002 22:10:58 -0000 1.11 @@ -151,7 +151,7 @@ if (fNode.isReadOnly()) throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0); - if(prefix != 0 && !DOMDocumentImpl::isXMLName(prefix)) + if(prefix != 0 && !((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(prefix)) throw DOMException(DOMException::INVALID_CHARACTER_ERR,0); if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull) @@ -250,7 +250,7 @@ delete[] newName; // Before we carry on, we should check if the prefix or localName are valid XMLName - if (!DOMDocumentImpl::isXMLName(fPrefix) || !DOMDocumentImpl::isXMLName(fLocalName)) + if (!((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fPrefix) || !((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fLocalName)) throw DOMException(DOMException::NAMESPACE_ERR, 0); } 1.14 +4 -2 xml-xerces/c/src/xercesc/dom/impl/DOMImplementationImpl.cpp Index: DOMImplementationImpl.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMImplementationImpl.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- DOMImplementationImpl.cpp 10 Dec 2002 21:00:41 -0000 1.13 +++ DOMImplementationImpl.cpp 20 Dec 2002 22:10:58 -0000 1.14 @@ -68,6 +68,7 @@ #include <xercesc/dom/DOMException.hpp> #include <xercesc/util/PlatformUtils.hpp> #include <xercesc/util/XMLUniDefs.hpp> +#include <xercesc/util/XMLChar.hpp> #include <xercesc/util/XMLRegisterCleanup.hpp> #include <xercesc/util/XMLStringTokenizer.hpp> #include <xercesc/util/XMLDOMMsg.hpp> @@ -218,7 +219,8 @@ DOMDocumentType *DOMImplementationImpl::createDocumentType(const XMLCh *qualifiedName, const XMLCh * publicId, const XMLCh *systemId) { - if(!DOMDocumentImpl::isXMLName(qualifiedName)) + // assume XML 1.0 since we do not know its version yet. + if(!XMLChar1_0::isValidName(qualifiedName, XMLString::stringLen(qualifiedName))) throw DOMException(DOMException::INVALID_CHARACTER_ERR,0); DOMDocumentTypeImpl* docType = new DOMDocumentTypeImpl(0, qualifiedName, publicId, systemId, true); return docType;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]