LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parse ATML files in LabVIEW 2016?

Solved!
Go to solution
Highlighted

I've been poking around to try and find a way to read ATML files generated from a teststand sequence and get specific information out of the file (i.e. runtime, S/N, etc).  Doing some searching online, I see this is possible in LabVIEW 2018 but we are running 2016.  I tried following this link (https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019ZLBSA2&l=en-US) and can build up to the command before the For Loop.

 

Does LV 2016 support parsing of ATML?

0 Kudos
Message 1 of 4
(150 Views)
Solution
Accepted by topic author wanamaa
07-12-2019 10:40 AM

As it mentions in the article, ATML is formatted the same way XML is, so anything that parses XML can parse ATML.  I don't know when LabVIEW added XML parsing support, but it was LabVIEW 2013 or earlier, so your version isn't an issue.

 

You do need to figure out how to use Xpath syntax no matter how you parse it.

 

Note: Unless it's been improved in a recent version where I haven't tested it, LabVIEW XML decoding can get pretty slow when dealing with large files.  If you're reading files under 1 MB you should be fine.  If it's over 10 MB, it's going to be amazingly slow.  You can read about it along with some solutions here.

Message 2 of 4
(125 Views)

Makes sense, I've been trying to do that but when I enter in the tags, it returns nothing, OR it gives me a syntax error (saying the trc is not valid).  Here is the structure I'm trying to read:

 

/trc:TestResultsCollection/trc:TestResults/tr:ResultSet/tr:Extension/ts:TSStepProperties

 

Full ATML up to where I want to grab:

<trc:TestResultsCollection xmlns:trc="urn:IEEE-1636.1:2013:TestResultsCollection" xmlns:tr="urn:IEEE-1636.1:2013:TestResults" xmlns:c="urn:IEEE-1671:2010:Common" xmlns:sc="urn:IEEE-1636.99:2013:SimicaCommon" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ts="www.ni.com/TestStand/ATMLTestResults/3.0">
<trc:TestResults uuid="20729001-9c4a-11e9-a82f-509a4c2bacf1" xmlns:trc="urn:IEEE-1636.1:2013:TestResultsCollection" xmlns:tr="urn:IEEE-1636.1:2013:TestResults" xmlns:c="urn:IEEE-1671:2010:Common" xmlns:sc="urn:IEEE-1636.99:2013:SimicaCommon" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ts="www.ni.com/TestStand/ATMLTestResults/3.0">
	<tr:Personnel>
		<tr:SystemOperator ID = "12345" name = "12345"/>
	</tr:Personnel>
	<tr:ResultSet ID="89369" name = "C:\test\test\TestStand\Cal-Adjust\test_Cal-Adjust.seq#MainSequence" startDateTime = "2019-07-01T14:47:08.942" endDateTime = "2019-07-01T14:49:08.850">
		<tr:Extension>
			<ts:TSStepProperties>
				<ts:StepType>SequenceCall</ts:StepType>
				<ts:StepGroup>Main</ts:StepGroup>
				<ts:BlockLevel value='1'/>
				<ts:Index value='17'/>
				<ts:TotalTime value='119.909'/>
				<ts:ModuleTime value='119.9'/>
			</ts:TSStepProperties>
		</tr:Extension>

I'll keep trying and will update it if I can get the TotalTime value successfully

0 Kudos
Message 3 of 4
(118 Views)

Got it!  After some more digging on XPath, I ended up using this string to get the value I'm after:

 

/*[name()='trc:TestResultsCollection']/*[name()='trc:TestResults']/*[name()='tr:ResultSet']/*[name()='tr:Extension']/*[name()='ts:TSStepProperties']/*[name()='ts:TotalTime']/@value

Thank you Kyle97330 for sending me down the right path to find the solution.  I'll mark your post as the answer.

0 Kudos
Message 4 of 4
(108 Views)