LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVIXML to string

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.

 

George Zou
0 Kudos
Message 1 of 6
(3,911 Views)

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()

0 Kudos
Message 2 of 6
(3,876 Views)

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>

...

 

 

 

George Zou
0 Kudos
Message 3 of 6
(3,872 Views)

You can use the MSXML DOM functions to do this as follows:

 

CVIXMLLoadDocument (path, &doc);
CVIXMLGetDocumentActiveXHandle (doc, &axH);
MSXML_IXMLDOMDocumentGetxml (axH, NULL, &xml);

0 Kudos
Message 4 of 6
(3,865 Views)

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.

 

George Zou
0 Kudos
Message 5 of 6
(3,848 Views)

Any help for the format?

 

George Zou
0 Kudos
Message 6 of 6
(3,799 Views)