Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: MSXML and Whitespace

From: wdhough@-----------.---------.---
To: NULL
Date: 7/10/2006 1:13:00 AM

No

"Anthony Jones" wrote:

> 
> "wdhough" <wdhough@d...> wrote in message
> news:4AA8D5DC-909E-42A5-874B-2885E0387CD1@m......
> > Hi,
> >
> > I have problems inserting whitespace into my xml document. I have the
> > following code.
> >
> > //init com for this thread
> > CoInitialize(NULL);
> >
> > //create an instance of it
> > HRESULT hr = doc_ptr.CreateInstance(_uuidof(MSXML2:OMDocument60));
> > if (FAILED(hr))
> > {
> > MessageBeep(0);
> > CoUninitialize();
> > return;
> > }
> > doc_ptr->async = VARIANT_FALSE;
> > HRESULT res = doc_ptr->put_preserveWhiteSpace(TRUE);
> > //
> > MSXML2::IXMLDOMDocument3::createDocumentFragment();
> > ///
> > MSXML2::IXMLDOMProcessingInstructionPtr pPI = NULL;
> > //doc_ptr->preserveWhiteSpace = TRUE;
> > pPI = doc_ptr->createProcessingInstruction
> > ("xml", "version='1.0' encoding='UTF-8'");
> >
> > _variant_t vNullVal;
> > vNullVal.vt = VT_NULL;
> > doc_ptr->insertBefore(pPI, vNullVal);
> >
> > ///
> > //Create document element.
> > MSXML2::IXMLDOMNodePtr pRootNode= NULL;
> > _variant_t varNodeType((short)MSXML2::NODE_ELEMENT);
> >
> > //create a node, whos name should be the document element name
> > CString str;
> > str.LoadString(IDS_XML_DOC_ELEM);
> > pRootNode= doc_ptr->createNode(varNodeType,
> > ((LPCTSTR)str),_T(""));
> > doc_ptr->appendChild(pRootNode);
> > //this part adds a node under neath the root with some text as its value
> but
> > the spacing gets cut off at the end.
> > MSXML2::IXMLDOMNodePtr temp;
> > temp = NULL;
> > str.LoadString(IDS_XML_NODE_NAME);
> > temp = doc_ptr->createNode(varNodeType,(LPCTSTR)str,_T(""));
> > temp->nodeTypedValue = _T("this is a test of spacing ");
> > pRootNode->appendChild(temp);
> >
> > The problem is the white space is removed from the temp node.
> >
> > any ideas please
> >
> 
> The problem with C/C++ code is that it's often difficult to see what the
> problem might be due to all the textual overhead in the code.  Can you
> reproduce the problem with a VBScript and post that instead?
> 
> 
> 
> 
> 


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent