void addTextAttributeToNode(MSXML2::IXMLDOMDocumentPtr& xmlDoc, MSXML2::IXMLDOMNodePtr& targetNode, const String& attributeName, const String& attributeValue) { MSXML2::IXMLDOMNodePtr attributeNode = xmlDoc->createNode(NODE_ATTRIBUTE, attributeName.c_str(), _T("")); setNodeText(attributeNode, attributeValue); MSXML2::IXMLDOMNamedNodeMapPtr attributes = targetNode->Getattributes(); if (attributes == NULL) { throw XMLUtils::ParseError(); } attributes->setNamedItem(attributeNode); }
void CXmlNodeWrapper::SetValue(LPCTSTR valueName,LPCTSTR value) { MSXML2::IXMLDOMDocumentPtr xmlDocument = m_xmlnode->GetownerDocument(); if (xmlDocument) { MSXML2::IXMLDOMNamedNodeMapPtr attributes = m_xmlnode->Getattributes(); if (attributes) { MSXML2::IXMLDOMAttributePtr attribute = xmlDocument->createAttribute(valueName); if (attribute) { attribute->Puttext(value); attributes->setNamedItem(attribute); } } } }