Example Code

Obtain XML from a Webpage and Parse in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

This example searches an XML webpage and extracts the expression instances found

 

Description

Many websites have XML output that you can use to read data from. This code takes advantage of the HTTP Toolkit (installed with LabVIEW Professional) and the XML Parsing VIs.

 

Requirements

LabVIEW Professional Development System 2012 or compatible

 

Steps to Implement or Execute Code
1- Enter the webpage URL
2- Enter the XPath search expression
3- Run the XML_Webpage.vi

 

 Additional Information or References

The XML_Webpage.vi uses a modified Query XML Document for a Single Node.vi from the NI LabVIEW Example Finder. The Query XML Document for a Single Node.vi was modified so that its inputs and outputs were connected to the connector pane.

 

VI Block Diagram

 3004.PNG

 

**This document has been updated to meet the current required format for the NI Code Exchange. **

 

Joshua B.
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
stubon
Member
Member
on

Is there a way to send a query to a website?

I am interested in returning information about a barcode I have read in.

There are several databases online where you can type in the barcode and get information back

e.g. http://gepir.gs1.org/V31/xx/gtin.aspx?Lang=en-US

I would like to send a query with the barcode and read back the information

Any ideas if this is possible?

Thanks

DiscoBall
NI Employee (retired)
on

Howdy! You may be able to work with the HTTP Client: http://decibel.ni.com/content/docs/DOC-6252. An http POST to send and GET to receive. I hope that helps!

Joshua B.
National Instruments