10-23-2010 10:46 PM
How do I flatten a CVIXML object to a string?
I don't want to write to a file. I just want to pass the string to the caller (in C#).
TIA.
10-25-2010 09:16 AM
George:
I'm not sure exactly what you want to do, but have you looked at the functions in toolslib\toolbox\cvixml.fp?
Maybe one or more of the following functions may help: CVIXMLGetElementTag(), CVIXMLGetElementValue(), CVIXMLGetAttributeName(), CVIXMLGetAttributeValue()
10-25-2010 09:45 AM
Al,
Thanks for reply.
Yes. I have looked functions in cvixml.fp.
All the functions you listed are get inforamtion from the cviobj.
I am looking for a function to flattern cviobj to a string. e.g. :
<Outputs>
<Voltage>5.0</Voltage>
<Phase>0.0</Phase>
</Outputs>
...
10-25-2010 10:08 AM
You can use the MSXML DOM functions to do this as follows:
CVIXMLLoadDocument (path, &doc);
CVIXMLGetDocumentActiveXHandle (doc, &axH);
MSXML_IXMLDOMDocumentGetxml (axH, NULL, &xml);
10-25-2010 01:16 PM - edited 10-25-2010 01:22 PM
Thanks Mohan.
It works. However, instead of:
<Outputs>
<Voltage>5.0</Voltage>
<Phase>0.0</Phase>
</Outputs>
it looks like this:
<Outputs><Voltage>5.0</Voltage><Phase>0.0</Phase></Outputs>
Only happens for the new created elements. Not problem for the existing (input) elements.
And when save to a file, no problem.
10-27-2010 10:11 AM
Any help for the format?