You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ra...@locus.apache.org on 2000/06/19 22:06:07 UTC

cvs commit: xml-xerces/c/src/com XMLDOMXMLDecl.cpp XMLDOMXMLDecl.h IXMLDOMNodeImpl.h IXMLDOMNodeImpl.inl StdAfx.cpp XMLDOMAttribute.cpp XMLDOMAttribute.h XMLDOMDocument.cpp XMLDOMDocument.h XMLDOMElement.cpp XMLDOMNamedNodeMap.cpp XMLDOMNodeList.cpp XMLDOMUtil.cpp XMLDOMUtil.h xml4com.cpp xml4com.idl xmldocument.rgs xmlhttprequest.rgs

rahulj      00/06/19 13:06:06

  Modified:    c/src/com IXMLDOMNodeImpl.h IXMLDOMNodeImpl.inl StdAfx.cpp
                        XMLDOMAttribute.cpp XMLDOMAttribute.h
                        XMLDOMDocument.cpp XMLDOMDocument.h
                        XMLDOMElement.cpp XMLDOMNamedNodeMap.cpp
                        XMLDOMNodeList.cpp XMLDOMUtil.cpp XMLDOMUtil.h
                        xml4com.cpp xml4com.idl xmldocument.rgs
                        xmlhttprequest.rgs
  Added:       c/src/com XMLDOMXMLDecl.cpp XMLDOMXMLDecl.h
  Log:
  Changes for increased conformance and stability. Submitted by
  Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  
  Revision  Changes    Path
  1.4       +5 -1      xml-xerces/c/src/com/IXMLDOMNodeImpl.h
  
  Index: IXMLDOMNodeImpl.h
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/IXMLDOMNodeImpl.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IXMLDOMNodeImpl.h	2000/06/03 00:28:54	1.3
  +++ IXMLDOMNodeImpl.h	2000/06/19 20:05:56	1.4
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: IXMLDOMNodeImpl.h,v $
  + * Revision 1.4  2000/06/19 20:05:56  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.3  2000/06/03 00:28:54  andyh
    * COM Wrapper changes from Curt Arnold
    *
  @@ -77,8 +81,9 @@
   //      on the Directories tab on the dialog displayed after selecting Tools Options
   //      from the Visual Studio IDE.
   //
  +//   See http://xml.apache.org/xerces-c/build.html#BuildCOM
   #ifndef __IXMLDOMNode_INTERFACE_DEFINED__
  -#error "xerces-dom requires an MSXML.H compatible with IE5 or later.  See comments for directions to correct this problem."
  +#error "xerces-dom requires an MSXML.H compatible with IE5 or later.  See http://xml.apache.org/xerces-c/build.html#BuildCOM for directions to correct this problem."
   #endif
   
   
  
  
  
  1.4       +14 -4     xml-xerces/c/src/com/IXMLDOMNodeImpl.inl
  
  Index: IXMLDOMNodeImpl.inl
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/IXMLDOMNodeImpl.inl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IXMLDOMNodeImpl.inl	2000/06/03 00:28:54	1.3
  +++ IXMLDOMNodeImpl.inl	2000/06/19 20:05:56	1.4
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: IXMLDOMNodeImpl.inl,v $
  + * Revision 1.4  2000/06/19 20:05:56  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.3  2000/06/03 00:28:54  andyh
    * COM Wrapper changes from Curt Arnold
    *
  @@ -163,12 +167,16 @@
   	if (NULL == pVal)
   		return E_POINTER;
   
  +	if(*pVal) (*pVal)->Release();
   	*pVal = NULL;
   	HRESULT hr = S_OK;
   
   	try
   	{
  -		hr = wrapNode(m_pIXMLDOMDocument, get_DOM_Node().getParentNode(),IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal));
  +		DOM_Node n = get_DOM_Node().getParentNode();
  +		if(!n.isNull()) {
  +			hr = wrapNode(m_pIXMLDOMDocument, n,IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal));
  +		}
   	}
   	catch(...)
   	{
  @@ -523,7 +531,8 @@
   	try
   	{
   		DOM_Node n = get_DOM_Node().removeChild(*pChildNode);
  -		hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (oldChild));
  +		if(!n.isNull())
  +			hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (oldChild));
   	}
   	catch(...)
   	{
  @@ -648,7 +657,7 @@
   	if (NULL == pVal)
   		return E_POINTER;
   
  -	*pVal = ::SysAllocString(T2OLE(g_DomNodeName[get_DOMNodeType()]));
  +	*pVal = ::SysAllocString(g_DomNodeName[get_DOMNodeType()]);
   	
   	return S_OK;
   }
  @@ -715,13 +724,15 @@
   	return S_OK;
   }
   
  +
   template <class T, const IID* piid, const GUID* plibid, WORD wMajor,WORD wMinor, class tihclass>
   STDMETHODIMP
   IXMLDOMNodeImpl<T,piid,plibid,wMajor,wMinor,tihclass>::get_specified(VARIANT_BOOL *pVal)
   {
   	ATLTRACE(_T("IXMLDOMNodeImpl::get_specified\n"));
   
  -	return E_NOTIMPL;
  +	*pVal = VARIANT_TRUE;
  +	return S_OK;
   }
   
   template <class T, const IID* piid, const GUID* plibid, WORD wMajor,WORD wMinor, class tihclass>
  
  
  
  1.3       +1 -1      xml-xerces/c/src/com/StdAfx.cpp
  
  Index: StdAfx.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/StdAfx.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StdAfx.cpp	2000/06/03 00:28:55	1.2
  +++ StdAfx.cpp	2000/06/19 20:05:57	1.3
  @@ -21,6 +21,6 @@
   //      from the Visual Studio IDE.
   //
   #ifndef __IXMLDOMNode_INTERFACE_DEFINED__
  -#error "xerces-dom requires an MSXML.H compatible with IE5 or later.  See comments for directions to correct this problem."
  +#error "xerces-dom requires an MSXML.H compatible with IE5 or later.  See http://xml.apache.org/xerces-c/build.html#BuildCOM for directions to correct this problem."
   #endif
   
  
  
  
  1.3       +22 -1     xml-xerces/c/src/com/XMLDOMAttribute.cpp
  
  Index: XMLDOMAttribute.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/XMLDOMAttribute.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLDOMAttribute.cpp	2000/03/30 02:00:12	1.2
  +++ XMLDOMAttribute.cpp	2000/06/19 20:05:57	1.3
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: XMLDOMAttribute.cpp,v $
  + * Revision 1.3  2000/06/19 20:05:57  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.2  2000/03/30 02:00:12  abagchi
    * Initial checkin of working code with Copyright Notice
    *
  @@ -127,4 +131,22 @@
   	
   	return S_OK;
   }
  +
  +	//  IXMLDOMNode method
  +STDMETHODIMP CXMLDOMAttribute::get_specified(VARIANT_BOOL  *pVal)
  +{
  +	ATLTRACE(_T("CXMLDOMAttribute::get_specified\n"));
  +
  +	try
  +	{
  +		*pVal = attr.getSpecified() ? VARIANT_TRUE : VARIANT_FALSE;
  +	}
  +	catch(...)
  +	{
  +		return E_FAIL;
  +	}
  +	
  +	return S_OK;
  +}
  +
   
  
  
  
  1.4       +7 -0      xml-xerces/c/src/com/XMLDOMAttribute.h
  
  Index: XMLDOMAttribute.h
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/XMLDOMAttribute.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLDOMAttribute.h	2000/06/03 00:28:55	1.3
  +++ XMLDOMAttribute.h	2000/06/19 20:05:57	1.4
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: XMLDOMAttribute.h,v $
  + * Revision 1.4  2000/06/19 20:05:57  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.3  2000/06/03 00:28:55  andyh
    * COM Wrapper changes from Curt Arnold
    *
  @@ -96,6 +100,10 @@
   	COM_INTERFACE_ENTRY(IDispatch)
   END_COM_MAP()
   	
  +	//  IXMLDOMNode method
  +	STDMETHOD(get_specified)(VARIANT_BOOL  *pVal);
  +
  +
   	// IXMLDOMAttribute methods
   	STDMETHOD(get_name)(BSTR  *pVal);
   	STDMETHOD(get_value)(VARIANT  *pVal);
  
  
  
  1.4       +35 -5     xml-xerces/c/src/com/XMLDOMDocument.cpp
  
  Index: XMLDOMDocument.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/XMLDOMDocument.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLDOMDocument.cpp	2000/06/03 00:28:57	1.3
  +++ XMLDOMDocument.cpp	2000/06/19 20:05:57	1.4
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: XMLDOMDocument.cpp,v $
  + * Revision 1.4  2000/06/19 20:05:57  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.3  2000/06/03 00:28:57  andyh
    * COM Wrapper changes from Curt Arnold
    *
  @@ -131,6 +135,7 @@
   	,m_xml						(_T(""))
   	,m_bParseError				(false)
   	,m_bThreadValidate			(false)
  +	,m_bPreserveWhiteSpace      (false)
   {
   }
   
  @@ -259,7 +264,15 @@
   	if (NULL == pVal)
   		return E_POINTER;
   
  +	if(*pVal) (*pVal)->Release();
   	*pVal = NULL;
  +	DOM_DocumentType doctype = m_Document.getDoctype();
  +
  +	//
  +	//   if the document had no doctype then return a null object
  +	//
  +	if(doctype.isNull())
  +		return S_OK;
   
   	CXMLDOMDocumentTypeObj *pObj = NULL;
   	HRESULT hr = CXMLDOMDocumentTypeObj::CreateInstance(&pObj);
  @@ -271,7 +284,7 @@
   
   	try
   	{
  -		pObj->documentType = m_Document.getDoctype();
  +		pObj->documentType = doctype;
   	}
   	catch(...)
   	{
  @@ -732,9 +745,9 @@
   	if (VT_I4 == V_VT(&type))
   		nodeType = static_cast<DOMNodeType> (V_I4(&type));
   	else {
  -		_bstr_t str = V_BSTR(&type);
  +		OLECHAR* str = V_BSTR(&type);
   		for (int i = 0; i < g_DomNodeNameSize; ++i) {
  -			if (0 == lstrcmpi(str,g_DomNodeName[i])) {
  +			if (0 == _wcsicmp(str,g_DomNodeName[i])) {
   				nodeType = static_cast<DOMNodeType> (i);
   				break;
   			}
  @@ -1318,6 +1331,20 @@
   	}
   
   	DOMParser parser;
  +
  +	//
  +	//   If set to true then an node supporting IXMLDOMProcessingInstruction
  +	//     is added for the XML declaration.
  +	//
  +	//   Setting to true in a custom DLL will better mimic
  +	//      MSXML.DLL but at a cost of conformance errors
  +	//      using David Brownell's suite
  +	parser.setToCreateXMLDeclTypeNode(false);
  +
  +	parser.setIncludeIgnorableWhitespace(pThis->m_bPreserveWhiteSpace);
  +
  +
  +
   	if (!pThis->m_bParseError && !pThis->m_bAbort)
   		parser.setDoValidation(pThis->m_bThreadValidate);
   
  @@ -1437,13 +1464,17 @@
   	if (NULL == pVal)
   		return E_POINTER;
   
  -	return E_NOTIMPL;
  +	*pVal = (m_bPreserveWhiteSpace) ? VARIANT_TRUE : VARIANT_FALSE;
  +
  +	return S_OK;
   }
   
   STDMETHODIMP CXMLDOMDocument::put_preserveWhiteSpace(VARIANT_BOOL newVal)
   {	
   	ATLTRACE(_T("CXMLDOMDocument::put_preserveWhiteSpace\n"));
  -	return E_NOTIMPL;
  +	m_bPreserveWhiteSpace = (VARIANT_TRUE == newVal) ? true : false;
  +	return S_OK;
  +
   }
   
   STDMETHODIMP CXMLDOMDocument::put_onreadystatechange(VARIANT newVal)
  
  
  
  1.4       +4 -0      xml-xerces/c/src/com/XMLDOMDocument.h
  
  Index: XMLDOMDocument.h
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/XMLDOMDocument.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLDOMDocument.h	2000/06/03 00:28:57	1.3
  +++ XMLDOMDocument.h	2000/06/19 20:05:58	1.4
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: XMLDOMDocument.h,v $
  + * Revision 1.4  2000/06/19 20:05:58  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.3  2000/06/03 00:28:57  andyh
    * COM Wrapper changes from Curt Arnold
    *
  @@ -200,6 +204,7 @@
   	DOM_Document		  m_TmpDocument;
   	bool			      m_bParseError;
   	bool				  m_bThreadValidate;
  +	bool                  m_bPreserveWhiteSpace;
   	
   	HRESULT GetBaseURL(_bstr_t &baseURL);
   	
  
  
  
  1.3       +49 -13    xml-xerces/c/src/com/XMLDOMElement.cpp
  
  Index: XMLDOMElement.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/XMLDOMElement.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLDOMElement.cpp	2000/03/30 02:00:11	1.2
  +++ XMLDOMElement.cpp	2000/06/19 20:05:58	1.3
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: XMLDOMElement.cpp,v $
  + * Revision 1.3  2000/06/19 20:05:58  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.2  2000/03/30 02:00:11  abagchi
    * Initial checkin of working code with Copyright Notice
    *
  @@ -97,16 +101,18 @@
   		return E_POINTER;
   
   	::VariantInit(pVal);
  +	V_VT(pVal) = VT_EMPTY;
   
  -	try
  -	{
  -		V_VT(pVal)   = VT_BSTR;
  -		V_BSTR(pVal) = SysAllocString(element.getAttribute(name).rawBuffer());
  +	DOMString a = element.getAttribute(name);
  +	if(a.length() > 0) {
  +		try {
  +			V_VT(pVal)   = VT_BSTR;
  +			V_BSTR(pVal) = SysAllocString(a.rawBuffer());
  +		}
  +		catch(...) {
  +			return E_FAIL;
  +		}
   	}
  -	catch(...)
  -	{
  -		return E_FAIL;
  -	}
   	
   	return S_OK;
   }
  @@ -154,19 +160,24 @@
   	if (NULL == attr)
   		return E_POINTER;
   
  +	if(*attr) (*attr)->Release();
   	*attr = NULL;
  +	DOM_Attr attrNode(element.getAttributeNode(name));
  +	if(attrNode.isNull())
  +		return S_OK;
  +	
   
   	CXMLDOMAttributeObj *pObj = NULL;
   	HRESULT hr = CXMLDOMAttributeObj::CreateInstance(&pObj);
   	if (S_OK != hr) 
   		return hr;
  -	
  +
   	pObj->AddRef();
   	pObj->SetOwnerDoc(m_pIXMLDOMDocument);
   
   	try
   	{
  -		pObj->attr = element.getAttributeNode(name);
  +		pObj->attr = attrNode;
   	}
   	catch(...)
   	{
  @@ -189,8 +200,28 @@
   	if (NULL == attr || NULL == attributeNode)
   		return E_POINTER;
   
  +	if(*attributeNode) (*attributeNode)->Release();
   	*attributeNode = NULL;
   
  +	long id = 0;
  +	IIBMXMLDOMNodeIdentity* nodeID = NULL;
  +	if(SUCCEEDED(attr->QueryInterface(IID_IIBMXMLDOMNodeIdentity,(void**) &nodeID))) {
  +		nodeID->get_NodeId(&id);
  +		nodeID->Release();
  +	}
  +
  +	DOM_Attr attrNode;
  +	try {
  +		attrNode = (element.setAttributeNode(*((DOM_Attr*) id)));
  +		if(attrNode.isNull())
  +			return S_OK;
  +	}
  +	catch(...) {
  +		return E_FAIL;
  +	}
  +
  +
  +
   	CXMLDOMAttributeObj *pObj = NULL;
   	HRESULT hr = CXMLDOMAttributeObj::CreateInstance(&pObj);
   	if (S_OK != hr) 
  @@ -201,7 +232,7 @@
   
   	try
   	{
  -		pObj->attr = element.setAttributeNode(((CXMLDOMAttribute*) attr)->attr);
  +		pObj->attr = element.setAttributeNode(attrNode);
   	}
   	catch(...)
   	{
  @@ -236,7 +267,13 @@
   
   	try
   	{
  -		pObj->attr = element.removeAttributeNode(((CXMLDOMAttribute*) attr)->attr);
  +		long id = 0;
  +		IIBMXMLDOMNodeIdentity* nodeID = NULL;
  +		if(SUCCEEDED(attr->QueryInterface(IID_IIBMXMLDOMNodeIdentity,(void**) &nodeID))) {
  +			nodeID->get_NodeId(&id);
  +			nodeID->Release();
  +		}
  +		pObj->attr = element.removeAttributeNode(*((DOM_Attr*) id));
   	}
   	catch(...)
   	{
  
  
  
  1.3       +28 -13    xml-xerces/c/src/com/XMLDOMNamedNodeMap.cpp
  
  Index: XMLDOMNamedNodeMap.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/XMLDOMNamedNodeMap.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLDOMNamedNodeMap.cpp	2000/03/30 01:59:11	1.2
  +++ XMLDOMNamedNodeMap.cpp	2000/06/19 20:05:58	1.3
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: XMLDOMNamedNodeMap.cpp,v $
  + * Revision 1.3  2000/06/19 20:05:58  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.2  2000/03/30 01:59:11  abagchi
    * Initial checkin of working code with Copyright Notice
    *
  @@ -84,7 +88,9 @@
   
   	try
   	{
  -		hr = wrapNode(m_pIXMLDOMDocument,m_container.getNamedItem(name),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
  +		DOM_Node n = m_container.getNamedItem(name);
  +		if(!n.isNull())
  +			hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
   	}
   	catch(...)
   	{
  @@ -126,7 +132,9 @@
   	{
   		DOMString  name = pNewItemNode->getNodeName();
   		m_container.setNamedItem(*pNewItemNode);
  -		hr = wrapNode(m_pIXMLDOMDocument,m_container.getNamedItem(name),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
  +		DOM_Node n = m_container.getNamedItem(name);
  +		if(!n.isNull())
  +			hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
   	}
   	catch(...)
   	{
  @@ -151,11 +159,15 @@
   
   	try
   	{
  -		hr = wrapNode(m_pIXMLDOMDocument,m_container.removeNamedItem(name),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
  -	}
  +		DOM_Node n = m_container.removeNamedItem(name);
  +		if(!n.isNull())
  +			hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
  +	}
  +	//
  +	//   if we had a failure, return success anyway
  +	//
   	catch(...)
   	{
  -		return E_FAIL;
   	}
   	
   	return hr;
  @@ -177,10 +189,8 @@
   			return E_INVALIDARG;
   
   		long length =  m_container.getLength();
  -		if (index >= length)
  -			return E_INVALIDARG;
  -
  -		hr = wrapNode(m_pIXMLDOMDocument,m_container.item(index),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
  +		if (index < length)
  +			hr = wrapNode(m_pIXMLDOMDocument,m_container.item(index),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
   	}
   	catch(...)
   	{
  @@ -230,7 +240,9 @@
   
   	try
   	{
  -		hr = wrapNode(m_pIXMLDOMDocument,m_container.getNamedItemNS(namespaceURI,baseName),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
  +		DOM_Node n = m_container.getNamedItemNS(namespaceURI,baseName);
  +		if(!n.isNull())
  +			hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
   	}
   	catch(...)
   	{
  @@ -256,7 +268,9 @@
   
   	try
   	{
  -		hr = wrapNode(m_pIXMLDOMDocument,m_container.removeNamedItemNS(namespaceURI,baseName),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
  +		DOM_Node n = m_container.removeNamedItemNS(namespaceURI,baseName);
  +		if(!n.isNull())
  +			hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
   	}
   	catch(...)
   	{
  @@ -288,7 +302,9 @@
   
   	try
   	{
  -		hr = wrapNode(m_pIXMLDOMDocument,m_container.item(m_NextNodeIndex),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
  +		DOM_Node n = m_container.item(m_NextNodeIndex);
  +		if(!n.isNull())
  +			hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
   	}
   	catch(...)
   	{
  
  
  
  1.3       +11 -5     xml-xerces/c/src/com/XMLDOMNodeList.cpp
  
  Index: XMLDOMNodeList.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/XMLDOMNodeList.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLDOMNodeList.cpp	2000/03/30 02:00:10	1.2
  +++ XMLDOMNodeList.cpp	2000/06/19 20:05:58	1.3
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: XMLDOMNodeList.cpp,v $
  + * Revision 1.3  2000/06/19 20:05:58  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.2  2000/03/30 02:00:10  abagchi
    * Initial checkin of working code with Copyright Notice
    *
  @@ -76,6 +80,7 @@
   	if (NULL == pVal)
   		return E_POINTER;
   
  +	if(*pVal) (*pVal)->Release();
   	*pVal = NULL;
   	HRESULT hr = S_OK;
   
  @@ -85,10 +90,12 @@
   			return E_INVALIDARG;
   
   		long length = m_container.getLength(); 
  -		if (index >= length)
  -			return E_INVALIDARG;
  -
  -		hr = wrapNode(m_pIXMLDOMDocument,m_container.item(index),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
  +		//
  +		//    if index is beyond end
  +		//       return a null object not an exception
  +		//
  +		if (index < length)
  +			hr = wrapNode(m_pIXMLDOMDocument,m_container.item(index),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal));
   	}
   	catch(...)
   	{
  
  
  
  1.4       +47 -15    xml-xerces/c/src/com/XMLDOMUtil.cpp
  
  Index: XMLDOMUtil.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/XMLDOMUtil.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLDOMUtil.cpp	2000/06/03 00:29:02	1.3
  +++ XMLDOMUtil.cpp	2000/06/19 20:05:59	1.4
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: XMLDOMUtil.cpp,v $
  + * Revision 1.4  2000/06/19 20:05:59  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.3  2000/06/03 00:29:02  andyh
    * COM Wrapper changes from Curt Arnold
    *
  @@ -78,28 +82,29 @@
   #include "XMLDOMDocumentType.h"
   #include "XMLDOMDocumentFragment.h"
   #include "XMLDOMNotation.h"
  +#include "XMLDOMXMLDecl.h"
   #include "XMLDOMUtil.h"
   #include <util/PlatformUtils.hpp>
   
   
  -const TCHAR* g_DomNodeName[] = 
  +const OLECHAR* g_DomNodeName[] = 
   {	
  -	_T("invalid"),
  -	_T("element"),
  -	_T("attribute"),
  -	_T("text"),
  -	_T("cdatasection"),
  -	_T("entityreference"),
  -	_T("entity"),
  -	_T("processinginstruction"),
  -	_T("comment"),
  -	_T("document"),
  -	_T("documenttype"),
  -	_T("documentfragment"),
  -	_T("notation")
  +	OLESTR("invalid"),
  +	OLESTR("element"),
  +	OLESTR("attribute"),
  +	OLESTR("text"),
  +	OLESTR("cdatasection"),
  +	OLESTR("entityreference"),
  +	OLESTR("entity"),
  +	OLESTR("processinginstruction"),
  +	OLESTR("comment"),
  +	OLESTR("document"),
  +	OLESTR("documenttype"),
  +	OLESTR("documentfragment"),
  +	OLESTR("notation")
   };
    
  -const int g_DomNodeNameSize = sizeof(g_DomNodeName) / sizeof(TCHAR*);
  +const int g_DomNodeNameSize = sizeof(g_DomNodeName) / sizeof(OLECHAR*);
   
   void GetText(const DOM_Node& node, _bstr_t &text)
   {
  @@ -637,6 +642,34 @@
   		try
   		{
   			pObj->notation = *(static_cast<DOM_Notation*> (&node));
  +		}
  +		catch(...)
  +		{
  +			pObj->Release(); 
  +			return E_FAIL;
  +		}
  +	
  +		hr = pObj->QueryInterface(iid, pVal);
  +		if (S_OK != hr) 
  +			*pVal = NULL;
  +
  +		pObj->Release();
  +		break;
  +	}
  +
  +	case DOM_Node::XML_DECL_NODE:
  +	{
  +		CXMLDOMXMLDeclObj *pObj = NULL;
  +		hr = CXMLDOMXMLDeclObj::CreateInstance(&pObj);
  +		if (S_OK != hr) 
  +			return hr;
  +	
  +		pObj->AddRef();
  +		pObj->SetOwnerDoc(pDoc);
  +
  +		try
  +		{
  +			pObj->xmlDecl = *(static_cast<DOM_XMLDecl*> (&node));
   		}
   		catch(...)
   		{
  
  
  
  1.4       +4 -1      xml-xerces/c/src/com/XMLDOMUtil.h
  
  Index: XMLDOMUtil.h
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/XMLDOMUtil.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLDOMUtil.h	2000/06/03 00:29:03	1.3
  +++ XMLDOMUtil.h	2000/06/19 20:05:59	1.4
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: XMLDOMUtil.h,v $
  + * Revision 1.4  2000/06/19 20:05:59  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.3  2000/06/03 00:29:03  andyh
    * COM Wrapper changes from Curt Arnold
    *
  @@ -69,7 +73,7 @@
   
   class DOM_Node;
   
  -extern const TCHAR* g_DomNodeName[];
  +extern const OLECHAR* g_DomNodeName[];
   extern const int	g_DomNodeNameSize;
   
   void GetXML (const DOM_Node &node, _bstr_t &text);
  
  
  
  1.4       +99 -9     xml-xerces/c/src/com/xml4com.cpp
  
  Index: xml4com.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/xml4com.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- xml4com.cpp	2000/06/03 00:29:04	1.3
  +++ xml4com.cpp	2000/06/19 20:05:59	1.4
  @@ -56,6 +56,10 @@
   
   /*
    * $Log: xml4com.cpp,v $
  + * Revision 1.4  2000/06/19 20:05:59  rahulj
  + * Changes for increased conformance and stability. Submitted by
  + * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
  + *
    * Revision 1.3  2000/06/03 00:29:04  andyh
    * COM Wrapper changes from Curt Arnold
    *
  @@ -93,17 +97,104 @@
   #include <util/PlatformUtils.hpp>
   #include "xml4com.h"
   
  +
   //
  -//   This file is generated from the type library compilation
  -//       of xmldom.idl
   //
  -//   The define prevent the Microsoft versions of DOMDocument
  -//      and HTTPRequest from causing symbol clashes with ours
  -#define CLSID_DOMDocument CLSID_MSDOMDocument
  -#define CLSID_XMLHTTPRequest CLSID_MSXMLHTTPRequest
  -#include "msxml_i.c"
  -#undef CLSID_DOMDocument
  -#undef CLSID_XMLHTTPRequest
  +//    These were extracted from an identifier definition file
  +//       generated by compiling MSXML.IDL using the MIDL compiler
  +//        (and removing CLSID_DOMDocument, CLSID_XMLHttpRequest, et al)
  +//
  +const IID LIBID_MSXML = {0xd63e0ce2,0xa0a2,0x11d0,{0x9c,0x02,0x00,0xc0,0x4f,0xc9,0x9c,0x8e}};
  +
  +
  +const IID IID_IXMLDOMImplementation = {0x2933BF8F,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMNode = {0x2933BF80,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMDocumentFragment = {0x3efaa413,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}};
  +
  +
  +const IID IID_IXMLDOMDocument = {0x2933BF81,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMNodeList = {0x2933BF82,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMNamedNodeMap = {0x2933BF83,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMCharacterData = {0x2933BF84,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMAttribute = {0x2933BF85,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMElement = {0x2933BF86,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMText = {0x2933BF87,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMComment = {0x2933BF88,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMProcessingInstruction = {0x2933BF89,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMCDATASection = {0x2933BF8A,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMDocumentType = {0x2933BF8B,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMNotation = {0x2933BF8C,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMEntity = {0x2933BF8D,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMEntityReference = {0x2933BF8E,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}};
  +
  +
  +const IID IID_IXMLDOMParseError = {0x3efaa426,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}};
  +
  +
  +const IID IID_IXTLRuntime = {0x3efaa425,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}};
  +
  +
  +const IID DIID_XMLDOMDocumentEvents = {0x3efaa427,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}};
  +
  +
  +
  +const IID IID_IXMLHttpRequest = {0xED8C108D,0x4349,0x11D2,{0x91,0xA4,0x00,0xC0,0x4F,0x79,0x69,0xE8}};
  +
  +
  +const IID IID_IXMLDSOControl = {0x310afa62,0x0575,0x11d2,{0x9c,0xa9,0x00,0x60,0xb0,0xec,0x3d,0x39}};
  +
  +
  +const IID IID_IXMLElementCollection = {0x65725580,0x9B5D,0x11d0,{0x9B,0xFE,0x00,0xC0,0x4F,0xC9,0x9C,0x8E}};
  +
  +
  +const IID IID_IXMLDocument = {0xF52E2B61,0x18A1,0x11d1,{0xB1,0x05,0x00,0x80,0x5F,0x49,0x91,0x6B}};
  +
  +
  +const IID IID_IXMLDocument2 = {0x2B8DE2FE,0x8D2D,0x11d1,{0xB2,0xFC,0x00,0xC0,0x4F,0xD9,0x15,0xA9}};
  +
  +
  +const IID IID_IXMLElement = {0x3F7F31AC,0xE15F,0x11d0,{0x9C,0x25,0x00,0xC0,0x4F,0xC9,0x9C,0x8E}};
  +
  +
  +const IID IID_IXMLElement2 = {0x2B8DE2FF,0x8D2D,0x11d1,{0xB2,0xFC,0x00,0xC0,0x4F,0xD9,0x15,0xA9}};
  +
  +
  +const IID IID_IXMLAttribute = {0xD4D4A0FC,0x3B73,0x11d1,{0xB2,0xB4,0x00,0xC0,0x4F,0xB9,0x25,0x96}};
  +
  +
  +const IID IID_IXMLError = {0x948C5AD3,0xC58D,0x11d0,{0x9C,0x0B,0x00,0xC0,0x4F,0xC9,0x9C,0x8E}};
  +
  +
   
   //
   //   This file is generated from the type library compilation
  
  
  
  1.3       +31 -0     xml-xerces/c/src/com/xml4com.idl
  
  Index: xml4com.idl
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/xml4com.idl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- xml4com.idl	2000/06/03 00:29:05	1.2
  +++ xml4com.idl	2000/06/19 20:05:59	1.3
  @@ -74,7 +74,38 @@
   	importlib("stdole32.tlb");
   	importlib("stdole2.tlb");
   
  +	//
  +	//   it appears to be necessary to forward declare
  +	//      this interface to lure it into the type library
  +	interface IXMLDOMNotation;
   
  +	//
  +	//   might as well insure the rest we use are here
  +	//
  +	interface IXMLDOMAttribute;
  +	interface IXMLDOMCDATASection;
  +	interface IXMLDOMComment;
  +	interface IXMLDOMDocument;
  +	interface IXMLDOMDocumentType;
  +	interface IXMLDOMElement;
  +	interface IXMLDOMEntity;
  +	interface IXMLDOMEntityReference;
  +	interface IXMLDOMImplementation;
  +	interface IXMLDOMNamedNodeMap;
  +	interface IXMLDOMNodeList;
  +	interface IXMLDOMParseError;
  +	interface IXMLDOMProcessingInstruction;
  +	interface IXMLDOMText;
  +	interface IXMLHttpRequest;
  +
  +
  +	//
  +	//
  +	//    if you get an "Cannot open input file" error here
  +	//       then you most probably do not have a recent 
  +	//        Microsoft Platform SDK in your include path
  +	//
  +	//    See http://xml.apache.org/xerces-c/build.html#BuildCOM
   	import "xmldom.idl";
   	
   	[
  
  
  
  1.2       +6 -6      xml-xerces/c/src/com/xmldocument.rgs
  
  Index: xmldocument.rgs
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/xmldocument.rgs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- xmldocument.rgs	2000/03/10 22:45:40	1.1
  +++ xmldocument.rgs	2000/06/19 20:06:00	1.2
  @@ -1,20 +1,20 @@
   HKCR
   {
  -	IBMXML.XMLDOMDocument.1 = s 'IBM XML Parser for COM Class'
  +	Xerces.DOMDocument.1.2 = s 'Apache Xerces Parser for COM'
   	{
   		CLSID = s '{79516F6F-3AEA-11D3-BC47-0004ACB7DBEB}'
   	}
  -	IBMXML.XMLDOMDocument = s 'IBM XML Parser for COM Class'
  +	Xerces.DOMDocument = s 'Apache Xerces Parser For COM'
   	{
   		CLSID = s '{79516F6F-3AEA-11D3-BC47-0004ACB7DBEB}'
  -		CurVer = s 'IBMXML.XMLDOMDocument.1'
  +		CurVer = s 'Xerces.DOMDocument.1.2'
   	}
   	NoRemove CLSID
   	{
  -		ForceRemove {79516F6F-3AEA-11D3-BC47-0004ACB7DBEB} = s 'IBM XML Parser for COM Class'
  +		ForceRemove {79516F6F-3AEA-11D3-BC47-0004ACB7DBEB} = s 'Apache Xerces Parser for COM'
   		{
  -			ProgID = s 'IBMXML.XMLDOMDocument.1'
  -			VersionIndependentProgID = s 'IBMXML.XMLDOMDocument'
  +			ProgID = s 'Xerces.DOMDocument.1.2'
  +			VersionIndependentProgID = s 'Xerces.DOMDocument'
   			ForceRemove 'Programmable'
   			InprocServer32 = s '%XMLMODULE%'
   			{
  
  
  
  1.2       +6 -6      xml-xerces/c/src/com/xmlhttprequest.rgs
  
  Index: xmlhttprequest.rgs
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/com/xmlhttprequest.rgs,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- xmlhttprequest.rgs	2000/03/10 22:45:41	1.1
  +++ xmlhttprequest.rgs	2000/06/19 20:06:00	1.2
  @@ -1,20 +1,20 @@
   HKCR
   {
  -	IBMXML.XMLHttpRequest.1 = s 'IBM XML Http Request'
  +	IBMXML.XMLHttpRequest.1.2 = s 'Apache Xerces XML Http Request'
   	{
   		CLSID = s '{1C598E82-9AB9-456b-9C24-D711F08F3584}'
   	}
  -	IBMXML.XMLHttpRequest = s 'IBM XML Http Request'
  +	IBMXML.XMLHttpRequest = s 'Apache Xerces XML Http Request'
   	{
   		CLSID = s '{1C598E82-9AB9-456b-9C24-D711F08F3584}'
  -		CurVer = s 'IBMXML.XMLHttpRequest.1'
  +		CurVer = s 'Xerces.XMLHttpRequest.1.2'
   	}
   	NoRemove CLSID
   	{
  -		ForceRemove {1C598E82-9AB9-456b-9C24-D711F08F3584} = s 'IBM XML Http Request'
  +		ForceRemove {1C598E82-9AB9-456b-9C24-D711F08F3584} = s 'Apache Xerces XML Http Request'
   		{
  -			ProgID = s 'IBMXML.XMLHttpRequest.1'
  -			VersionIndependentProgID = s 'IBMXML.XMLHttpRequest'
  +			ProgID = s 'Xerces.XMLHttpRequest.1.2'
  +			VersionIndependentProgID = s 'Xerces.XMLHttpRequest'
   			ForceRemove 'Programmable'
   			InprocServer32 = s '%XMLMODULE%'
   			{
  
  
  
  1.1                  xml-xerces/c/src/com/XMLDOMXMLDecl.cpp
  
  Index: XMLDOMXMLDecl.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   * 
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
   * reserved.
   * 
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   * 
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   * 
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   * 
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   * 
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache\@apache.org.
   * 
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   * 
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation, and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com .  For more information
   * on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  
  #include "stdafx.h"
  #include "xml4com.h"
  #include "XMLDOMXMLDecl.h"
  
  // IXMLDOMProcessingInstruction methods
  STDMETHODIMP CXMLDOMXMLDecl::get_target(BSTR  *pVal)
  {
  	ATLTRACE(_T("CXMLDOMXMLDecl::get_target\n"));
  
  	if (NULL == pVal)
  		return E_POINTER;
  
  	*pVal = NULL;
  
  	try
  	{
  		*pVal = SysAllocString(OLESTR("xml"));
  	}
  	catch(...)
  	{
  		return E_FAIL;
  	}
  
  	return S_OK;
  }
  
  STDMETHODIMP CXMLDOMXMLDecl::get_data(BSTR  *pVal)
  {
  	ATLTRACE(_T("CXMLDOMXMLDecl::get_data\n"));
  
  	if (NULL == pVal)
  		return E_POINTER;
  
  	*pVal = NULL;
  
  	try
  	{
  		unsigned int len= 0;
  		unsigned int totalLen = 0;
  		DOMString version(xmlDecl.getVersion());
  		len = version.length();
  		if(len > 0) totalLen = len + 10;
  
  		DOMString standalone(xmlDecl.getStandalone());
  		len = standalone.length();
  		if(len > 0) {
  			if(totalLen > 0) 
  				totalLen += len + 14;
  			else
  				totalLen = len + 13;
  		}
  
  		DOMString encoding(xmlDecl.getEncoding());
  		len = encoding.length();
  		if(len > 0) {
  			if(totalLen > 0)
  				totalLen += len + 13;
  			else
  				totalLen = len + 12;
  		}
  
  		*pVal = SysAllocStringLen(NULL,totalLen+1);
  		**pVal = 0;
  
  		len = version.length();
  		totalLen = len;
  		if(len > 0) {
  			wcscpy(*pVal,OLESTR("version=\""));
  			wcscat(*pVal,version.rawBuffer());
  			wcscat(*pVal,OLESTR("\""));
  		}
  
  		len = standalone.length();
  		if(len > 0) {
  			if(totalLen > 0)
  				wcscat(*pVal,OLESTR(" standalone=\""));
  			else
  				wcscat(*pVal,OLESTR("standalone=\""));
  			wcscat(*pVal,standalone.rawBuffer());
  			wcscat(*pVal,OLESTR("\""));
  			totalLen += len;
  		}
  
  		len = encoding.length();
  		if(len > 0) {
  			if(totalLen > 0)
  				wcscat(*pVal,OLESTR(" encoding=\""));
  			else
  				wcscat(*pVal,OLESTR("encoding=\""));
  			wcscat(*pVal,encoding.rawBuffer());
  			wcscat(*pVal,OLESTR("\""));
  		}
  
  	}
  	catch(...)
  	{
  		return E_FAIL;
  	}
  
  	return S_OK;
  
  }
  
  STDMETHODIMP CXMLDOMXMLDecl::put_data(BSTR newVal)
  {
  	ATLTRACE(_T("CXMLDOMXMLDecl::put_data\n"));
  
  	return E_NOTIMPL;
  }
  
  
  
  1.1                  xml-xerces/c/src/com/XMLDOMXMLDecl.h
  
  Index: XMLDOMXMLDecl.h
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   * 
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
   * reserved.
   * 
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   * 
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   * 
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   * 
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   * 
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache\@apache.org.
   * 
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   * 
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation, and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com .  For more information
   * on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  
  #ifndef ___xmldomxmldecl_h___
  #define ___xmldomxmldecl_h___
  
  #include <dom/DOM_XMLDecl.hpp>
  #include "IXMLDOMNodeImpl.h"
  
  class ATL_NO_VTABLE CXMLDOMXMLDecl : 
  	public CComObjectRootEx<CComSingleThreadModel>,
  	public IXMLDOMNodeImpl<IXMLDOMProcessingInstruction, &IID_IXMLDOMProcessingInstruction, &LIBID_Xerces>
  {
  public:
  	CXMLDOMXMLDecl()
  	{}
  	
  	void	FinalRelease()
  	{
  		ReleaseOwnerDoc();
  	}
  
  	virtual DOM_Node& get_DOM_Node()			 { return xmlDecl;} 
  	virtual DOMNodeType get_DOMNodeType() const  { return NODE_PROCESSING_INSTRUCTION; }
  
  DECLARE_NOT_AGGREGATABLE(CXMLDOMXMLDecl)
  DECLARE_PROTECT_FINAL_CONSTRUCT()
  
  BEGIN_COM_MAP(CXMLDOMXMLDecl)
  	COM_INTERFACE_ENTRY(IXMLDOMProcessingInstruction)
  	COM_INTERFACE_ENTRY(IXMLDOMNode)
  	COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity)
  	COM_INTERFACE_ENTRY(IDispatch)
  END_COM_MAP()
  
  	// IXMLDOMProcessingInstruction methods
  	STDMETHOD(get_target)(BSTR  *pVal);
  	STDMETHOD(get_data)(BSTR  *pVal);
  	STDMETHOD(put_data)(BSTR newVal);
  
  	DOM_XMLDecl xmlDecl;
  };
  
  typedef CComObject<CXMLDOMXMLDecl> CXMLDOMXMLDeclObj;
  
  #endif // ___xmldomprocessinginstruction_h___