LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

convert an array in a xml file

Solved!
Go to solution

Hi,

 

I try to convert an array I received from a http server in a xml file. So I will be able to handle the data with the cvixml-lib. The problem are all special signes like "<" or ">". For example the code for "<" is "&lt;". Do I have to write an own parser for all this 5 spezial characters or is there a nice function can do this for me?

I use CVI 2012.

 

Thanks a lot!

0 Kudos
Message 1 of 3
(2,813 Views)

Hi DRiegel,

 

Unfortunetely, there appears to be no such function in the CVI ADE, that's available for users. 

 

Nelu **bleep**arasan || National Instruments

 

0 Kudos
Message 2 of 3
(2,797 Views)
Solution
Accepted by topic author DRiegel

ok, the right question is: "how to convert html in xml"

 

that's how i did it:

 

hope it helps!

  while ( paSource[iAktuellePosSource] > 0 )
  // while no end of string continue with loop  
  {
    if ( paSource[iAktuellePosSource] == '&' )
    { // a new escape seq was found!
      switch ( paSource[ iAktuellePosSource + 1 ] )
      {
        case 'l':
          // found &lt; -> replace with <
          paDestination[ iAktuellePosDes ] = '<';
          iAktuellePosSource += 4;
        break;
        case 'g':
          // found &gt; -> replace with >
          paDestination[ iAktuellePosDes ] = '>';
          iAktuellePosSource += 4;
        break;
        case 'a':
          if ( paSource[ iAktuellePosSource + 2 ] == 'm' )
          {
            // found &amp; -> replace with &
            paDestination[ iAktuellePosDes ] = '&';
            iAktuellePosSource += 5;
          }  
          else
          {
            // found &apos; -> replace with '
            paDestination[ iAktuellePosDes ] = '\'';
            iAktuellePosSource += 6;
          }
        break;
        case 'q':
          // found &qout; -> replace with "
          paDestination[ iAktuellePosDes ] = '"';
          iAktuellePosSource += 6;
        break;
      }
      
    }
    else
    {
      // normal sign just copy
      paDestination[ iAktuellePosDes ] = paSource[ iAktuellePosSource ];
      ++iAktuellePosSource;
    }
    ++iAktuellePosDes;
  }

 

0 Kudos
Message 3 of 3
(2,793 Views)