LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Are the CVIXML functions going to be updated for MSXML 4.0?

The CVIXML functions are excellent for removing the complexity of creating an XML file. However, these are based on Microsoft XML Version 2.0. Are there plans to upgrade these functions for version 4.0, in a later version of CVI? (I know I can easily create a .fp file for Microsoft XML version 4.0, but I'd prefer to use simpler functions, like in the existing CVIXML function panel.)
 
Thanks,
 
Brian
0 Kudos
Message 1 of 8
(3,971 Views)
Brian,

Unfortunately no information has been given out as to what exactly will be in the next update/version of CVI.

However NI does try it's best to keep up to date with other software standards and interfaces, if possible.

I have made a product suggestion these are often picked up by the R&D department.

Sorry for being so vague but rules are rules!

AdamB
National Instruments
Applications Engineering Team Leader | National Instruments | UK & Ireland
0 Kudos
Message 2 of 8
(3,946 Views)

The CVI XML functions are written on-top-of the Microsoft XML DOM parser (MSXML) using ActiveX. Based on ActiveX versioning rules, the CVI XML calls should end up going to the latest MSXML ActiveX components on your system. But if you are looking for some MSXML 4.0 related features to be added to the CVI XML functions, then that would require a rewrite of the CVI functions and changes in the API - if you have any particular feature in mind, please let NI know about this.

0 Kudos
Message 3 of 8
(3,941 Views)

And as Mohan said, if you want specific functionality added to the CVI XML calls, you can make a product suggestion on the following site.

Thanks

0 Kudos
Message 4 of 8
(3,932 Views)

Thanks for the information.

The link http://forums.ni.com/ni/board/message?board.id=180&message.id=8406&requireLogin=False was why I assumed it was MSXML 2.0 only.

The current CVIXML API doesn't cater for stylesheets, so I've put in a suggestion for that.

On a separate point.

I want to insert a namespace xmlns declaration into my root element of an XML document. However, all children

are getting xmlns="" inserted in their elements.

( The problem is better described in the MSDN article at http://support.microsoft.com/default.aspx?scid=kb;en-us;828928 )

Is there any way of getting round this with the CVIXML libraries?

It seems to me that to get the root element I have to create a document, but I need to set this xmlns attribute before creating the document, (A bit of a catch-22 situation!)

Maybe I'm doing something wrong, but any advice would be appreciated!

Regards,

Brian

 

0 Kudos
Message 5 of 8
(3,920 Views)
Yes, the external KB you are referring sounds convoluted, but what I think they mean is as follows:
You cannot change, add, delete a xmlns attribute with MSXML 4.0. You should specify this in the createNode DOM methods.
 
The cvixml implementation (see CVIXMLNewDocument and CVIXMLNewElement in toolslib/toolbox/cvixml.c) uses createElement and so DOM places new elements in the empty namespace (should it not place it in the parent's namespace???). To workaround this, you can modify the CVIXMLNewDocument and CVIXMLNewElement functions to use MSXML_IXMLDOMDocumentcreateNode instead of MSXML_IXMLDOMDocumentcreateElement. You supply the namespace to the createNode call instead of adding it as an attribute later. The usage would be as follows:
 
CVIXMLStatus CVIFUNC CVIXMLNewDocument2 (const char *rootElementName,
 const char * namespaceURI, CVIXMLDocument *doc);
CVIXMLStatus CVIFUNC CVIXMLNewElement2 (CVIXMLElement parent, int index,
 const char *tag, const char * namespaceURI, CVIXMLElement *elem);
 
void Test2(void)
{
 CVIXMLElement child;
 CVIXMLElement root;
 CVIXMLDocument doc;
 
#if OLD
 CVIXMLNewDocument("root", &doc);
 CVIXMLGetRootElement(doc, &root);
 CVIXMLAddAttribute(root, "xmlns", "x-schema:myschema");
 CVIXMLNewElement(root, -1, "child", &child);
#else
 CVIXMLNewDocument2("root", "x-schema:myschema", &doc);
 CVIXMLGetRootElement(doc, &root);
 CVIXMLNewElement2(root, -1, "child", "x-schema:myschema", &child);
#endif
 
 CVIXMLSaveDocument(doc, 1, "c:\\temp\\cvi\\test2.xml");
 CVIXMLDiscardElement(child);
 CVIXMLDiscardElement(root);
 CVIXMLDiscardDocument(doc);
}
 
I am attaching a modified version of cvixml.c that has CVIXMLNewDocument2 and CVIXMLNewElement2 functions that has these functions. Note that if you already have some XML that you want to load and change/add xmlns, then it seems like you cannot do this "in-place". But I guess you should be able to make a deep copy of the XML into a new XML document - might be easier to just hand-edit the XML and add xmlns.
 
- Mohan
Message 6 of 8
(3,904 Views)
Mohan,
 
Thanks for taking the time out to provide a very comprehensive answer to the problem. I really appreciate you taking the time out to look at this.
 
Excellent
0 Kudos
Message 7 of 8
(3,890 Views)

Hi Mohan,

 

Could you please provide the header file as well? I looking for xml parser urgently but my current version does not have cvixml.fp at all. I tried program with MSXML4.0 but it was too difficult to me as a beginner. Appreciate if you can help me out.

Thank you very much.

 

Regards,
MC

0 Kudos
Message 8 of 8
(3,020 Views)