Jump to content

Trouble loading XML, no errors given


pandersen

Recommended Posts

I'm currently evaluating EasyXML and tried to load in this XML:

 

<groups>
<group>
	<trigger>bTrigger</trigger>
	<handshake>bResult</handshake>
	<items>
		<item>
			<dbcolumn>partID</dbcolumn>
			<tag>sPartID</tag>
			<type>STRING</type>
		</item>
		<item>
			<dbcolumn>partStatus</dbcolumn>
			<tag>dPartStatus</tag>
			<type>DINT</type>
		</item>
	</items>
</group>
<group>
	<trigger>bTrigger2</trigger>
	<handshake>bResult2</handshake>
	<items>
		<item>
			<dbcolumn>partID2</dbcolumn>
			<tag>sPartID2</tag>
			<type>STRING</type>
		</item>
		<item>
			<dbcolumn>partStatus2</dbcolumn>
			<tag>dPartStatus2</tag>
			<type>DINT</type>
		</item>
	</items>
</group>
<group>
	<trigger>bTrigger3</trigger>
	<handshake>bResult3</handshake>
	<items>
		<item>
			<dbcolumn>partID3</dbcolumn>
			<tag>sPartID3</tag>
			<type>STRING</type>
		</item>
		<item>
			<dbcolumn>partStatus3</dbcolumn>
			<tag>dPartStatus3</tag>
			<type>DINT</type>
		</item>
	</items>
</group>
</groups>

 

My cluster looks like this: clusteri.png

My LabView code looks like this (the Groups Path part on top is what to follow): codeeht.png

 

I believe I created the cluster correctly. It was a little confusing to set up, with an array inside a cluster inside an array inside a cluster. Did I do something incorrectly? After loading the XML the Config cluster is populated, but the Groups cluster is empty. I even unbundled and indexed the items and arrays inside the cluster to get individual elements, which verified that there is no data present. I do not get any error messages.

 

EDIT: Sorry, I picked an incorrect screenshot. There should be wires going from the Error Out terminal on your EasyXML block to the Error In terminal on the variant to cluster block. Result is the same with those wires, though.

Link to comment
Share on other sites

Hi,

 

I think you're almost there!

 

What I see is that you probably need to rename your "items" array as "item" and then put that "item" array inside a cluster called "items". Note that you structured the "groups" cluster and "group" array correctly.

 

Please let me know if that helps.

 

Thanks,

 

-Jim

Link to comment
Share on other sites

I attempted what you suggested, but what I did still would not work. After playing around some more, I restructured my XML a bit and made the cluster match, and it works great!

New XML:

<groups>
<group>
	<trigger>Program:Station_01.SQL_bTrigger</trigger>
	<handshake>Program:Station_01.SQL_bHandshake</handshake>
	<item>
		<dbcolumn>partID</dbcolumn>
		<tag>Program:Station_01._my_shift_register.PartID</tag>
		<type>STRING</type>
	</item>
	<item>
		<dbcolumn>partStatus</dbcolumn>
		<tag>Program:Station_01._my_shift_register.PartStatus</tag>
		<type>DINT</type>
	</item>
</group>
<group>
	<trigger>Program:Station_02.SQL_bTrigger</trigger>
	<handshake>Program:Station_02.SQL_bHandshake</handshake>
	<item>
		<dbcolumn>partID</dbcolumn>
		<tag>Program:Station_02._my_shift_register.PartID</tag>
		<type>STRING</type>
	</item>
	<item>
		<dbcolumn>partStatus</dbcolumn>
		<tag>Program:Station_02._my_shift_register.PartStatus</tag>
		<type>DINT</type>
	</item>
</group>
</groups>

 

New cluster:cluster.png

 

Thanks for your help, EasyXML is a great tool! If this project continues to fruition we will definitely be buying.

Link to comment
Share on other sites

I'm glad you got it working and thanks for the kind words. Also, if you attach your VI, I can help you get it working with the XML structure in your first example -- I'm very curious why it wasn't working.

 

We're looking forward to having you as a customer. Good luck with your project.

 

-Jim

Link to comment
Share on other sites

I re-created what I had originally to attach it. Lo and behold, it worked fine. I suspect that after your first suggestion I didn't fix up the cluster properly. To be honest this is my 4th day using LabView, self-teaching myself, so I wouldn't be surprised if I didn't do it correctly.

 

I think I will stick to my newer XML structure anyway, it is a little simpler to handle in code after it is in the cluster. Thanks for the help!

Link to comment
Share on other sites

I re-created what I had originally to attach it. Lo and behold, it worked fine. I suspect that after your first suggestion I didn't fix up the cluster properly. To be honest this is my 4th day using LabView, self-teaching myself, so I wouldn't be surprised if I didn't do it correctly.

 

I think I will stick to my newer XML structure anyway, it is a little simpler to handle in code after it is in the cluster. Thanks for the help!

 

You're welcome. I'm glad you've got it working. Let me know if you need any more help.

 

BTW, You're doing amazingly well for only 4 days! :D

 

Thanks,

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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