Methods Summary |
---|
public java.io.InputStream | createStream(java.lang.String bytes)
int byteCount = bytes.length() / 2;
byte[] array = new byte[byteCount];
for (int i = 0; i < byteCount; i++) {
array[i] = Byte.parseByte(bytes.substring(i * 2, i * 2 + 2), 16);
}
return new java.io.ByteArrayInputStream(array);
|
public java.lang.String | createTempURI(java.lang.String scheme)
if (scheme == null) {
throw new NullPointerException("scheme");
}
if ("file".equals(scheme)) {
try {
File tempFile = File.createTempFile("domts", ".xml");
try {
//
// if available use JDK 1.4's File.toURI().toString()
//
Method method = File.class.getMethod("toURI", null);
Object uri = method.invoke(tempFile, null);
return uri.toString();
}
catch (NoSuchMethodException ex) {
//
// File.toURL is not as robust
//
URL url = tempFile.toURL();
return url.toString();
}
}
catch (Exception ex) {
throw new DOMTestLoadException(ex);
}
}
if ("http".equals(scheme)) {
String httpBase = System.getProperty("org.w3c.domts.httpbase",
"http://localhost:8080/webdav/");
java.lang.StringBuffer buf = new StringBuffer(httpBase);
if (!httpBase.endsWith("/")) {
buf.append("/");
}
buf.append("tmp");
buf.append( (new java.util.Random()).nextInt(Integer.MAX_VALUE));
buf.append(".xml");
return buf.toString();
}
throw new DOMTestLoadException(new Exception("Unrecognized URI scheme " +
scheme));
|
public java.lang.Object | createXPathEvaluator(org.w3c.dom.Document doc)
return factory.createXPathEvaluator(doc);
|
public final java.lang.String | getContentType()
return factory.getContentType();
|
protected DOMTestDocumentBuilderFactory | getFactory()
return factory;
|
public org.w3c.dom.DOMImplementation | getImplementation()
return factory.getDOMImplementation();
|
public final int | getMutationCount()Implementation of EventListener.handleEvent
This method is called when a mutation is reported for a document that
was declared to not be modified during testing
return mutationCount;
|
public java.lang.String | getResourceURI(java.lang.String href, java.lang.String scheme, java.lang.String contentType)
if (scheme == null) {
throw new NullPointerException("scheme");
}
if ("file".equals(scheme)) {
return resolveURI(href).toString();
}
if ("http".equals(scheme)) {
StringBuffer httpURL = new StringBuffer(
System.getProperty("org.w3c.domts.httpbase",
"http://localhost:8080/webdav/"));
httpURL.append(href);
if ("application/pdf".equals(contentType)) {
httpURL.append(".pdf");
}
else {
httpURL.append(".xml");
}
return httpURL.toString();
}
throw new DOMTestLoadException(new Exception("Unrecognized URI scheme " +
scheme));
|
public abstract java.lang.String | getTargetURI()
|
public boolean | hasFeature(java.lang.String feature, java.lang.String version)
return factory.hasFeature(feature, version);
|
public boolean | hasSetting(DocumentBuilderSetting setting)
return setting.hasSetting(factory);
|
public final boolean | isCoalescing()
return factory.isCoalescing();
|
public final boolean | isExpandEntityReferences()
return factory.isExpandEntityReferences();
|
public final boolean | isHasNullString()
return true;
|
public final boolean | isIgnoringElementContentWhitespace()
return factory.isIgnoringElementContentWhitespace();
|
public final boolean | isNamespaceAware()
return factory.isNamespaceAware();
|
public final boolean | isSigned()
return true;
|
public final boolean | isValidating()
return factory.isValidating();
|
public org.w3c.dom.Document | load(java.lang.String docURI, boolean willBeModified)
Document doc = factory.load(resolveURI(docURI));
//
// if will be modified is false and doc is an EventTarget
//
/*
* wBM: if (!willBeModified && doc instanceof EventTarget) {
* ((EventTarget) doc).addEventListener("DOMSubtreeModified", this,
* false); }
*/
return doc;
|
public void | preload(java.lang.String contentType, java.lang.String docURI, boolean willBeModified)
if ("text/html".equals(contentType) ||
"application/xhtml+xml".equals(contentType)) {
if (docURI.startsWith("staff") || docURI.equals("datatype_normalization")) {
throw DOMTestIncompatibleException.incompatibleLoad(docURI, contentType);
}
}
|
private java.net.URL | resolveURI(java.lang.String baseURI)
String docURI = factory.addExtension(baseURI);
URL resolvedURI = null;
try {
resolvedURI = new URL(docURI);
if (resolvedURI.getProtocol() != null) {
return resolvedURI;
}
}
catch (MalformedURLException ex) {
// throw new DOMTestLoadException(ex);
}
//
// build a URL for a test file in the JAR
//
resolvedURI = getClass().getResource("/" + docURI);
if (resolvedURI == null) {
//
// see if it is an absolute URI
//
int firstSlash = docURI.indexOf('/");
try {
if (firstSlash == 0
|| (firstSlash >= 1
&& docURI.charAt(firstSlash - 1) == ':")) {
resolvedURI = new URL(docURI);
}
else {
//
// try the files/level?/spec directory
//
String filename = getClass().getPackage().getName();
filename =
"tests/"
+ filename.substring(14).replace('.", '/")
+ "/files/"
+ docURI;
resolvedURI = new java.io.File(filename).toURL();
}
}
catch (MalformedURLException ex) {
throw new DOMTestLoadException(ex);
}
}
if (resolvedURI == null) {
throw new DOMTestLoadException(
new java.io.FileNotFoundException(docURI));
}
return resolvedURI;
|
protected void | setFactory(DOMTestDocumentBuilderFactory factory)Should only be called in the constructor of a derived type.
this.factory = factory;
|