11-19-2009 04:47 AM - edited 11-19-2009 04:49 AM
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
Solved! Go to Solution.
11-19-2009 05:24 AM
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
11-19-2009 11:40 AM
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
11-19-2009 04:19 PM
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
11-20-2009 01:59 AM - edited 11-20-2009 01:59 AM
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.
Regards
juergen
11-20-2009 10:36 AM - edited 11-20-2009 10:42 AM
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