NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Manipulating SequenceFile Data with DOM (XmlDocument)

Solved!
Go to solution

Hi,

 

I like to change some Step-data settings via xml.

I have saved my seq-file as xml. So i can access it via .Net(2.0) XmlDocument Class.

 

Accessing and Manipulation is working well, BUT

After saving all attributes have " " (double quotes)  Instead of Ni's  ' ' (single quotes)

so TS will not be able to open the file again !!

 

NI:

<teststandfileheader type='SequenceFile' fileversion='416' productname='TestStand' productversion='4.0 (4.0.0.326)' compatibleversion='4.0.0.0' buildversion='4.0.0.326' origfilepath='D:\test.seq' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ni.com/TestStand/4.0.0/SequenceFile">

<
typelist>

....... 

 

DOM: 

<teststandfileheader type="SequenceFile" fileversion="416" productname="TestStand" productversion="4.0 (4.0.0.326)" compatibleversion="4.0.0.0" buildversion="4.0.0.326" origfilepath="D:\test_Modif.seq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ni.com/TestStand/4.0.0/SequenceFile"><

typelist>

......

 

Do you know how i can slove this behaviour ?

 

 

regards

 

Juergen

   

Message Edited by j_dodek on 11-19-2009 04:49 AM
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 1 of 6
(3,899 Views)
Solution
Accepted by topic author j_dodek

Yeah,

 

XmlTextWriter.QuoteChar did the trick!

 

Bad:

xmlDocSeq.Save("D:\\Test_Modif.xml");

Good:

XmlTextWriter xmlWriter = new XmlTextWriter("D:\\Test_Modif.xml", System.Text.Encoding.UTF8))

xmlWriter.QuoteChar = '\'';

xmlDocSeq.Save(xmlWriter);

 

Juergen

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 2 of 6
(3,893 Views)

Are you sure quotes were the problem? Although TestStand writes out the file using single quotes, it supports reading it in with either kind of quotes. It worked for me either way in a simple test case. If you have a case in which it is not working please let us know.

 

-Doug

Message 3 of 6
(3,874 Views)

Hi Doug,

 

The only thing i changed via DOM was renaming some child elements <value>ABC</value> to <value>YXZ</value> to  of some User Steptype nodes.

 

After saving all Attributes has changed from single to double qoutes.

I was not able toreopen the file with TS.

 

When i am back in office i will write a small app

that opens a TS-file with DOM and save it back without any modification.

 

And check out what happens.

Maybe the Encoding.UTF8 is the trick

 

Regards

 

Juergen

 

 

 

--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 4 of 6
(3,861 Views)

Hi Doug,

 

you are right it. It doesnt care if you are using single or double qoutes or even utf

my Test.seq(just 1 Step) is running in all ways. (Original has 400 steps inside)

 

But i realizsed (feeling, no speedmeasure) that single and utf are opened faster than the others.

 

I think i should have to way a few minutes more before posting this thread.Smiley Very Happy

 

Regards

 

juergen

 

 

 

 

 

Message Edited by j_dodek on 11-20-2009 01:59 AM
--Signature--
Sessions NI-Week 2017 2016
Feedback or kudos are welcome
0 Kudos
Message 5 of 6
(3,854 Views)

No problem. Glad I could help clarify things.

 

Some additional information in case you are curious:

 

TestStand is expecting UTF8 encoding, so I'd recommend you keep using that. Though you probably won't notice a problem unless you are using characters from a multibyte language such as Chinese or Japanese.

 

I would not expect any signficant speed difference between single or double quotes. If there is a difference it should be very small (probably immeasurably so).

 

Hope this helps,

-Doug

 

Message Edited by dug9000 on 11-20-2009 10:42 AM
Message 6 of 6
(3,842 Views)