Hi All,
I am developing my company application using VS2003 C++ with Win32 SDK /ALT/STL. The application uses MSXML 6.0 to create/read/write XML document to/from XML file. I ran into two problems described below:
1. The application adds whitespace to the XML document so that if the XML document is opened with text editor such as Notepad, children node will be indented, making it easier for user to read the document. However, the weird thing is that the XML file is only indented with debug version. If the application is compiled with release mode, XML file is not indented (I am sure there is no #ifdef _DEBUG around the code block that adds whitespace to the document)
2. I cannot remove an attribute from a node. I tried both removeAttribute() and removeAttributeNode() methods, but none is working. Below is the code:
BSTR bstrName = SysAllocString(L"FSecure");
if(bstrName)
{
IXMLDOMAttribute* pAttrNode = NULL;
IXMLDOMAttribute* pAttrRemove = NULL;
// xmlNode->m_pDOMElement->removeAttribute(bstrName);
xmlNode->m_pDOMElement->getAttributeNode(bstrName,&pAttrNode);
if(pAttrNode)
{
xmlNode->m_pDOMElement->removeAttributeNode(pAttrNode,&pAttrRemove);
pAttrNode->Release();
}
SysFreeString(bstrName);
}
Any comments Thanks in advance.
.NET Development4
|