Jump to content
qwerty3321

start with xml data

Recommended Posts

1. Help->Find Examples.  Do a search for XML

2. Go look at packages in VIPM.  NI has a Simple XML library that I used to figure some things out.  Then JKI and MGI have their own XML packages you can have a look at.

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, Benoit said:

What is your final goal with the XML?

Benoit

I have an xml document.

i would like to read and write back that xml file in labview

Share this post


Link to post
Share on other sites

So since it is quite generic, I will suggest you as crossrulz said and learn the basic stuff about xml standard. It is not difficult. you can even inside of a week create your own parser.

 

Benoit

Share this post


Link to post
Share on other sites

Do a match pattern on those: 

"<Name>Test 1</Name>

<NumElts>"

and then on "<NumElts>"

By getting the character position in the file, you can easily replace the value in between with anew one.

repeat with 

<Name>Test 2</Name>

 

But why do you want to replace those value? are they already real measurement from real device?

I have Ethical concern on what you are trying to do.

Benoit

Share this post


Link to post
Share on other sites

i dont want to replace those values . i just want to indicate them on the front panel along with the names

p.s These values are constants

Share this post


Link to post
Share on other sites

well then the way I explained to you is the same... instead of replacing, report it. ?

Benoit

Share this post


Link to post
Share on other sites

For the simple task you want to do, just use search pattern.

It should looks like this...

image.png.45574193cb0fe30a873e21e015413627.png

Benoit

Edited by Benoit

Share this post


Link to post
Share on other sites
2 hours ago, qwerty3321 said:

Where did you get this XML document from? It is corrupted (There are many stray "-" characters, so XML parsers will give you an error)

Also, take the time to follow @crossrulz's advice:

On 11/26/2018 at 6:46 PM, crossrulz said:

1. Help->Find Examples.  Do a search for XML

2. Go look at packages in VIPM.  NI has a Simple XML library that I used to figure some things out.  Then JKI and MGI have their own XML packages you can have a look at.

 

Edited by JKSH

Share this post


Link to post
Share on other sites

Since his xml document is not standard, I suggest him to use search pattern instead... so no matter is the txt file format/standard, it will work.

Benoit

Share this post


Link to post
Share on other sites
1 hour ago, Benoit said:

Since his xml document is not standard, I suggest him to use search pattern instead... so no matter is the txt file format/standard, it will work.

Benoit

doesnt it make complex using search pattern? i need to give each name and value in string array constant

Share this post


Link to post
Share on other sites

No matter what tools you will use, you need to define what value you want...

If you use xml tools, it will be similar.

Benoit

Share this post


Link to post
Share on other sites
15 hours ago, qwerty3321 said:

can you show me how to fetch the name and value of two elements of cluster test1 and test2 using xml palette please

Why do you refuse to use the code that @Benoit already wrote for you?

Like I said before, your XML file is corrupted. The XML palette won't work on it.

Share this post


Link to post
Share on other sites
2 minutes ago, qwerty3321 said:

I would like to know the process of using the xml palette assuming i have a valid xml file

Open LabVIEW and click Help > Find Examples... then search for "XML". @crossrulz gave you this advice earlier.

Share this post


Link to post
Share on other sites
5 minutes ago, qwerty3321 said:

Thank you so much and sorry for the trouble😄

No problem. We are happy to help, but we'd appreciate it if you try to follow our instructions. ;)

Good luck with learning LabVIEW.

Share this post


Link to post
Share on other sites

so i was just trying to get the values of some elements from xml by using unflatten function .

could you please help me with that

image.thumb.png.5caaa9153f907bec3cf14d12c38b8f19.png

Edited by qwerty3321

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.