use of org.w3c.dom.DocumentType in project robovm by robovm.
the class CreateDocument method testCreateDocument1.
/**
* Runs the test case.
*
* @throws Throwable
* Any uncaught exception causes test to fail
*/
public void testCreateDocument1() throws Throwable {
String namespaceURI = "http://www.ecommerce.org/";
String malformedName = "prefix::local";
Document doc;
DocumentType docType = null;
DOMImplementation domImpl;
doc = (Document) load("staffNS", builder);
domImpl = doc.getImplementation();
boolean success = false;
try {
domImpl.createDocument(namespaceURI, malformedName, docType);
} catch (DOMException ex) {
success = (ex.code == DOMException.NAMESPACE_ERR);
}
assertTrue("throw_NAMESPACE_ERR", success);
}
use of org.w3c.dom.DocumentType in project robovm by robovm.
the class CreateDocument method testCreateDocument5.
// public void testCreateDocument3() throws Throwable {
// String namespaceURI = "http://www.ecommerce.org/schema";
// String qualifiedName = "namespaceURI:x";
// Document doc;
// DocumentType docType;
// DOMImplementation domImpl;
//
// doc = (Document) load("staffNS", builder);
// docType = doc.getDoctype();
// domImpl = doc.getImplementation();
//
// boolean success = false;
// try {
// domImpl.createDocument(namespaceURI, qualifiedName, docType);
// } catch (DOMException ex) {
// success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
// }
// assertTrue("throw_WRONG_DOCUMENT_ERR", success);
//
// }
// public void testCreateDocument4() throws Throwable {
// String namespaceURI = "http://www.ecommerce.org/schema";
// String qualifiedName = "namespaceURI:x";
// Document doc;
// DocumentType docType;
// DOMImplementation domImpl;
// Document aNewDoc;
// doc = (Document) load("staffNS", builder);
// aNewDoc = (Document) load("staffNS", builder);
// docType = doc.getDoctype();
// domImpl = aNewDoc.getImplementation();
//
// boolean success = false;
// try {
// aNewDoc = domImpl.createDocument(namespaceURI, qualifiedName,
// docType);
// } catch (DOMException ex) {
// success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
// }
// assertTrue("throw_WRONG_DOCUMENT_ERR", success);
//
// }
public void testCreateDocument5() throws Throwable {
String namespaceURI = "http://www.ecommerce.org/schema";
String qualifiedName;
Document doc;
DocumentType docType = null;
DOMImplementation domImpl;
List<String> illegalQNames = new ArrayList<String>();
illegalQNames.add("namespaceURI:{");
illegalQNames.add("namespaceURI:}");
illegalQNames.add("namespaceURI:~");
illegalQNames.add("namespaceURI:'");
illegalQNames.add("namespaceURI:!");
illegalQNames.add("namespaceURI:@");
illegalQNames.add("namespaceURI:#");
illegalQNames.add("namespaceURI:$");
illegalQNames.add("namespaceURI:%");
illegalQNames.add("namespaceURI:^");
illegalQNames.add("namespaceURI:&");
illegalQNames.add("namespaceURI:*");
illegalQNames.add("namespaceURI:(");
illegalQNames.add("namespaceURI:)");
illegalQNames.add("namespaceURI:+");
illegalQNames.add("namespaceURI:=");
illegalQNames.add("namespaceURI:[");
illegalQNames.add("namespaceURI:]");
illegalQNames.add("namespaceURI:\\");
illegalQNames.add("namespaceURI:/");
illegalQNames.add("namespaceURI:;");
illegalQNames.add("namespaceURI:`");
illegalQNames.add("namespaceURI:<");
illegalQNames.add("namespaceURI:>");
illegalQNames.add("namespaceURI:,");
illegalQNames.add("namespaceURI:a ");
illegalQNames.add("namespaceURI:\"");
doc = (Document) load("staffNS", builder);
for (int indexN1009A = 0; indexN1009A < illegalQNames.size(); indexN1009A++) {
qualifiedName = (String) illegalQNames.get(indexN1009A);
domImpl = doc.getImplementation();
boolean success = false;
try {
domImpl.createDocument(namespaceURI, qualifiedName, docType);
} catch (DOMException ex) {
success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
}
assertTrue("throw_INVALID_CHARACTER_ERR", success);
}
}
use of org.w3c.dom.DocumentType in project robovm by robovm.
the class DOMImplementationCreateDocument method testCreateDocument7.
public void testCreateDocument7() throws Throwable {
Document doc;
DOMImplementation domImpl;
String namespaceURI = "http://www.w3.org/DOMTest/level2";
DocumentType docType = null;
doc = (Document) load("staffNS", builder);
domImpl = doc.getImplementation();
{
boolean success = false;
try {
domImpl.createDocument(namespaceURI, ":", docType);
} catch (DOMException ex) {
success = (ex.code == DOMException.NAMESPACE_ERR);
}
assertTrue("domimplementationcreatedocument07", success);
}
}
use of org.w3c.dom.DocumentType in project robovm by robovm.
the class DOMImplementationCreateDocument method testCreateDocument4.
public void testCreateDocument4() throws Throwable {
Document doc;
DOMImplementation domImpl;
String namespaceURI = null;
String qualifiedName = "dom:root";
DocumentType docType = null;
doc = (Document) load("staffNS", builder);
domImpl = doc.getImplementation();
{
boolean success = false;
try {
domImpl.createDocument(namespaceURI, qualifiedName, docType);
} catch (DOMException ex) {
success = (ex.code == DOMException.NAMESPACE_ERR);
}
assertTrue("domimplementationcreatedocument04", success);
}
}
use of org.w3c.dom.DocumentType in project robovm by robovm.
the class ImportNode method testImportNode8.
// Assumes validation.
// public void testImportNode7() throws Throwable {
// Document doc;
// Document aNewDoc;
// Element element;
// Node aNode;
// NamedNodeMap attributes;
// String name;
// Node attr;
// String lname;
// String namespaceURI = "http://www.nist.gov";
// String qualifiedName = "emp:employee";
// doc = (Document) load("staffNS", builder);
// aNewDoc = (Document) load("staff", builder);
// element = aNewDoc.createElementNS(namespaceURI, qualifiedName);
// aNode = doc.importNode(element, false);
// attributes = aNode.getAttributes();
// assertEquals("throw_Size", 1, attributes.getLength());
// name = aNode.getNodeName();
// assertEquals("nodeName", "emp:employee", name);
// attr = attributes.item(0);
// lname = attr.getLocalName();
// assertEquals("lname", "defaultAttr", lname);
// }
public void testImportNode8() throws Throwable {
Document doc;
Document aNewDoc;
DocumentFragment docFrag;
Node aNode;
boolean hasChild;
Document ownerDocument;
DocumentType docType;
String system;
doc = (Document) load("staffNS", builder);
aNewDoc = (Document) load("staffNS", builder);
docFrag = aNewDoc.createDocumentFragment();
aNode = doc.importNode(docFrag, false);
hasChild = aNode.hasChildNodes();
assertFalse("hasChild", hasChild);
ownerDocument = aNode.getOwnerDocument();
docType = ownerDocument.getDoctype();
system = docType.getSystemId();
assertURIEquals("system", null, null, null, "staffNS.dtd", null, null, null, null, system);
}
Aggregations