Jump to content

start with xml data


Recommended Posts

Posted

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
Posted

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

Posted

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

Posted (edited)

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
Posted (edited)
  On 11/28/2018 at 4:35 AM, qwerty3321 said:
Expand  

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 10:46 AM, 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.

Expand  

 

Edited by JKSH
Posted

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

Posted
  On 11/28/2018 at 6:42 AM, 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

Expand  

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

Posted
  On 11/28/2018 at 12:35 PM, 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

Expand  

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.

Posted
  On 11/29/2018 at 5:03 AM, qwerty3321 said:

Thank you so much and sorry for the trouble😄

Expand  

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

Good luck with learning LabVIEW.

Posted (edited)

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

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.