Community Documents

Showing results for 
Search instead for 
Did you mean: 

Use inbuilt LabVIEW XML functions to read (Vector) CANdela .cdd diagnostics database file

Contestant Info:

User Group Affiliation:
Melbourne LabVIEW User Group
Large LabVIEW Application Development
UI Interest Group
DIY LabVIEW Crew           

I've seen people complaining a few times in the forums that LabVIEW's inbuilt XML functions aren't very user friendly etc. Well here is an example of what can be done with them.

The methods used in extracting data from an XML document are what new users may find educational.

A Vector CANdela Studio database file contains all the diagnostic information for a given Automotive Electronic Control Unit (ECU).

My main usage for this vi is to extract UDS (ISO 14229 / ISO 15765) diagnostic information for use in automated testing. It may need some tweaking for other protocols.

If you want to use that information in a test application it can be quite tricky to extract.

There can be some very complex structures defined for datatypes etc.

This example demonstrates how you can use inbuilt LabVIEW XML functions to read all sorts of information no matter how deeply it is buried in an XML document.

This VI (and subvis) read a complex (and potentially quite large) XML file and output it's useful contents in a format that can be used by your software.


The main vi is a state machine that traverses through the relevant xml nodes creating an array of relevant nodes which are then used by subvis to extract the desired data.

The most complex subvi is the one that extracts DIDs (Data by Identifier) and information on how to extract signals from the data they return.

DIDs (can) contain complex structures with 'c' type UNIONs and STRUCTs.

The vi grabs all the subsignals defined for a DID and builds an array of signal references.

When reading a DID an array of bytes is returned. Data is extracted from the byte array according to the DID structure definition. Each STRUCT can contain STRUCTs UNIONs DATAOBJects and something called a GAPDATAOBJect.

The signal references created by this vi treat the byte array as one continuous bitstream.

Therefore each DID contains an array of signals. Each signal has a name, a startbit and a length.

Steps to execute code:

  1. Open the vi
  2. On the front panel, Select the CAN ID type your device uses (Leave default for example file provided)
  3. Input the names of the DID Classes you need extracted (Leave default for example file provided)
  4. Input the names of the diagnostic Client and Server IDs or input 0x prefixed CAN IDs  (Leave default for example file provided)
  5. Select a CANdela .cdd database file (sample provided)
  6. Hit run.

It will then extract the DIDs, Datatypes and Diagnostic Trouble codes from the .cdd database file.

The results displayed on the front panel may not look all that exciting unless you've tried to do automated diagnostics on CAN.



Main Block Diagram:

Any suggestions on improvement are welcome.

VI attached below (Updated July 19, 2011)

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Download All
NI Employee (retired)


            Could you pick one of the physical user groups from the template to choose as your affiliation? Unfortunately virtual groups don't count in this challenge. If there is not a user group close to you then please just pick your favorite from the list. Thanks!


Hi, Troy


I have loaded FORMULADT type by adding it in the value type enum, but without any formula information.

I have found there is a childnode's name as "Formula" but It seems that there is no formula information I could acquire from the node. I could only check "Node name: usage & Node value : coded2Phys."


May I ask you how could I get the formula information from the child node?


Many thanks,

Suhwan Kim



Active Participant
Active Participant
Hello ShawnKim, I have not used that version of the cdd parsing code for many years. Nor have I ever tried to extract the data from FORMULADT/FORMULA. What have you tried? I have coded an example of using the LabVIEW xml parser to extract the data you want but I can't seem to find a way to attach it here in a community document comment. Maybe you can post a question in the forum detailing what you have already attempted, then I can attach my solution.
Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument

Hello Troy,


Thank you so much for the response!


I have tried to modify the code you uploaded to load service id for each DIDs and FORMULADT, MUX data types, but I could not find the formula information value while I was debugging. I have read FORMULADT, MUXDT type by adding it in the value type enum but without the formula and MUX information. I have been debugging but I only can check "Node name: usage & Node value : coded2Phys."


I would like to ask you how did you figure out the CDD format structure and properties (ex , DCLTMPLS, PROTOCOLSERVICES, DIDs / STATICVALUE-> shstaticref / etc  ) to extract all the information?


Thank you for the xml parser to extract data type information. I am going to post a question in the forum.


Many thanks,

Suhwan Kim






How to write parameters (2EXXXX) from CDD file via CAN bus through Vector CAN Hardware?


Hi  TroyK,

if UDS is implemented and the:

service request has 3 bytes:  [0A,0B,0C]

and the service respons has 9 Bytes:  [01,02,03,04,05,06,07,08,09]

How is this UDS request to respons  done with Vector CAN hardware ?