취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

Handling Large XML Files

Good evening everyone, 

 

I'm trying to design an XML file modifyer with LabVIEW. 

 

I am currently using EasyXML because I've read on the forum it's easy to work with, however I'm struggling to change an specific "tag"/"child" from the XML file and it takes a long time to load the whole structure using Easy XML. 

 

It's very straight forward to solve, however I want to do something that could be used on different files, which is my problem. 

 

I've seen on Python some tool called "XML / Element Tree", which can modify very large XML files very straightforward. 

 

Is there something similar on LabVIEW? If not, would you suggest me to instead try to implement a Python script and process it outside of labview?

 

I attach some pictures for reference and understanding: 

Blancoys_0-1651506290059.png

 

Blancoys_1-1651506349821.png

The part where I'm indecisive about the way of approaching the problem: 

Blancoys_4-1651507259250.png

 

 

 

 The file that I'm working on, is structured as following: 

Blancoys_2-1651507118230.png

It contains several devices,  same tags all the time but different information. 

 

Blancoys_3-1651507168343.png

 

 

 

 

Kind Regards! 🎈

0 포인트
1/10 메시지
3,679 조회수

It's great that you are already thinking of scalability!  Is it possible to describe, in more detail, just how different these files are?  Do they have anything in common?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
2/10 메시지
3,659 조회수

Your comment made me so happy because it's the first time someone replies something like that! Thank you 😊

 

The files have the same structure that can be seen on the picture attached, what changes is the amount of devices that are controlled by one XML File. 

 

Blancoys_0-1651516303061.png

What I would be interested into changing is the data that is displayed on this files. 

 

For example: Change Name, Change Id, ....... 

 

Blancoys_1-1651516411017.png

 

My problem comes when attempting to change a name, or a value .. whatever entry because if I want to write an XML file with Easy XML I have to create each cluster and sort everything as it is .. which would be impossible for each file. 

 

I thought of maybe changing the XML into a string, but I think it would not be a good approach when it comes to the time. 

 

That's why I'm looking more into something like the tool that exists on Python 😋

 

0 포인트
3/10 메시지
3,642 조회수

@Blancoys wrote:

Your comment made me so happy because it's the first time someone replies something like that! Thank you 😊

 

The files have the same structure that can be seen on the picture attached, what changes is the amount of devices that are controlled by one XML File. 

 

Blancoys_0-1651516303061.png

What I would be interested into changing is the data that is displayed on this files. 

 

For example: Change Name, Change Id, ....... 

 

Blancoys_1-1651516411017.png

 

My problem comes when attempting to change a name, or a value .. whatever entry because if I want to write an XML file with Easy XML I have to create each cluster and sort everything as it is .. which would be impossible for each file. 

 

I thought of maybe changing the XML into a string, but I think it would not be a good approach when it comes to the time. 

 

That's why I'm looking more into something like the tool that exists on Python 😋

 


Hmm, I have to think about this one.  XML parsing is NOT my strong point.  Besides, it's too close to "going home" time.  😄

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
4/10 메시지
3,614 조회수

A number (maybe 8?) of years ago, I wanted a more flexible way of handling XML data than "Read the entire File All at Once".  My Data File typically had some header material, then a large array of "Responses" that were expressed as a (fairly large, about 120-elements) Cluster.  When I started, I used EasyXML, and figured out how to get it to read my Array of Clusters one element at a time (so Read Cluster, process Cluster, read next Cluster, etc.), the trick being, of course, to know when you reached the end of the Array.

 

This was a bit clumsy in EasyXML.  I discovered, on the LabVIEW Tools Network, something called GXML, written by someone at NI, including the Source Code (just regular LabVIEW).  I added a few functions to it to allow you to do just what I described in the previous paragraph, namely read an Array-of-Large-Clusters one Cluster at a time, and recognize when you reach the end of the Array.  Don't remember the details now (that System was used by the Lab's last 3-4 Graduate Students, then the advisors basically closed the lab), but you might take a look at this offering, which is still on the Tools Network.

 

Bob Schor

5/10 메시지
3,604 조회수

Thank you for your reply, I've taken a look at the package that you spoke of. However, I don't understand entirely how to use it, I've tried to look for documentation but it seems all of the pages are gone. 

 

If you have a resource that refers to it that I can use, it would be useful😊

 

Have a nice day!

0 포인트
6/10 메시지
3,572 조회수

@Blancoys wrote:

Thank you for your reply, I've taken a look at the package that you spoke of. However, I don't understand entirely how to use it, I've tried to look for documentation but it seems all of the pages are gone. 

 

If you have a resource that refers to it that I can use, it would be useful😊


I went looking.  I recall there was a Discussion site somewhere, so I went looking.  Turns out it might be this very Forum!  In the Search bar when you open the Forum, type GXML.  When you find "Reference Library ... (GXML)", you've found it.  There are even some comments from me in there.

 

Bob Schor

 

 

7/10 메시지
3,549 조회수

This won't give you answers about editing XML, but is a general warning.

 

Based on your images, I assume you're working on EtherCAT ESI files. My experience with them is limited, but my understanding is that these should be provided by the manufacturer of the device. They include the basic information for how the EtherCAT slave is configured and the EtherCAT system won't work correctly if you change the wrong thing (names are probably fine, although I don't know enough).

 

I believe this is more of an issue for ENI files, which describe the topology of a specific network and there the values configured for each device change depending on the devices coming before it, but it might also apply to ESI files. I would suggest some research.


___________________
Try to take over the world!
8/10 메시지
3,540 조회수

Thank you very much for your reply, yes I'm aware of it, however I want to make a program that can modify the process image from the cards and setting it in a specific mode since startup. I am aware the name maybe won't matter, I was just trying to target something specific and change it, to be able to implement it later (when I have some understanding of it) on the things that actually make a difference. 😊

0 포인트
9/10 메시지
3,535 조회수

If changing an XML file is the goal, why not use a XSLT (w3schools.com)?

 

XSLT: use XSLT to transform XML documents into other formats.

 

If you use an .NET (or AX) XML loader\parser, you can simply apply the stylesheet, and you'll get the converted XML. IIRC, LV's XML parser doesn't do practical stuff like that 😑. I'd have to look up the details, but it's not hard.

10/10 메시지
3,523 조회수