⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmldomattribute.cpp

📁 IBM的解析xml的工具Xerces的源代码
💻 CPP
字号:
/* * Copyright 1999-2001,2004 The Apache Software Foundation. *  * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *  *      http://www.apache.org/licenses/LICENSE-2.0 *  * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *//* * $Id: XMLDOMAttribute.cpp,v 1.3 2004/09/08 13:55:35 peiyongz Exp $ */#include "stdafx.h"#include "xml4com.h"#include "XMLDOMAttribute.h"// IXMLDOMAttribute methodsSTDMETHODIMP CXMLDOMAttribute::get_name(BSTR  *pVal){	ATLTRACE(_T("CXMLDOMAttribute::get_name\n"));	if (NULL == pVal)		return E_POINTER;	try	{		*pVal = SysAllocString(attr->getName());	}	catch(DOMException& ex) {		return MakeHRESULT(ex);	}	catch(...)	{		return E_FAIL;	}		return S_OK;}STDMETHODIMP CXMLDOMAttribute::get_value(VARIANT  *pVal){	ATLTRACE(_T("CXMLDOMAttribute::get_value\n"));	if (NULL == pVal)		return E_POINTER;	::VariantInit(pVal);	try	{		V_VT(pVal)   = VT_BSTR;		V_BSTR(pVal) = SysAllocString(attr->getValue());	}	catch(DOMException& ex) {		return MakeHRESULT(ex);	}	catch(...)	{		return E_FAIL;	}	return S_OK;}STDMETHODIMP CXMLDOMAttribute::put_value(VARIANT newVal){	ATLTRACE(_T("CXMLDOMAttribute::put_value\n"));	try	{		if(V_VT(&newVal) == VT_BSTR) {			attr->setValue(V_BSTR(&newVal));		}		else {			attr->setValue((BSTR) (_bstr_t) newVal);		}		attr->setValue(V_BSTR(&newVal));	}	catch(DOMException& ex) {		return MakeHRESULT(ex);	}	catch(...)	{		return E_FAIL;	}		return S_OK;}	//  IXMLDOMNode methodSTDMETHODIMP CXMLDOMAttribute::get_specified(VARIANT_BOOL  *pVal){	ATLTRACE(_T("CXMLDOMAttribute::get_specified\n"));	try	{		*pVal = attr->getSpecified() ? VARIANT_TRUE : VARIANT_FALSE;	}	catch(DOMException& ex) {		return MakeHRESULT(ex);	}	catch(...)	{		return E_FAIL;	}		return S_OK;}STDMETHODIMP CXMLDOMAttribute::get_nodeValue(VARIANT  *pVal){	ATLTRACE(_T("CXMLDOMAttribute::get_nodeValue\n"));	if (NULL == pVal)		return E_POINTER;	::VariantInit(pVal);	try	{		V_VT(pVal)   = VT_BSTR;		V_BSTR(pVal) = SysAllocString(attr->getValue());	}	catch(DOMException& ex) {		return MakeHRESULT(ex);	}	catch(...)	{		return E_FAIL;	}	return S_OK;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -