Oops-- Please ignore this post. After much testing, I finally realized it was my build script tool that is somehow re-parsing the xml output and converting it to apostrophes.
I'm running the History command from the vault client, and the output it gives is not valid xml.
The problem is that one of the comments in the history contains an apostrophe ('), which is not xml encoded.
<item txid='225751' date='5/15/2006 11:26:30 AM' name='_Mainline/File.cpp' type='60' version='58' user='abc' comment='Can't use apostrophe' actionString='Checked In' />
The apostrophe in the word "can't" causes the problem. I'm also using the VaultClient API which has code for a client utility. I noticed the comment in there about using a custom XmlOutputWriter.
Thanks,
Mike Ballou
Bug with xml output from vault client
Moderator: SourceGear
Bug with xml output from vault client
Last edited by mballou on Mon May 15, 2006 7:21 pm, edited 1 time in total.
I converted the sample code using the custom XMLOutputWriter class to use the standard Microsoft XmlTextWriter class and the output results are the same excect it properly handles the xml encoding. It was pretty simple. Here are the steps I did:
Add System.xml.dll reference
Add "using System.Xml" to top of VaultCmdLineClient.cs and Help.cs
Make following replacements:
XMLOutputWriter -> XmlTextWriter
WriteUserMessage -> WriteComment()
AddPair -> WriteAttributeString() - Need to convert some values to string with .ToString(). for bools add ? "yes" : "no"
Begin -> WriteStartElement()
End -> WriteEndElement()
WriteContent -> WriteString()
cmdlineargs.Out.WriteLine("<vault>"); -> xml.WriteStartElement("vault");
cmdlineargs.Out.WriteLine("</vault>"); -> xml.WriteEndElement();
In Main() replace creation of XMLOutputWriter with these 4 lines:
XmlTextWriter xml = new XmlTextWriter(cmdlineargs.Out);
xml.Indentation = 1;
xml.IndentChar = '\t';
xml.Formatting = Formatting.Indented;
Add System.xml.dll reference
Add "using System.Xml" to top of VaultCmdLineClient.cs and Help.cs
Make following replacements:
XMLOutputWriter -> XmlTextWriter
WriteUserMessage -> WriteComment()
AddPair -> WriteAttributeString() - Need to convert some values to string with .ToString(). for bools add ? "yes" : "no"
Begin -> WriteStartElement()
End -> WriteEndElement()
WriteContent -> WriteString()
cmdlineargs.Out.WriteLine("<vault>"); -> xml.WriteStartElement("vault");
cmdlineargs.Out.WriteLine("</vault>"); -> xml.WriteEndElement();
In Main() replace creation of XMLOutputWriter with these 4 lines:
XmlTextWriter xml = new XmlTextWriter(cmdlineargs.Out);
xml.Indentation = 1;
xml.IndentChar = '\t';
xml.Formatting = Formatting.Indented;