LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XML parser RT

Can you use the dornet framework in CE?  The compact Framework should have some XML parsers.  For realtime this is probably not the case.  Just throwing out a few Ideas I have not developed PDA apps with Labveiw yet
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 11 of 22
(3,979 Views)
KaBooOoom,
If I'm correct understanding, you mentioned PARSING an .xml file. So, supposing you have your  .xml file ready somewhere (on host machine running Windows for example), you may parse it on windows and store in another RT compatible format. I mean binary flattened to byte stream file for example. Then you download this file to RT and unflatten to your program data structure.
I'm using this technique on LVRT  platform when need to read some unsupported file or data format. This is like asking for service from  RT  to  Windows or Unix host. Sometimes  I'm loading this parsed binary stream from host to LVRT program at the run-time while configuring my RT target program from host. VI server is very good choice to make this happen.
Of course if you need dynamic data exchange with .xml file during run-time, you'll need little bit different technique(anyway think about byte stream file type). I think that real-time and complex .xml file is not a good choice for LVRT, because of complexity, unicode, and real-time issues.
Sergey
0 Kudos
Message 12 of 22
(3,974 Views)
The PDA module run on TPC-2006 which few software support with it.
0 Kudos
Message 13 of 22
(3,961 Views)

Hi SergKr !

I wanted tu use xml format for my configuration files. These files are used to define the CAN ports, CAN frames to read/write, AI, AO, DI, DO .... I think your solution may works, but I find it a little bit complicated. For the moment, i don't need labview on my host PC, and i'm not  persuaded this solution is really

0 Kudos
Message 14 of 22
(3,951 Views)

Ooops.. sorry I sent this message before I ended ..

So to finish... As I said, i don't think it's really clean,. But it could be a solution. Well, I gave up using xml on RT target. I use csv format instead... I will wait next labview version, maybe they will developp tools for that....

 

0 Kudos
Message 15 of 22
(3,949 Views)


@ChinJohn wrote:
I got same question on my LV PDA module..
The PDA running windows CE, but LV PDA also not support XML.

LV version 6 has support XML, but why still leave other modules alone?
This isn't difficiult  job for NI.
Smiley Sad



Try to write an XML parser and I'm sure you will understand that it is anything but NOT difficult.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 16 of 22
(3,947 Views)
Hi,


If you can read a TXT file, you can read an XML file. If reading means parsing, just read it like you would read a txt file... So "parsing" an XML file is no problem at all!


Building an XML string/file can be done by simply adding strings, and perhaps replacing values with %s, %f or %d.


"Parsing" an XML file can be as simple as searching a begin and end tag. E.g. Use Match Pattern with something like "<name>[~<>]*</name>" will return "<name>value</name>".


It becomes more difficult if elements can be nested. Or if there can be empty element tags ("<tag/>"). Or if you need attributes, if it needs to be fast, if you need to edit it and send it back, etc. That is when you need a parser...


So if you don't need the full implementation, you can write primitive functions yourself.


If you need to add, delete, find or copy nodes, attributes, values, entities, etc. you'll need a parser.


The document object model defines an interface to parse an XML document (see W3C). And MS's implementation happens to be popular. I tried to implement the DOM in pure LabVIEW, and I will put it on our website (hopefully within a few weeks). Perhaps there will be a small fee for commercial use. It is not specifically tested for embedded, so it might well be to heavy on memory use or processor load. I'm also not sure about reentrant vi's that are called recursively.


How exactly do you all what to use XML? I'd like to know what functions you need. Perhaps I can build them into my parser, if they are not there yet.



Regards,


Wiebe.



"KaBooOoom" <x@no.email> wrote in message news:1144134611267-347345@exchange.ni.com...
Hi SergKr !
I wanted tu use xml format for my configuration files. These files are used to define the CAN ports, CAN frames to read/write, AI, AO, DI, DO .... I think your solution may works, but I find it a little bit complicated. For the moment, i don't need labview on my host PC, and i'm not &nbsp;persuaded this solution is really
0 Kudos
Message 17 of 22
(3,947 Views)


@KaBooOoom wrote:

Ooops.. sorry I sent this message before I ended ..

So to finish... As I said, i don't think it's really clean,. But it could be a solution. Well, I gave up using xml on RT target. I use csv format instead... I will wait next labview version, maybe they will developp tools for that....


I'm not sure XML would be a good solution for RT targets. IT is a rather involved standard and you end up with two possible outcomes.

1) A very limited parser that can only support a specific schema such as what the LabVIEW XML tools do.
2) A complicated and more or less fully functional parser that will hog down your RT system considerably, use up large resources and still be not universally adaptable since the strict data typeing of LabVIEW is hard to get around.

Rolf Kalbermatter

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 18 of 22
(3,946 Views)
If you haven't looked at them yet, you may want to consider the configuration file VIs.  These produce Windows style INI files, such as are used by LabVIEW executables.  I will freely admit that they only have one level of hierarchy, but they may work for you.  They are also much easier to read and modify than XML files.

In addition, what version of LabVIEW are you using?  I have some pure G LV8 XML parsing utilities I can post.  They are fairly primitive (e.g. no caching) but can be used to arbitrary complexity if you are familiar with LabVIEW regression techniques.
0 Kudos
Message 19 of 22
(3,936 Views)

I already use .ini files, for example in order to define the path of my configurations files. But, as you said, they have only one level. In my project I wanted to use xml format in order to define CAN ports, frames, channels properties . Here is an example of what i wanted to do :

<PORT>
 <NAME> CAN0 </NAME>
 <TRANSCEIVERTYPE> HIGHSPEED </TRANSCEIVERTYPE>
 <BAUDRATE> 1000000 </BAUDRATE>
 ...
 <FRAME>
  <ID> 1 </ID>
  <IDTYPE> EXTENDED </IDTYPE>
  <NAME> Test </NAME>
  <TYPE> CYCLIC </TYPE>
  ....
  <CHANNEL>
   <ID> 10 </ID>
   <STARTBIT> 0 </STARTBIT>
   <NBBIT> 8 </NBBIT>
   <ORDERTYPE> LITTLEENDIAN </ORDERTYPE>
   ...
  </CHANNEL>
 </FRAME>
</PORT>

As you can see it's note really difficult, and i agree i think i could rewrote an xml parser myself. But I didn't have many times, therefore, i finally used csv format ! For information, I use LV8 as well !

 

0 Kudos
Message 20 of 22
(3,925 Views)