use of org.eclipse.wst.xml.core.internal.document.DOMModelImpl in project webtools.sourceediting by eclipse.
the class DOMImplementationTests method testCreateDocumentUsedDoctype.
public void testCreateDocumentUsedDoctype() {
final DOMModelImpl model = (DOMModelImpl) StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForXML.ContentTypeID_XML);
final DocumentType doctype = model.createDocumentType("bar", "publicTest", "systemTest");
IDOMDocument document = model.getDocument();
document.appendChild(doctype);
try {
model.createDocument("http://eclipse.org", "foo:bar", doctype);
} catch (DOMException e) {
assertEquals("Wrong DOMExcetion thrown", DOMException.WRONG_DOCUMENT_ERR, e.code);
return;
}
fail("Reusing the doctype from another document should have caused an exception");
}
use of org.eclipse.wst.xml.core.internal.document.DOMModelImpl in project webtools.sourceediting by eclipse.
the class DOMImplementationTests method testCreateDocumentMalformedQualifiedNames.
public void testCreateDocumentMalformedQualifiedNames() {
final DOMModelImpl model = (DOMModelImpl) StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForXML.ContentTypeID_XML);
final String[] names = { "foo:", "foo:.", "foo:-", "foo:bar:baz" };
for (int i = 0; i < names.length; i++) {
try {
model.createDocument("http://eclipse.org", names[i], null);
} catch (DOMException e) {
assertEquals("Did not receive the correct DOMException for [" + names[i] + "]", DOMException.NAMESPACE_ERR, e.code);
continue;
}
fail("Malformd qualified name [" + names[i] + "]");
}
}
use of org.eclipse.wst.xml.core.internal.document.DOMModelImpl in project webtools.sourceediting by eclipse.
the class DOMImplementationTests method testCreateDocumentIllegalNamespaceXML.
public void testCreateDocumentIllegalNamespaceXML() {
final DOMModelImpl model = (DOMModelImpl) StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForXML.ContentTypeID_XML);
try {
model.createDocument("http://eclipse.org", "xml:bar", null);
} catch (DOMException e) {
assertEquals("Did not receive the correct DOMException", DOMException.NAMESPACE_ERR, e.code);
return;
}
fail("No exceptions for illegal input");
}
use of org.eclipse.wst.xml.core.internal.document.DOMModelImpl in project webtools.sourceediting by eclipse.
the class NodeImplTestCase method setUp.
/**
* Sets up the test fixture.
* (Called before every test case method.)
*/
protected void setUp() {
DOMModelImpl model = new DOMModelImpl();
document = model.getDocument();
element = (NodeImpl) document.createElement("testelement");
attribute = (AttrImpl) document.createAttribute("attribute");
}
Aggregations