LabWindows/CVI Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Al.B

Modify CVI XML Library To Allow XML To Be Loaded From a String

Currently, it is only possible to load XML for parsing from an xml file.  In order to load xml data from a string, it is necessary to either write to a temporary file, or use the MSXML library directly.  It would be fairly simple to modify the CVIXMLLoadDocument() Function (or create a new function) which uses the MSXML IXMLDOMDocumentloadXML() function, which allows loading XML directly from a string. 

 

Adding this code to the current function after the IXMLDOMDocumentload() function would improve the CVIXMLLoadDocument() function so that it tries opening the input string as direct XML if it is not a path (Replaces line 167):

 

__caErrChk(MSXML_IXMLDOMDocumentload(xmlHdl, NULL, variantPath, &success));
	 
	if(!success) //if loading as a path fails, try reading as direct XML code
    {
        __caErrChk(MSXML_IXMLDOMDocumentloadXML(xmlHdl, NULL, fullPath, &success));    
    }
Al B.
Staff Software Engineer - TestStand
CTA/CLD
2 Comments
silmaril
Member

Good idea! Kudos!

But I strongly recommend creating a new function instead of messing up the existing ones by adding unintuitive functionality.

 

 

 

 

JonathanN
NI Employee (retired)
Status changed to: Under Consideration
 
Jonathan N.
National Instruments