use of org.w3c.dom.DOMException in project robovm by robovm.
the class DocumentCreateAttributeNS method testCreateAttributeNS4.
public void testCreateAttributeNS4() throws Throwable {
Document doc;
String namespaceURI = "http://www.w3.org/DOM/Test/Level2";
String qualifiedName;
List<String> qualifiedNames = new ArrayList<String>();
qualifiedNames.add("_:");
qualifiedNames.add(":0a");
qualifiedNames.add(":");
qualifiedNames.add("a:b:c");
qualifiedNames.add("_::a");
doc = (Document) load("staffNS", builder);
for (int indexN1004E = 0; indexN1004E < qualifiedNames.size(); indexN1004E++) {
qualifiedName = (String) qualifiedNames.get(indexN1004E);
{
// Our exception priorities differ from the spec
try {
doc.createAttributeNS(namespaceURI, qualifiedName);
fail();
} catch (DOMException ex) {
}
// END android-changed
}
}
}
use of org.w3c.dom.DOMException 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.DOMException 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.DOMException 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);
}
}
use of org.w3c.dom.DOMException in project robovm by robovm.
the class CreateElementNS method testCreateElementNS4.
public void testCreateElementNS4() throws Throwable {
String namespaceURI = "http://www.w3.org/XML/1998/namespaces";
String qualifiedName = "xml:element1";
Document doc;
doc = (Document) load("staffNS", builder);
{
boolean success = false;
try {
doc.createElementNS(namespaceURI, qualifiedName);
} catch (DOMException ex) {
success = (ex.code == DOMException.NAMESPACE_ERR);
}
assertTrue("throw_NAMESPACE_ERR", success);
}
}
Aggregations