use of org.w3c.dom.DOMImplementation in project robovm by robovm.
the class DOMImplementationCreateDocumentType method testCreateDocumentType1.
/**
* Runs the test case.
*
* @throws Throwable
* Any uncaught exception causes test to fail
*/
public void testCreateDocumentType1() throws Throwable {
Document doc;
DOMImplementation domImpl;
DocumentType newDocType;
Document ownerDocument;
String qualifiedName = "test:root";
String publicId;
String systemId;
List<String> publicIds = new ArrayList<String>();
publicIds.add("1234");
publicIds.add("test");
List<String> systemIds = new ArrayList<String>();
systemIds.add("");
systemIds.add("test");
doc = (Document) load("staffNS", builder);
domImpl = doc.getImplementation();
for (int indexN1005D = 0; indexN1005D < publicIds.size(); indexN1005D++) {
publicId = (String) publicIds.get(indexN1005D);
for (int indexN10061 = 0; indexN10061 < systemIds.size(); indexN10061++) {
systemId = (String) systemIds.get(indexN10061);
newDocType = domImpl.createDocumentType(qualifiedName, publicId, systemId);
assertNotNull("domimplementationcreatedocumenttype01_newDocType", newDocType);
ownerDocument = newDocType.getOwnerDocument();
assertNull("domimplementationcreatedocumenttype01_ownerDocument", ownerDocument);
}
}
}
use of org.w3c.dom.DOMImplementation in project robovm by robovm.
the class CreateDocument method testCreateDocument7.
public void testCreateDocument7() throws Throwable {
String namespaceURI = "http://www.ecommerce.org/schema";
String qualifiedName = "y:x";
Document doc;
DocumentType docType = null;
DOMImplementation domImpl;
Document aNewDoc;
String nodeName;
String nodeValue;
doc = (Document) load("staffNS", builder);
domImpl = doc.getImplementation();
aNewDoc = domImpl.createDocument(namespaceURI, qualifiedName, docType);
nodeName = aNewDoc.getNodeName();
nodeValue = aNewDoc.getNodeValue();
assertEquals("nodeName", "#document", nodeName);
assertNull("nodeValue", nodeValue);
}
use of org.w3c.dom.DOMImplementation 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.DOMImplementation 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.DOMImplementation in project robovm by robovm.
the class CreateDocumentType method testCreateDocumentType1.
/**
* Runs the test case.
*
* @throws Throwable
* Any uncaught exception causes test to fail
*/
public void testCreateDocumentType1() throws Throwable {
String publicId = "STAFF";
String systemId = "staff.xml";
String malformedName = "prefix::local";
Document doc;
DOMImplementation domImpl;
doc = (Document) load("staffNS", builder);
domImpl = doc.getImplementation();
{
boolean success = false;
try {
domImpl.createDocumentType(malformedName, publicId, systemId);
} catch (DOMException ex) {
success = (ex.code == DOMException.NAMESPACE_ERR);
}
assertTrue("throw_NAMESPACE_ERR", success);
}
}
Aggregations