static int Main(string[] args) { if (args.Length != 6) { Usage(); return(1); } XmlDocument document = new XmlDocument(); document.PreserveWhitespace = true; document.Load(args[0]); XPathNavigator navigator = document.CreateNavigator(); AddSortKeysToXml.SortKeyGenerator sortKeyGenerator = GetSortKeyGeneratorFromArgument(args[3]); string xpathSortKeySource = args[2]; string xpathPlaceToPutSortKey = args[4]; string attribute = args[5]; AddSortKeysToXml.AddSortKeys(navigator, xpathSortKeySource, sortKeyGenerator, xpathPlaceToPutSortKey, attribute); document.Save(args[1]); return(0); }
public void Setup() { XmlDocument document = new XmlDocument(); document.LoadXml( @"<test> <node>z</node> <node>a</node> <node>b</node> <node>q</node> </test>"); this._document = document.CreateNavigator(); this._xpathSortKeySource = "//node"; this._xpathElementToPutSortKeyAttributeIn = "self::*"; this._attribute = "sort-key"; this._prefix = "sil"; this._uri = "http://sil.org/sort-key"; _sortKeyGenerator = CultureInfo.InvariantCulture.CompareInfo.GetSortKey; }