You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/02/17 21:26:42 UTC

cvs commit: xml-xalan/c/src/DOMSupport DOMServices.cpp DOMSupportDefault.cpp DOMSupportDefault.hpp NamespaceResolver.cpp NamespaceResolver.hpp UnimplementedDocument.cpp UnimplementedDocument.hpp UnimplementedDocumentFragment.cpp UnimplementedDocumentFragment.hpp UnimplementedElement.cpp UnimplementedElement.hpp UnimplementedNode.cpp UnimplementedNode.hpp

dbertoni    00/02/17 12:26:42

  Modified:    c/src/DOMSupport DOMServices.cpp DOMSupportDefault.cpp
                        DOMSupportDefault.hpp NamespaceResolver.cpp
                        NamespaceResolver.hpp UnimplementedDocument.cpp
                        UnimplementedDocument.hpp
                        UnimplementedDocumentFragment.cpp
                        UnimplementedDocumentFragment.hpp
                        UnimplementedElement.cpp UnimplementedElement.hpp
                        UnimplementedNode.cpp UnimplementedNode.hpp
  Log:
  Changes for Linux build, and to match latest Xerces DOM signatures.
  
  Revision  Changes    Path
  1.4       +27 -11    xml-xalan/c/src/DOMSupport/DOMServices.cpp
  
  Index: DOMServices.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMServices.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DOMServices.cpp	2000/01/26 20:29:56	1.3
  +++ DOMServices.cpp	2000/02/17 20:26:37	1.4
  @@ -105,6 +105,8 @@
    			const DOM_Node&				node,
   			const WhitespaceSupport&	theResolver)
   {
  +	assert(node != 0);
  +
   	DOMString	data;
   
   	switch(node.getNodeType())
  @@ -113,11 +115,11 @@
   	case DOM_Node::DOCUMENT_NODE:
   	case DOM_Node::ELEMENT_NODE:
   		{
  -			DOM_NodeList	children = node.getChildNodes();
  +			const DOM_NodeList	children = node.getChildNodes();
   
  -			const int 	nNodes = children.getLength();
  +			const unsigned int 	nNodes = children.getLength();
   
  -			for(int i = 0; i < nNodes; i++)
  +			for(unsigned int i = 0; i < nNodes; i++)
   			{
   				const DOMString 	nodeData =
   					getNodeData(children.item(i),
  @@ -135,7 +137,11 @@
   	case DOM_Node::CDATA_SECTION_NODE:
   		{
   			const DOM_Text&		theTextNode =
  +#if defined(XALAN_OLD_STYLE_CASTS)
  +				(const DOM_Text&)node;
  +#else
   				static_cast<const DOM_Text&>(node);
  +#endif
   
   			if(theResolver.isIgnorableWhitespace(theTextNode) == false)
   			{
  @@ -182,13 +188,15 @@
   
       DOM_Node			parent;
   
  +	// $$$ TODO: DOM_NamedNodeMap::item() should be const.  When it does,
  +	// this can become const as well.
   	DOM_NamedNodeMap	attrs = elem.getAttributes();
   
       if(attrs != 0)
   	{
  -		const int		nAttrs = attrs.getLength();
  +		const unsigned int	nAttrs = attrs.getLength();
   		
  -		for(int i = 0; i < nAttrs; i++)
  +		for(unsigned int i = 0; i < nAttrs; i++)
   		{
   			if(attrs.item(i) == attr)
   			{
  @@ -201,17 +209,21 @@
   
   	if(parent == 0)
       {
  -		DOM_NodeList	children = elem.getChildNodes();
  +		DOM_NodeList		children = elem.getChildNodes();
   
  -		const int		nChildren = children.getLength();
  +		const unsigned int	nChildren = children.getLength();
   
  -		for(int i = 0; i < nChildren; i++)
  +		for(unsigned int i = 0; i < nChildren; i++)
   		{
   			DOM_Node node = children.item(i);
   
   			if(node.getNodeType() == DOM_Node::ELEMENT_NODE)
   			{
  +#if defined(XALAN_OLD_STYLE_CASTS)
  +				parent = locateAttrParent((const DOM_Element&)node, attr);
  +#else
   				parent = locateAttrParent(static_cast<DOM_Element&>(node), attr);
  +#endif
   
   				if(parent != 0)
   					break;
  @@ -284,9 +296,13 @@
   		{
   			if (type == DOM_Node::ELEMENT_NODE) 
   			{
  -				DOM_NamedNodeMap nnm = parent.getAttributes();
  -				
  -				for (int i = 0;  i < nnm.getLength();  i ++) 
  +				// $$$ TODO: DOM_NamedNodeMap::item() should be const.  When it does,
  +				// this can become const as well.
  +				DOM_NamedNodeMap	nnm = parent.getAttributes();
  +
  +				const unsigned int	theLength = nnm.getLength();
  +
  +				for (unsigned int i = 0;  i < theLength;  i ++) 
   				{
   					DOM_Node	attr = nnm.item(i);
   					DOMString	aname = attr.getNodeName();
  
  
  
  1.3       +0 -1      xml-xalan/c/src/DOMSupport/DOMSupportDefault.cpp
  
  Index: DOMSupportDefault.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMSupportDefault.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DOMSupportDefault.cpp	2000/01/28 15:01:10	1.2
  +++ DOMSupportDefault.cpp	2000/02/17 20:26:38	1.3
  @@ -66,7 +66,6 @@
   #include <dom/DOM_Attr.hpp>
   #include <dom/DOM_Document.hpp>
   #include <dom/DOM_Element.hpp>
  -#include <dom/DOM_NamedNodeMap.hpp>
   
   
   
  
  
  
  1.2       +1 -1      xml-xalan/c/src/DOMSupport/DOMSupportDefault.hpp
  
  Index: DOMSupportDefault.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/DOMSupportDefault.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DOMSupportDefault.hpp	1999/12/18 19:47:47	1.1
  +++ DOMSupportDefault.hpp	2000/02/17 20:26:38	1.2
  @@ -100,7 +100,7 @@
   
   private:
   
  -	mutable NamespaceResolver	m_resolver;
  +	NamespaceResolver	m_resolver;
   };
   
   
  
  
  
  1.4       +40 -15    xml-xalan/c/src/DOMSupport/NamespaceResolver.cpp
  
  Index: NamespaceResolver.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/NamespaceResolver.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NamespaceResolver.cpp	2000/01/26 20:29:56	1.3
  +++ NamespaceResolver.cpp	2000/02/17 20:26:38	1.4
  @@ -97,12 +97,38 @@
   
   
   
  +static DOMString	theXMLString(XALAN_STATIC_UCODE_STRING("xml"));
  +static DOMString	theXMLNSString(XALAN_STATIC_UCODE_STRING("xmlns"));
  +static DOMString	theXMLNSStringWithColon(XALAN_STATIC_UCODE_STRING("xmlns:"));
  +
  +
  +
  +void
  +NamespaceResolver::updateNamespace(
  +			const DOM_Node&		theNode,
  +			const NSInfo&		theNamespace) const
  +{
  +#if defined(XALAN_NO_MUTABLE)
  +#if defined(XALAN_OLD_STYLE_CASTS)
  +	((NamespaceResolver*)this)->m_NSInfos[theNode] = theNamespace;
  +#else
  +	const_cast<NamespaceResolver*>(this)->m_NSInfos[theNode] = theNamespace;
  +#endif
  +#else
  +	m_NSInfos[theNode] = theNamespace;
  +#endif
  +}
  +
  +
  +
   DOMString
  -NamespaceResolver::getNamespaceOfNode(const DOM_Node&	theNode)
  +NamespaceResolver::getNamespaceOfNode(const DOM_Node&	theNode) const
   {
  +#if !defined(XALAN_NO_NAMESPACES)
   	using std::make_pair;
   	using std::pair;
   	using std::vector;
  +#endif
   
   	DOM_Node						theLocalNode(theNode);
   
  @@ -178,7 +204,7 @@
   		bool	ancestorsHaveXMLNS = false;
   		bool	nHasXMLNS = false;
   
  -		if(equals(prefix, "xml") == true)
  +		if(equals(prefix, theXMLString) == true)
   		{
   			namespaceOfPrefix = DOMServices::s_XMLNamespaceURI;
   		}
  @@ -209,10 +235,11 @@
   					
   					if (parentType == DOM_Node::ELEMENT_NODE) 
   					{
  -						// $$$ TODO: DOM_NamedNodeMap::getLength() should be const.
  +						// $$$ TODO: DOM_NamedNodeMap::item() should be const.  When it does,
  +						// this can become const as well.
   						DOM_NamedNodeMap	nnm = parent.getAttributes();
   
  -						for (int i = 0;  i < nnm.getLength();  i ++) 
  +						for (unsigned int i = 0;  i < nnm.getLength();  i ++) 
   						{
   							DOM_Node			attr = nnm.item(i);
   
  @@ -220,11 +247,9 @@
   
   							if(charAt(aname, 0) == 'x')
   							{
  -								const char* const	theXMLNS = "xmlns:";
  -
  -								bool isPrefix = startsWith(aname, theXMLNS);
  +								bool isPrefix = startsWith(aname, theXMLNSStringWithColon);
   							  
  -								if (equals(aname, "xmlns") == true || isPrefix == true) 
  +								if (equals(aname, theXMLNSString) == true || isPrefix == true) 
   								{
   									if(theLocalNode == parent)
   									{
  @@ -235,7 +260,7 @@
   									ancestorsHaveXMLNS = true;
   
   									const DOMString	p = isPrefix == true ?
  -										substring(aname, strlen(theXMLNS)) : DOMString();
  +										substring(aname, length(theXMLNSStringWithColon)) : DOMString();
   
   									if (equals(p, prefix) == true) 
   									{
  @@ -254,7 +279,7 @@
   						nsInfo = elementHasXMLNS ? theNSInfoUnProcWithXMLNS :
   										theNSInfoUnProcWithoutXMLNS;
   
  -						m_NSInfos[parent] = nsInfo;
  +						updateNamespace(parent, nsInfo);
   					}
   				}
   
  @@ -293,7 +318,7 @@
   						if(candidateInfo == theNSInfoUnProcWithoutXMLNS ||
   						   candidateInfo == theNSInfoNullWithoutXMLNS)
   						{
  -							m_NSInfos[parent] = candidateInfo;
  +							updateNamespace(parent, candidateInfo);
   						}
   					}
   				}
  @@ -310,23 +335,23 @@
   				{
   					if(nHasXMLNS == true)
   					{
  -						m_NSInfos[theLocalNode] = theNSInfoNullWithXMLNS;
  +						updateNamespace(theLocalNode, theNSInfoNullWithXMLNS);
   					}
   				
   					else
   					{
  -						m_NSInfos[theLocalNode] = theNSInfoNullWithoutXMLNS;
  +						updateNamespace(theLocalNode, theNSInfoNullWithoutXMLNS);
   					}
   				}
   			  
   				else
   				{
  -					m_NSInfos[theLocalNode] = theNSInfoNullNoAncestorXMLNS;
  +					updateNamespace(theLocalNode, theNSInfoNullNoAncestorXMLNS);
   				}
   			}
   			else
   			{
  -				m_NSInfos[theLocalNode] = NSInfo(namespaceOfPrefix, nHasXMLNS);
  +				updateNamespace(theLocalNode, NSInfo(namespaceOfPrefix, nHasXMLNS));
   			}
   		}
   	}
  
  
  
  1.2       +16 -2     xml-xalan/c/src/DOMSupport/NamespaceResolver.hpp
  
  Index: NamespaceResolver.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/NamespaceResolver.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NamespaceResolver.hpp	1999/12/18 19:47:47	1.1
  +++ NamespaceResolver.hpp	2000/02/17 20:26:38	1.2
  @@ -99,17 +99,31 @@
   	// These interfaces are new to NamespaceResolver...
   
   	virtual DOMString
  -	getNamespaceOfNode(const DOM_Node&	theNode);
  +	getNamespaceOfNode(const DOM_Node&	theNode) const;
   
   protected:
   
   #if defined(XALAN_HASH_CONTAINERS_AVAILABLE)
  +#if defined(XALAN_NO_NAMESPACES)
  +	typedef hash_map<DOM_Node, NSInfo, DOM_NodeHashFunction>		NSInfoMapType;
  +#else
   	typedef std::hash_map<DOM_Node, NSInfo, DOM_NodeHashFunction>	NSInfoMapType;
  +#endif
  +#else
  +#if defined(XALAN_NO_NAMESPACES)
  +	typedef map<DOM_Node, NSInfo>									NSInfoMapType;
   #else
   	typedef std::map<DOM_Node, NSInfo>								NSInfoMapType;
   #endif
  +#endif
  +
  +	void
  +	updateNamespace(
  +			const DOM_Node&		theNode,
  +			const NSInfo&		theNamespace) const;
   
  -	NSInfoMapType	m_NSInfos;
  +	// Cached namespace information...
  +	mutable NSInfoMapType	m_NSInfos;
   };
   
   
  
  
  
  1.4       +5 -1      xml-xalan/c/src/DOMSupport/UnimplementedDocument.cpp
  
  Index: UnimplementedDocument.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/UnimplementedDocument.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnimplementedDocument.cpp	2000/02/04 19:07:46	1.3
  +++ UnimplementedDocument.cpp	2000/02/17 20:26:38	1.4
  @@ -154,6 +154,7 @@
   }
   
   
  +
   NodeImpl*
   UnimplementedDocument::getFirstChild()
   {
  @@ -163,6 +164,7 @@
   }
   
   
  +
   NodeImpl*
   UnimplementedDocument::	getLastChild()
   {
  @@ -172,6 +174,7 @@
   }
   
   
  +
   unsigned int
   UnimplementedDocument::getLength()
   {
  @@ -181,6 +184,7 @@
   }
   
   
  +
   NodeImpl*
   UnimplementedDocument::getNextSibling()
   {
  @@ -280,7 +284,7 @@
   
   
   NodeImpl*
  -UnimplementedDocument::item(unsigned long	/* index */)
  +UnimplementedDocument::item(unsigned int	/* index */)
   {
   	assert(false);
   
  
  
  
  1.4       +1 -1      xml-xalan/c/src/DOMSupport/UnimplementedDocument.hpp
  
  Index: UnimplementedDocument.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/UnimplementedDocument.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnimplementedDocument.hpp	2000/02/04 19:07:46	1.3
  +++ UnimplementedDocument.hpp	2000/02/17 20:26:38	1.4
  @@ -97,7 +97,7 @@
   	// These interfaces are inherited from NodeListImpl...
   
   	virtual NodeImpl*
  -	item(unsigned long	index);
  +	item(unsigned int	index);
   
   	virtual unsigned int
   	getLength();
  
  
  
  1.4       +1 -1      xml-xalan/c/src/DOMSupport/UnimplementedDocumentFragment.cpp
  
  Index: UnimplementedDocumentFragment.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/UnimplementedDocumentFragment.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnimplementedDocumentFragment.cpp	2000/02/04 19:07:46	1.3
  +++ UnimplementedDocumentFragment.cpp	2000/02/17 20:26:38	1.4
  @@ -266,7 +266,7 @@
   
   
   NodeImpl*
  -UnimplementedDocumentFragment::item(unsigned long	/* index */)
  +UnimplementedDocumentFragment::item(unsigned int	/* index */)
   {
   	assert(false);
   
  
  
  
  1.4       +1 -1      xml-xalan/c/src/DOMSupport/UnimplementedDocumentFragment.hpp
  
  Index: UnimplementedDocumentFragment.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/UnimplementedDocumentFragment.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnimplementedDocumentFragment.hpp	2000/02/04 19:07:46	1.3
  +++ UnimplementedDocumentFragment.hpp	2000/02/17 20:26:38	1.4
  @@ -102,7 +102,7 @@
   	// Deriving classes _must_ override these.
   
   	virtual NodeImpl*
  -	item(unsigned long	index);
  +	item(unsigned int	index);
   
   	virtual unsigned int
   	getLength();
  
  
  
  1.4       +1 -1      xml-xalan/c/src/DOMSupport/UnimplementedElement.cpp
  
  Index: UnimplementedElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/UnimplementedElement.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnimplementedElement.cpp	2000/02/04 19:07:46	1.3
  +++ UnimplementedElement.cpp	2000/02/17 20:26:38	1.4
  @@ -284,7 +284,7 @@
   
   
   NodeImpl*
  -UnimplementedElement::item(unsigned long	/* index */)
  +UnimplementedElement::item(unsigned int		/* index */)
   {
   	assert(false);
   
  
  
  
  1.4       +1 -1      xml-xalan/c/src/DOMSupport/UnimplementedElement.hpp
  
  Index: UnimplementedElement.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/UnimplementedElement.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnimplementedElement.hpp	2000/02/04 19:07:46	1.3
  +++ UnimplementedElement.hpp	2000/02/17 20:26:38	1.4
  @@ -97,7 +97,7 @@
   	// These interfaces are inherited from NodeListImpl...
   
   	virtual NodeImpl*
  -	item(unsigned long	index);
  +	item(unsigned int	index);
   
   	virtual unsigned int
   	getLength();
  
  
  
  1.4       +2 -1      xml-xalan/c/src/DOMSupport/UnimplementedNode.cpp
  
  Index: UnimplementedNode.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/UnimplementedNode.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnimplementedNode.cpp	2000/02/04 19:07:46	1.3
  +++ UnimplementedNode.cpp	2000/02/17 20:26:39	1.4
  @@ -279,12 +279,13 @@
   
   
   NodeImpl*
  -UnimplementedNode::item(unsigned long	/* index */)
  +UnimplementedNode::item(unsigned int	/* index */)
   {
   	assert(false);
   
   	return 0;
   }
  +
   
   
   NodeImpl*
  
  
  
  1.4       +1 -1      xml-xalan/c/src/DOMSupport/UnimplementedNode.hpp
  
  Index: UnimplementedNode.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/DOMSupport/UnimplementedNode.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- UnimplementedNode.hpp	2000/02/04 19:07:46	1.3
  +++ UnimplementedNode.hpp	2000/02/17 20:26:39	1.4
  @@ -98,7 +98,7 @@
   	// These interfaces are inherited from NodeListImpl...
   
   	virtual NodeImpl*
  -	item(unsigned long	index);
  +	item(unsigned int	index);
   
   	virtual unsigned int
   	getLength();