JKI Discussion Forums
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Using xsd files

#1
User is offline   bca 

  • Group: Members
  • Posts: 2
  • Joined: 18-March 11
I saw it mentioned that it is possible to use other than the labview LVXMLSchema.xsd to verify xml file conformity to a required template. Are there any examples of how to do this? I'm new to xml and am still figuring out how to use it, but I know we will want to verify all xml file input data to a vi before allowing the vi to run. Thanks.
0 kudos

#2
User is offline   Jim Kring 

  • Group: JKI Team
  • Posts: 1,204
  • Joined: 15-March 06

View Postbca, on 18 March 2011 - 04:23 PM, said:

I saw it mentioned that it is possible to use other than the labview LVXMLSchema.xsd to verify xml file conformity to a required template. Are there any examples of how to do this? I'm new to xml and am still figuring out how to use it, but I know we will want to verify all xml file input data to a vi before allowing the vi to run. Thanks.


Hi,

You can use the XML Load Document function to validate the XML against a DTD (document type definition) file. I think that you need to put the reference to this DTD in the XML file.

Attached Image: 3-21-2011 9-06-01 AM.png


Also, EasyXML will output an error if the incoming XML file can't be parsed. So, maybe you just need to use EasyXML. Have you tried this yet?

Thanks,

-Jim
0 kudos

#3
User is offline   bca 

  • Group: Members
  • Posts: 2
  • Joined: 18-March 11
I found that I can use a schema to validate using the labview Load XML File.vi if I put the schema-instance and schema location strings into the root element using #attributes. That is what I needed, thanks.
0 kudos

#4
User is offline   Jim Kring 

  • Group: JKI Team
  • Posts: 1,204
  • Joined: 15-March 06

View Postbca, on 29 March 2011 - 11:55 AM, said:

I found that I can use a schema to validate using the labview Load XML File.vi if I put the schema-instance and schema location strings into the root element using #attributes. That is what I needed, thanks.


Great! I'm glad that worked for you. Thanks for letting us know.

-Jim
0 kudos

#5
User is offline   crelf 

  • Group: Members
  • Posts: 92
  • Joined: 08-September 07

View PostJim Kring, on 21 March 2011 - 04:08 PM, said:

EasyXML will output an error if the incoming XML file can't be parsed.

Hi Jim - can you elaborate on this? My experience is that EasyXML skips over items that aren't in the control definition and continues without error.
0 kudos

#6
User is offline   crelf 

  • Group: Members
  • Posts: 92
  • Joined: 08-September 07

View Postbca, on 29 March 2011 - 11:55 AM, said:

I found that I can use a schema to validate using the labview Load XML File.vi if I put the schema-instance and schema location strings into the root element using #attributes. That is what I needed, thanks.

Right, but have you found a way to apply an XML Schema check? ie: I'm using xsd schemas, not dtd.

Cross posted to http://forums.ni.com...1952127#M648928

This post has been edited by crelf: 14 April 2012 - 06:36 PM

0 kudos

#7
User is offline   Jim Kring 

  • Group: JKI Team
  • Posts: 1,204
  • Joined: 15-March 06

View Postcrelf, on 14 April 2012 - 05:06 PM, said:

Hi Jim - can you elaborate on this? My experience is that EasyXML skips over items that aren't in the control definition and continues without error.


Hi crelf,

What I meant is that if the XML isn't well-formed, then EasyXML will output an error.

You're right that if the XML contains extra data that's not in the LabVIEW data, when it will continue without error.

-Jim
0 kudos

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic