//TODO: respect namespaces
		public void Populate (XDocument doc)
		{
			foreach (XNode node in doc.AllDescendentNodes) {
				XElement el = node as XElement;
				if (el == null)
					continue;
				string parentName = "";
				XElement parentEl = el.Parent as XElement;
				if (parentEl != null)
					parentName = parentEl.Name.Name;
				
				HashSet<string> map;
				if (!elementCompletions.TryGetValue (parentName, out map)) {
					map = new HashSet<string> ();
					elementCompletions.Add (parentName, map);
				}
				map.Add (el.Name.Name);
				
				if (!attributeCompletions.TryGetValue (el.Name.Name, out map)) {
					map = new HashSet<string> ();
					attributeCompletions.Add (el.Name.Name, map);
				}
				foreach (XAttribute att in el.Attributes)
					map.Add (att.Name.Name);
			}
		}
Ejemplo n.º 2
0
        public static XDocument GetDocumentWithContacts()
        {
            XDocument doc = new XDocument(
                new XDeclaration("1.0", "utf-8", "yes"),
                new XProcessingInstruction("AppName", "Processing Instruction Data"),
                new XComment("Personal Contacts"),
                new XElement("contacts",
                    new XAttribute("category", "friends"),
                    new XAttribute("gender", "male"),
                     new XElement("contact",
                        new XAttribute("netWorth", "100"),
                        new XElement("name", "John Hopkins"),
                        new XElement("phone",
                            new XAttribute("type", "home"),
                            "214-459-8907"),
                        new XElement("phone",
                            new XAttribute("type", "work"),
                            "817-283-9670")),
                    new XElement("contact",
                        new XAttribute("netWorth", "10"),
                        new XElement("name", "Patrick Hines"),
                        new XElement("phone",
                            new XAttribute("type", "home"),
                            "206-555-0144"),
                        new XElement("phone",
                            new XAttribute("type", "work"),
                            "425-555-0145"))));

            return doc;
        }
            public void SetConfigurationData(string SqlIP, string SqlPort, string SqlUsername, string SqlPassword, int KioskId, string KioskRegion, string AdminPassword, string xmlFileName)
            {
                bool isError = false;
                try
                {
                    Decrypt(xmlFileName);
                }
                catch (Exception)
                {
                    isError = true;
                }

                try
                {

                    var doc = new XDocument(
                        new XElement("Settings",
                            new XElement("SqlIP", SqlIP),
                            new XElement("SqlUsername", SqlUsername),
                            new XElement("SqlPassword", SqlPassword),
                            new XElement("SqlPort", SqlPort),
                            new XElement("AdminPassword", AdminPassword),
                            new XElement("KioskId", KioskId),
                            new XElement("KioskRegion", KioskRegion)));

                    File.WriteAllText(xmlFileName, doc.ToString());
                }
                catch (Exception) { }

                finally
                {
                    if (!isError) Encrypt(xmlFileName);
                }
            }
Ejemplo n.º 4
0
		// Constructor used for testing the XDOM
		public AspNetParsedDocument (string fileName, WebSubtype type, PageInfo info, XDocument xDoc) : 
			base (fileName)
		{
			Flags |= ParsedDocumentFlags.NonSerializable;
			Info = info;
			Type = type;
			XDocument = xDoc;
		}
Ejemplo n.º 5
0
		IEnumerable<Error> Validate (XDocument doc)
		{
			foreach (XNode node in doc.Nodes) {
				if (node is XElement && !Object.ReferenceEquals (node, doc.RootElement)) {
					yield return new Error (ErrorType.Warning, "More than one root element", node.Region);
				}
			}
		}
Ejemplo n.º 6
0
		public MemberListBuilder (DocumentReferenceManager refMan, XDocument xDoc)
		{
			docRefMan = refMan;
			xDocument = xDoc;
			
			Errors = new List<Error> ();
			Members = new Dictionary<string,CodeBehindMember> ();
		}
Ejemplo n.º 7
0
        public void Comment(string value1, string value2, bool checkHashCode)
        {
            XComment c1 = new XComment(value1);
            XComment c2 = new XComment(value2);
            VerifyComparison(checkHashCode, c1, c2);

            XDocument doc = new XDocument(c1);
            XElement e2 = new XElement("p2p", c2);

            VerifyComparison(checkHashCode, c1, c2);
        }
Ejemplo n.º 8
0
        public void ProcessingInstruction(string target1, string data1, string target2, string data2, bool checkHashCode)
        {
            var p1 = new XProcessingInstruction(target1, data1);
            var p2 = new XProcessingInstruction(target2, data2);

            VerifyComparison(checkHashCode, p1, p2);

            XDocument doc = new XDocument(p1);
            XElement e2 = new XElement("p2p", p2);

            VerifyComparison(checkHashCode, p1, p2);
        }
Ejemplo n.º 9
0
		public void Populate (XDocument xDoc, List<Error> errors)
		{
			foreach (XNode node in xDoc.AllDescendentNodes) {
				if (node is AspNetDirective) {
					HandleDirective (node as AspNetDirective, errors);
				} else if (node is XDocType) {
					HandleDocType (node as XDocType);
				} else if (node is XElement) {
					// quit the parsing when reached the html nodes
					return;
				}
			}
		}
Ejemplo n.º 10
0
 public XMLScoreParser()
 {
     try
     {
         this.xdoc = XDocument.Load(FILENAME);
         Scores = this.ParseScores();
     }
     catch (FileNotFoundException ex)
     {
         this.xdoc = new XDocument(new XElement("Scores"));
         Scores = new List<Score>();
         this.xdoc.Save(FILENAME);
     }
 }
Ejemplo n.º 11
0
            public void StoreScores(List<Score> Scores)
            {
                this.Scores = Scores;
                this.Scores.Sort((x, y) => y.CompareTo(x));
                XElement[] Xscores = new XElement[Scores.Count];
                int i =0;
                foreach (Score sc in Scores)
                {
                    Xscores[i++] = new XElement("Score", new XElement("Name", sc.Player.Pseudo), new XElement("Value", sc.Value), new XElement("Mode", sc.Mode.GetType().FullName));
                }
                this.xdoc = new XDocument(new XElement("Scores", Xscores));

                this.xdoc.Save(FILENAME);
            }
Ejemplo n.º 12
0
 public void SameDocumentDefaultNamespaceSameNameElements()
 {
     XDocument xDoc = new XDocument(new XElement("Name", new XElement("Name")));
     Assert.Same(
         (xDoc.Nodes().First() as XElement).Name.Namespace,
         (xDoc.Nodes().Last() as XElement).Name.Namespace);
     Assert.Same((xDoc.Nodes().First() as XElement).Name, (xDoc.Nodes().Last() as XElement).Name);
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Informs the screen manager to serialize its state to disk.
        /// </summary>
        public void Deactivate()
        {
            #if !WINDOWS_PHONE
            return;
            #else
            // Open up isolated storage
            using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                // Create an XML document to hold the list of screen types currently in the stack
                XDocument doc = new XDocument();
                XElement root = new XElement("ScreenManager");
                doc.Add(root);

                // Make a copy of the master screen list, to avoid confusion if
                // the process of deactivating one screen adds or removes others.
                tempScreensList.Clear();
                foreach (GameScreen screen in screens)
                    tempScreensList.Add(screen);

                // Iterate the screens to store in our XML file and deactivate them
                foreach (GameScreen screen in tempScreensList)
                {
                    // Only add the screen to our XML if it is serializable
                    if (screen.IsSerializable)
                    {
                        // We store the screen's controlling player so we can rehydrate that value
                        string playerValue = screen.ControllingPlayer.HasValue
                            ? screen.ControllingPlayer.Value.ToString()
                            : "";

                        root.Add(new XElement(
                            "GameScreen",
                            new XAttribute("Type", screen.GetType().AssemblyQualifiedName),
                            new XAttribute("ControllingPlayer", playerValue)));
                    }

                    // Deactivate the screen regardless of whether we serialized it
                    screen.Deactivate();
                }

                // Save the document
                using (IsolatedStorageFileStream stream = storage.CreateFile(StateFilename))
                {
                    doc.Save(stream);
                }
            }
            #endif
        }
Ejemplo n.º 14
0
        private void Game_UpdateFrame(object sender, FrameEventArgs e)
        {
            PreviousMouseState = MouseState;
            PreviousKeyboardState = KeyboardState;

            MouseState = OpenTK.Input.Mouse.GetState();
            KeyboardState = OpenTK.Input.Keyboard.GetState();

            PreviousMousePosition = MousePosition;

            #if GRAPHMAKER
            XDocument doc = new XDocument();
            doc.Add(new XElement("Waypoints"));
            if (MouseState.LeftButton == ButtonState.Pressed && PreviousMouseState.LeftButton == ButtonState.Released) {
            int x = Camera.X + MousePosition.X;
            int y = Camera.Y + MousePosition.Y;

            if (MouseState.LeftButton == ButtonState.Pressed && PreviousMouseState.LeftButton == ButtonState.Released && MousePosition.X > 40) {
               doc.Element("Waypoints").Add(new XElement("Waypoint", new XAttribute("X", x), new XAttribute("Y", y)));
               minID++;
               Minion markerMinion = new Minion(new List<Sprite>() { new Sprite(new List<string>() { "Images/BlueMinion.png" }), new Sprite(new List<string>() { "Images/BlueMinion0.png", "Images/BlueMinion1.png" }) }, minID);
                markerMinion.Pos.X = x;
                markerMinion.Pos.Y = y;
                _player1.AddMinion(markerMinion);
              // doc.Save("TestWaypoint.xml");
            XDocument doc = new XDocument();
            doc.Add(new XElement("Waypoints"));
            if (MouseState.LeftButton == ButtonState.Pressed && PreviousMouseState.LeftButton == ButtonState.Released) {
            }

            if (MouseState.RightButton == ButtonState.Pressed && PreviousMouseState.RightButton == ButtonState.Released && MousePosition.X > 40)
            {
                switch (rightClicks)
                {
                    case 0: clicks[0] = x;
                        clicks[1] = y;
                        break;

                    case 1:
                        clicks[2] = x;
                        clicks[3] = y;
                         minID++;
                         Minion markerMinion = new Minion(new List<Sprite>() { new Sprite(new List<string>() { "Images/square.png" }), new Sprite(new List<string>() { "Images/square.png", "Images/square.png" }) }, minID);
                         WaypointNode waypoint1 = graph.GetClosestWaypoint(clicks[0], clicks[1]);
                         WaypointNode waypoint2 = graph.GetClosestWaypoint(clicks[2], clicks[3]);
                         markerMinion.Pos.X = waypoint1.X + (waypoint2.X - waypoint1.X) / 2;
                         markerMinion.Pos.Y = waypoint1.Y + (waypoint2.Y - waypoint1.Y) / 2;
                _player1.AddMinion(markerMinion);
                graph.ConnectNodes(waypoint1, waypoint2);
                        Console.Write("Added neighbor");
                        break;
                }
                rightClicks++;
                rightClicks = rightClicks % 2;
                graph.WriteGraph("TestWaypointNeighbors.xml");
            }

            _scrollBar.Update(e.Time);
            #else

            _map.Update(e.Time);

            _ui.Update(e.Time);

            #endif
            }

            private void Mouse_Move(object sender, MouseMoveEventArgs e)
            {
            MousePosition = e.Position;
            }
            }
        }
Ejemplo n.º 15
0
		void Populate (XDocument doc)
		{
			var project = doc.Nodes.OfType<XElement> ().FirstOrDefault (x => x.Name == xnProject);
			if (project == null)
				return;
			var pel = MSBuildElement.Get ("Project");
			foreach (var el in project.Nodes.OfType<XElement> ())
				Populate (el, pel);
		}
