Пример #1
0
        public virtual void testgetNodeNames()
        {
            XMLDoc   d = new XMLDoc("doc", null);
            KElement e = d.getRoot();

            e.appendElement("a1");
            e.appendElement("b:a2", "b");
            VElement v = e.getChildElementVector(null, null, null, true, 0, true);
            VString  s = v.getElementNameVector(false);

            CollectionAssert.AreEqual(new VString("a1 b:a2", " "), s);
            s = v.getElementNameVector(true);
            CollectionAssert.AreEqual(new VString("a1 a2", " "), s);
        }
Пример #2
0
        ///
        ///	 <summary> * remove duplicate warnings from the list and set schemaloction
        ///	 *  </summary>
        ///	 * <param name="schemaLocation"> </param>
        ///
        public virtual void cleanXML(string schemaLocation)
        {
            VElement v = root.getChildElementVector(null, null, null, true, 0, false);

            v.unifyElement();
            root.removeChildren(null, null, null);
            int size = v.Count;

            for (int i = 0; i < size; i++)
            {
                root.appendChild(v.item(i));
            }
            if (schemaLocation == null)
            {
                root.setAttribute("ValidationResult", "NotPerformed");
            }
            else
            {
                root.setAttribute("SchemaLocation", schemaLocation);
                if (root.hasChildElement("FatalError", null))
                {
                    root.setAttribute("ValidationResult", "FatalError");
                }
                else if (root.hasChildElement("Error", null))
                {
                    root.setAttribute("ValidationResult", "Error");
                }
                else if (root.hasChildElement("Warning", null))
                {
                    root.setAttribute("ValidationResult", "Warning");
                }
                else
                {
                    root.setAttribute("ValidationResult", "Valid");
                }
            }
        }