Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2008-11-14 23:17:24 +0000
committerChris Goldthorpe2008-11-14 23:17:24 +0000
commit3c2c7c0b47b22bb759ca540514d23c484bd7021c (patch)
tree64374cf766decfaa4b0b717a856cfbb5e0869bbd /org.eclipse.ua.tests/base/org/eclipse/ua/tests/util
parenta218f8d5ad03c1f3ff06a5768b82a4f123f2bf34 (diff)
downloadeclipse.platform.ua-3c2c7c0b47b22bb759ca540514d23c484bd7021c.tar.gz
eclipse.platform.ua-3c2c7c0b47b22bb759ca540514d23c484bd7021c.tar.xz
eclipse.platform.ua-3c2c7c0b47b22bb759ca540514d23c484bd7021c.zip
Add test for XMLProcessor with entities
Diffstat (limited to 'org.eclipse.ua.tests/base/org/eclipse/ua/tests/util')
-rw-r--r--org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/XMLUtil.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/XMLUtil.java b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/XMLUtil.java
index eb60075a3..ac4b6ee5a 100644
--- a/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/XMLUtil.java
+++ b/org.eclipse.ua.tests/base/org/eclipse/ua/tests/util/XMLUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,8 +11,8 @@
package org.eclipse.ua.tests.util;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.io.InputStream;
-import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -23,7 +23,9 @@ import javax.xml.parsers.SAXParserFactory;
import junit.framework.Assert;
+import org.eclipse.help.internal.entityresolver.LocalEntityResolver;
import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@@ -56,6 +58,7 @@ public class XMLUtil extends Assert {
private static class Handler extends DefaultHandler {
private StringBuffer buf = new StringBuffer();
+ private EntityResolver entityResolver = new LocalEntityResolver();
/* (non-Javadoc)
* @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
@@ -106,7 +109,11 @@ public class XMLUtil extends Assert {
* @see org.xml.sax.helpers.DefaultHandler#resolveEntity(java.lang.String, java.lang.String)
*/
public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
- return new InputSource(new StringReader("")); //$NON-NLS-1$
+ try {
+ return entityResolver.resolveEntity(publicId, systemId);
+ } catch (IOException e) {
+ throw new SAXException();
+ }
}
public String toString() {

Back to the top