Ejemplo n.º 16
0
        /// <summary>
        /// Runs test for InValid cases
        /// </summary>
        /// <param name="nodeType">XElement/XAttribute</param>
        /// <param name="name">name to be tested</param>
        public void RunInValidTests(string nodeType, string name)
        {
            XDocument xDocument = new XDocument();
            XElement element = null;
            try
            {
                switch (nodeType)
                {
                    case "XElement":
                        element = new XElement(name, name);
                        xDocument.Add(element);
                        IEnumerable<XNode> nodeList = xDocument.Nodes();
                        break;
                    case "XAttribute":
                        element = new XElement(name, name);
                        XAttribute attribute = new XAttribute(name, name);
                        element.Add(attribute);
                        xDocument.Add(element);
                        XAttribute x = element.Attribute(name);
                        break;
                    case "XName":
                        XName xName = XName.Get(name, name);
                        break;
                    default:
                        break;
                }
            }
            catch (XmlException)
            {
                return;
            }
            catch (ArgumentException)
            {
                return;
            }

            Assert.True(false, "Expected exception not thrown");
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Runs test for valid cases
 /// </summary>
 /// <param name="nodeType">XElement/XAttribute</param>
 /// <param name="name">name to be tested</param>
 public void RunValidTests(string nodeType, string name)
 {
     XDocument xDocument = new XDocument();
     XElement element = null;
     switch (nodeType)
     {
         case "XElement":
             element = new XElement(name, name);
             xDocument.Add(element);
             IEnumerable<XNode> nodeList = xDocument.Nodes();
             Assert.True(nodeList.Count() == 1, "Failed to create element { " + name + " }");
             xDocument.RemoveNodes();
             break;
         case "XAttribute":
             element = new XElement(name, name);
             XAttribute attribute = new XAttribute(name, name);
             element.Add(attribute);
             xDocument.Add(element);
             XAttribute x = element.Attribute(name);
             Assert.Equal(name, x.Name.LocalName);
             xDocument.RemoveNodes();
             break;
         case "XName":
             XName xName = XName.Get(name, name);
             Assert.Equal(name, xName.LocalName);
             Assert.Equal(name, xName.NamespaceName);
             Assert.Equal(name, xName.Namespace.NamespaceName);
             break;
         default:
             break;
     }
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Creates the new infopath and load form.
        /// </summary>
        /// <param name="FormUri">The form URI.</param>
        /// <param name="InfoPathLoginHandler">The info path login handler.</param>
        /// <param name="readOnly">if set to <c>true</c> [read only].</param>
        private void CreateNewInfopathAndLoadForm(string FormUri, LogonDialogHandler InfoPathLoginHandler, bool readOnly)
        {
            // Kill off any existing infopath processes
            foreach (Process proc in Process.GetProcessesByName("infopath"))
            {
                proc.Kill();
            }

            InitInfopathAndStartDialogWatcher(new Application());
            SecurityAlertHandler securityHandler = new SecurityAlertHandler();
            ReplaceFormAlertHandler replaceFormHandler = new ReplaceFormAlertHandler();
            DialogWatcher.Add(securityHandler);
            DialogWatcher.Add(replaceFormHandler);
            if (InfoPathLoginHandler != null)
            {
                // remove other logon dialog handlers since only one handler
                // can effectively handle the logon dialog.
                DialogWatcher.RemoveAll(new LogonDialogHandler("a", "b"));

                // Add the (new) logonHandler
                DialogWatcher.Add(InfoPathLoginHandler);
            }
            if (readOnly)
            {
                InternalInfopathXDocument = InfopathApplicationTester.XDocuments.Open(FormUri, (int)XdDocumentVersionMode.xdCanOpenInReadOnlyMode);
            }
            else
            {
                InternalInfopathXDocument = InfopathApplicationTester.XDocuments.Open(FormUri, (int)XdDocumentVersionMode.xdFailOnVersionOlder);
            }

            InternalInfopathXMLDOMDocument = InternalInfopathXDocument.DOM as IXMLDOMDocument2;
            InternalHTMLDOMDocument = IEDom.IEDOMFromhWnd(this.hWnd);
        }
Ejemplo n.º 19
0
        public void Deactivate()
        {
            #if !WINDOWS_PHONE
            return;
            #else

            using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
            {

                XDocument doc = new XDocument();
                XElement root = new XElement("ScreenManager");
                doc.Add(root);

                tempScreensList.Clear();
                foreach (GameScreen screen in screens)
                    tempScreensList.Add(screen);

                foreach (GameScreen screen in tempScreensList)
                {

                    if (screen.IsSerializable)
                    {

                        string playerValue = screen.ControllingPlayer.HasValue
                            ? screen.ControllingPlayer.Value.ToString()
                            : "";

                        root.Add(new XElement(
                            "GameScreen",
                            new XAttribute("Type", screen.GetType().AssemblyQualifiedName),
                            new XAttribute("ControllingPlayer", playerValue)));
                    }

                    screen.Deactivate();
                }

                using (IsolatedStorageFileStream stream = storage.CreateFile(StateFilename))
                {
                    doc.Save(stream);
                }
            }
            #endif
        }
Ejemplo n.º 20
0
 public void XDocumentToStringThrowsForXDocumentContainingOnlyWhitespaceNodes()
 {
     // XDocument.ToString() throw exception for the XDocument containing whitespace node only
     XDocument d = new XDocument();
     d.Add(" ");
     string s = d.ToString();
 }
Ejemplo n.º 21
0
 public void Document4(bool checkHashCode)
 {
     var doc1 = new XDocument(new object[] { (checkHashCode ? new XDocumentType("root", "", "", "") : null), new XElement("root") });
     var doc2 = new XDocument(new object[] { new XDocumentType("root", "", "", ""), new XElement("root") });
     VerifyComparison(checkHashCode, doc1, doc2);
 }
Ejemplo n.º 22
0
 public static void ElementsOnXDocBeforeAndAfter()
 {
     XElement a = new XElement("A", "a"), b = new XElement("B", "b");
     a.Add(b);
     XDocument xDoc = new XDocument(a);
     IEnumerable<XElement> nodes = xDoc.Elements();
     Assert.Equal(1, nodes.Count());
     a.Remove();
     Assert.Equal(0, nodes.Count());
 }
Ejemplo n.º 23
0
 public void DifferentDocumentSameNamespaceSameNameElements()
 {
     XDocument xDoc1 = new XDocument(new XElement("{Namespace}Name"));
     XDocument xDoc2 = new XDocument(new XElement("{Namespace}Name"));
     Assert.Same((xDoc1.FirstNode as XElement).Name.Namespace, (xDoc2.FirstNode as XElement).Name.Namespace);
     Assert.Same((xDoc1.FirstNode as XElement).Name, (xDoc2.FirstNode as XElement).Name);
 }
Ejemplo n.º 24
0
		void BuildTreeStore (XDocument doc)
		{
			outlineStore = new TreeStore (typeof (object));
			BuildTreeChildren (Gtk.TreeIter.Zero, doc);
		}
        /// <summary>
        /// Gets the Open Search XML for the current site. You can customize the contents of this XML here. See
        /// http://www.hanselman.com/blog/CommentView.aspx?guid=50cc95b1-c043-451f-9bc2-696dc564766d#commentstart
        /// http://www.opensearch.org
        /// </summary>
        /// <returns>The Open Search XML for the current site.</returns>
        public string GetOpenSearchXml()
        {
            // Short name must be less than or equal to 16 characters.
            string shortName = "Search";
            string description = "Search the ASP.NET MVC Boilerplate Site";
            // The link to the search page with the query string set to 'searchTerms' which gets replaced with a user 
            // defined query.
            string searchUrl = this.urlHelper.AbsoluteRouteUrl(
                HomeControllerRoute.GetSearch, 
                new { query = "{searchTerms}" });
            // The link to the page with the search form on it. The home page has the search form on it.
            string searchFormUrl = this.urlHelper.AbsoluteRouteUrl(HomeControllerRoute.GetIndex);
            // The link to the favicon.ico file for the site.
            string favicon16Url = this.urlHelper.AbsoluteContent("~/content/icons/favicon.ico");
            // The link to the favicon.png file for the site.
            string favicon32Url = this.urlHelper.AbsoluteContent("~/content/icons/favicon-32x32.png");
            // The link to the favicon.png file for the site.
            string favicon96Url = this.urlHelper.AbsoluteContent("~/content/icons/favicon-96x96.png");

            XNamespace ns = "http://a9.com/-/spec/opensearch/1.1";
            XDocument document = new XDocument(
                new XElement(
                    ns + "OpenSearchDescription",
                    new XElement(ns + "ShortName", shortName),
                    new XElement(ns + "Description", description),
                    new XElement(ns + "Url",
                        new XAttribute("type", "text/html"),
                        new XAttribute("method", "get"),
                        new XAttribute("template", searchUrl)),
                    // Search results can also be returned as RSS. Here, our start index is zero for the first result.
                    // new XElement(ns + "Url",
                    //     new XAttribute("type", "application/rss+xml"),
                    //     new XAttribute("indexOffset", "0"),
                    //     new XAttribute("rel", "results"),
                    //     new XAttribute("template", "http://example.com/?q={searchTerms}&amp;start={startIndex?}&amp;format=rss")),
                    // Search suggestions can also be returned as JSON.
                    // new XElement(ns + "Url",
                    //     new XAttribute("type", "application/json"),
                    //     new XAttribute("indexOffset", "0"),
                    //     new XAttribute("rel", "suggestions"),
                    //     new XAttribute("template", "http://example.com/suggest?q={searchTerms}")),
                    new XElement(
                        ns + "Image", 
                        favicon16Url,
                        new XAttribute("height", "16"),
                        new XAttribute("width", "16"),
                        new XAttribute("type", "image/x-icon")),
                    new XElement(
                        ns + "Image", 
                        favicon32Url,
                        new XAttribute("height", "32"),
                        new XAttribute("width", "32"),
                        new XAttribute("type", "image/png")),
                    new XElement(
                        ns + "Image", 
                        favicon96Url,
                        new XAttribute("height", "96"),
                        new XAttribute("width", "96"),
                        new XAttribute("type", "image/png")),
                    new XElement(ns + "InputEncoding", "UTF-8"),
                    new XElement(ns + "SearchForm", searchFormUrl)));

            return document.ToString(Encoding.UTF8);
        }
Ejemplo n.º 26
0
 public void CastToInterface()
 {
     XDocument doc = new XDocument();
     Assert.IsAssignableFrom<IXmlLineInfo>(doc);
     Assert.IsAssignableFrom<IXmlLineInfo>(doc.CreateReader());
 }
Ejemplo n.º 27
0
 public static void NodesOnXDocBeforeAndAfter()
 {
     XText aText = new XText("a"), bText = new XText("b");
     XElement a = new XElement("A", aText, bText);
     XDocument xDoc = new XDocument(a);
     IEnumerable<XNode> nodes = xDoc.Nodes();
     Assert.Equal(1, nodes.Count());
     a.Remove();
     Assert.Equal(0, nodes.Count());
 }
Ejemplo n.º 28
0
 public void DocumentTest()
 {
     XDocument expected = new XDocument();
     _settings.Document = expected;
     Assert.AreEqual(expected, _settings.Document, "ClassLibrary.Settings.Document property test failed");
 }
Ejemplo n.º 29
0
 public static void DescendantsWithXNameOnXDocBeforeAndAfter()
 {
     XElement a = new XElement("A", "a"), b = new XElement("B", "b");
     b.Add(b, b); a.Add(b);
     XDocument xDoc = new XDocument(a);
     IEnumerable<XElement> nodes = xDoc.Descendants("B");
     Assert.Equal(4, nodes.Count());
     b.Remove();
     Assert.Equal(0, nodes.Count());
 }
Ejemplo n.º 30
0
        public void Document1()
        {
            object[] content = new object[]
            {
                new object[] { new string[] { " ", null, " " }, "  " },
                new object[] { new string[] { " ", " \t" }, new XText("  \t") },
                new object[] { new XText[] { new XText(" "), new XText("\t") }, new XText(" \t") },
                new XDocumentType("root", "", "", ""), new XProcessingInstruction("PI1", ""), new XText("\n"),
                new XText("\t"), new XText("       "), new XProcessingInstruction("PI1", ""), new XElement("myroot"),
                new XProcessingInstruction("PI2", "click"),
                new object[]
                {
                    new XElement("X", new XAttribute("id", "a1"), new XText("hula")),
                    new XElement("X", new XText("hula"), new XAttribute("id", "a1"))
                },
                new XComment(""),
                new XComment("comment"),
            };

            foreach (object[] objs in content.NonRecursiveVariations(4))
            {
                XDocument doc1 = null;
                XDocument doc2 = null;
                try
                {
                    object[] o1 = ExpandAndProtectTextNodes(objs, 0).ToArray();
                    object[] o2 = ExpandAndProtectTextNodes(objs, 1).ToArray();
                    if (o1.Select(x => new ExpectedValue(false, x)).IsXDocValid()
                        || o2.Select(x => new ExpectedValue(false, x)).IsXDocValid()) continue;
                    doc1 = new XDocument(o1);
                    doc2 = new XDocument(o2);
                    VerifyComparison(true, doc1, doc2);
                }
                catch (InvalidOperationException)
                {
                    // some combination produced from the array are invalid
                    continue;
                }
                finally
                {
                    if (doc1 != null) doc1.RemoveNodes();
                    if (doc2 != null) doc2.RemoveNodes();
                }
            }
        }