Jump to content
Sign in to follow this  
Lars

How to get my data back from created XML file

Recommended Posts

I have just started to usedmy paid version of EasyXML for a project that involves manipulation of data within a XML configuration file . I believ that this tookit should help me a lot.

 

Unfortently I started with a 2dim arry information that this tool kit not can handle directly so I need some help for a work around when I try to read the XML file back !

 

Bakground:

 

So I create a configuration file from an initial excel spreadsheet that was exported to a tab limited txt file . It consist of a arry of strings (36 columns and 46 lines(line=0 = headings)

 

I made the a test program as you can see from the pdf file that read this table in and conver it to 2D string array to be presntated in a multi column listbox, that works as expected.

 

I also have success to create a 46 input bundle cluster by using index array vi and the create a XML configuration file using Easy Write XML ,

 

My problem start when I tried to find how to parse back the information if I want to read the XML file that I have created and convefrt it back to the 2 dim string array i have from the beginning so I can use it in my multi column listbox. Please advice what step I should take ,

 

Thanks

Lars

create_XML_config_file_from_txt_file_and_try_to_read_it_back_to_an_string_array__not_succeded_yet__please_help._.pdf

Share this post


Link to post
Share on other sites

Hi Lars,

 

You are right. EasyXML doesn't support 2D (multi-dimensional) arrays, at this time. I would recommend writing this data as a 1D array of clusters, as shown below:

 

<CT-Unit>
 <No>16</No>
 <Name>GE LightSpeed Pro 16</Name>
 <Phantom>Head</Phantom>
 <BQ>Head</BQ>
 <kV>120</kV>
 <k>1</k>
 <Sensitivity></Sensitivity>
<CT-Unit>
<CT-Unit>
  <No>17</No>
  <Name>GE LightSpeed Ultra, 8 slice</Name>
  <Phantom>Head</Phantom>
  <BQ>Head</BQ>
  <kV>120</kV>
  <k>1</k>
  <Sensitivity></Sensitivity>
<CT-Unit>

 

You should check out the recent EasyXML Tips and Tricks post, Creating ordered elements in XML, for more information on how to do this.

 

The reason EasyXML doesn't support multi-dimensional arrays is that, for the first version of EasyXML, we wanted to limit the number of data types supported to those necessary for generating and parsing any XML data. XML does not have any concept of a multi-dimensional array, so we left this out. You might be interested in reading the following FAQ entry for more information on this decision:

Please let me know if you need any more pointers on getting your application working with EasyXML. I'm happy to help :)

 

Thanks,

 

-Jim

Share this post


Link to post
Share on other sites

Hi Jim

Thanks very much for your prompt answer,

 

I have read your Tips and tricks.

 

I believe I use 1 dim array of string clusters (see my attached screenshot) , but I could be wrong here, Shoulds I try i dim of arrys instead of 1-dim clusters for compund elements?

 

The Major problem for me, not an expert of parsing is to find the LV code to read the created xml file back using EasyXML and write the code to organize the data so I can use the the multcolumn listbox for my selection,(this was made very easy to use the Spreadsheet String to Array in the fist place resding the tab based txtfile) as you can see(the pdf file send yesterday) from my first try I have been able to read the XML file and parse out something but then I am lost

 

So I think the EasyXML make the work, I can not just figure out how to extact back the data an here I need a little more guidlines.

 

Thanks

Lars

 

 

 

Hi Lars,

 

You are right. EasyXML doesn't support 2D (multi-dimensional) arrays, at this time. I would recommend writing this data as a 1D array of clusters, as shown below:

 

<CT-Unit>
 <No>16</No>
 <Name>GE LightSpeed Pro 16</Name>
 <Phantom>Head</Phantom>
 <BQ>Head</BQ>
 <kV>120</kV>
 <k>1</k>
 <Sensitivity></Sensitivity>
<CT-Unit>
<CT-Unit>
  <No>17</No>
  <Name>GE LightSpeed Ultra, 8 slice</Name>
  <Phantom>Head</Phantom>
  <BQ>Head</BQ>
  <kV>120</kV>
  <k>1</k>
  <Sensitivity></Sensitivity>
<CT-Unit>

 

You should check out the recent EasyXML Tips and Tricks post, Creating ordered elements in XML, for more information on how to do this.

 

The reason EasyXML doesn't support multi-dimensional arrays is that, for the first version of EasyXML, we wanted to limit the number of data types supported to those necessary for generating and parsing any XML data. XML does not have any concept of a multi-dimensional array, so we left this out. You might be interested in reading the following FAQ entry for more information on this decision:

Please let me know if you need any more pointers on getting your application working with EasyXML. I'm happy to help :)

 

Thanks,

 

-Jim

post-2465-1212994563_thumb.png

Share this post


Link to post
Share on other sites

Lars,

 

Looking at your screenshot I can see a few things that might go wrong. First the EasyXML reader already does the parsing, so there is no need to call the parser again. Second for the reader (or the parser) to work you have to connect your cluster of data to the type input.

Look at the attached screenshot of your code below. Try to apply the same change that I made (in the red rectangle) to your original code and let us know if this help.

 

EasyXML_Question.png

 

Good Luck.

 

Philippe

Share this post


Link to post
Share on other sites

Lars,

 

As Philippe mentioned, it's important to use the Variant to Data function to convert to your expected data type:

 

1.png

 

For examples, you might want to take a look at the EasyXML examples that ship with the product, which are located here:

 

\examples\JKI\EasyXML\

 

Let us know if you still have issues.

 

-Jim

Share this post


Link to post
Share on other sites

post-2465-1213049206_thumb.pngPhilippe and Jim

 

Thanks for your replies, I have modified the code as your image to get the parser okey according to your suggestion. But something is strange !!

 

 

AS You can see from the screenshot all of the LabView xml data is the same for all 47 subcluster and equal to the heading cluster contents , and therfore also the Parsed xml dtaa is wrong,

 

But;

 

You can see from the "CT_Database xml string" that the actually contain differnt data for each "line"

 

I also send a priontscren of the contents of the XML file that is created, so that looks okey, It looks like that thearading of this XML file using the suggetsed parser don't work as expected still, Any suggestions

Ops, My memory limit to upload is exceeded.

 

Ien only one screenshoot.

 

 

 

'

Lars,

 

As Philippe mentioned, it's important to use the Variant to Data function to convert to your expected data type:

 

post-2-1213036026.png

 

For examples, you might want to take a look at the EasyXML examples that ship with the product, which are located here:

 

<LabVIEW 8.2>\examples\JKI\EasyXML\

 

Let us know if you still have issues.

 

-Jim

Share this post


Link to post
Share on other sites

Hi Lars,

 

Can you possibly post your VI, so that we can take a look at your specific example and try to see how to fix the issue? If you don't feel comfortable posting it, here in the forums, you can email it to support (at) jameskring (dot) com.

 

Thanks for your patience. We'll work hard to try to get this working for you :)

 

-Jim

Share this post


Link to post
Share on other sites

I do so

 

Hi Lars,

 

Can you possibly post your VI, so that we can take a look at your specific example and try to see how to fix the issue? If you don't feel comfortable posting it, here in the forums, you can email it to support (at) jameskring (dot) com.

 

Thanks for your patience. We'll work hard to try to get this working for you :)

 

-Jim

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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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