public virtual void testCopyElement() { JDFDoc d = new JDFDoc("d1"); JDFElement e = (JDFElement)d.getRoot(); JDFDoc d2 = new JDFDoc("d2"); JDFElement e2 = (JDFElement)d2.getRoot(); KElement e3 = e.copyElement(e2, null); JDFParser p = new JDFParser(); JDFDoc dp = p.parseString("<Device xmlns=\"www.CIP4.org/JDFSchema_1_1\"/>"); KElement ep = dp.getRoot(); KElement e4 = e.copyElement(ep, null); Assert.AreEqual(e4.hasAttribute("xmlns"), ep.hasAttribute("xmlns")); Assert.AreEqual(e3.getNamespaceURI(), e.getNamespaceURI()); Assert.IsFalse(d.ToString().IndexOf("xmlns=\"\"") >= 0); }
public virtual void testParseNoNS() { XMLDoc d = new XMLDoc("TEST", null); string fn = sm_dirTestDataTemp + "testParseNoNS.xml"; d.write2File(fn, 2, true); JDFParser p = new JDFParser(); JDFDoc d2 = p.parseFile(fn); KElement root = d2.getRoot(); // Assert.IsNull(root.getNamespaceURI()); Assert.IsFalse(d2.ToString().IndexOf("xmlns=\"\"") >= 0); Assert.IsFalse(d.ToString().IndexOf("xmlns=\"\"") >= 0); Assert.IsFalse(root.ToString().IndexOf("xmlns=\"\"") >= 0); KElement foo = root.appendElement("foofoo"); Assert.IsNull(foo.getNamespaceURI() == "" ? null : ""); }