diff options
author | Andre Weinand | 2003-11-18 23:39:46 +0000 |
---|---|---|
committer | Andre Weinand | 2003-11-18 23:39:46 +0000 |
commit | 3cd21647b6294598e82f15b18e7f85b6da4a7e3d (patch) | |
tree | f8d621855d58ff5eaf605d035ad8c8ee807f74b9 | |
parent | 83ec631e6a1bee33d8d6a17c94acb138604360bc (diff) | |
download | eclipse.platform.team-3cd21647b6294598e82f15b18e7f85b6da4a7e3d.tar.gz eclipse.platform.team-3cd21647b6294598e82f15b18e7f85b6da4a7e3d.tar.xz eclipse.platform.team-3cd21647b6294598e82f15b18e7f85b6da4a7e3d.zip |
fixed #37696
6 files changed, 131 insertions, 83 deletions
diff --git a/examples/org.eclipse.compare.examples.xml/.classpath b/examples/org.eclipse.compare.examples.xml/.classpath index 1b75bf4c5..ecaa4bc0b 100644 --- a/examples/org.eclipse.compare.examples.xml/.classpath +++ b/examples/org.eclipse.compare.examples.xml/.classpath @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry sourcepath="JRE_SRC" kind="var" path="JRE_LIB"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="tests"/> - <classpathentry kind="src" path="/org.eclipse.compare"/> <classpathentry kind="src" path="/org.eclipse.ui"/> - <classpathentry kind="src" path="/org.apache.xerces"/> - <classpathentry kind="src" path="/org.eclipse.jdt.ui"/> - <classpathentry kind="src" path="/org.eclipse.core.runtime"/> - <classpathentry kind="src" path="/org.junit"/> + <classpathentry kind="src" path="/org.eclipse.core.resources"/> + <classpathentry kind="src" path="/org.eclipse.compare"/> <classpathentry kind="src" path="/org.eclipse.jface.text"/> + <classpathentry kind="src" path="/org.junit"/> + <classpathentry kind="src" path="/org.eclipse.core.boot"/> + <classpathentry kind="src" path="/org.eclipse.core.runtime"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/examples/org.eclipse.compare.examples.xml/.project b/examples/org.eclipse.compare.examples.xml/.project index 87cf748e2..a36ffc059 100644 --- a/examples/org.eclipse.compare.examples.xml/.project +++ b/examples/org.eclipse.compare.examples.xml/.project @@ -3,11 +3,11 @@ <name>org.eclipse.compare.examples.xml</name> <comment></comment> <projects> - <project>org.apache.xerces</project> <project>org.eclipse.compare</project> <project>org.eclipse.compare.xml</project> + <project>org.eclipse.core.boot</project> + <project>org.eclipse.core.resources</project> <project>org.eclipse.core.runtime</project> - <project>org.eclipse.jdt.ui</project> <project>org.eclipse.jface.text</project> <project>org.eclipse.swt</project> <project>org.eclipse.ui</project> diff --git a/examples/org.eclipse.compare.examples.xml/plugin.xml b/examples/org.eclipse.compare.examples.xml/plugin.xml index 7b0cc9b99..a81033f43 100644 --- a/examples/org.eclipse.compare.examples.xml/plugin.xml +++ b/examples/org.eclipse.compare.examples.xml/plugin.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> - <plugin id="org.eclipse.compare.examples.xml" name="%pluginName" @@ -8,64 +7,92 @@ provider-name="%providerName" class="org.eclipse.compare.examples.xml.XMLPlugin"> - <requires> - <import plugin="org.eclipse.ui"/> - <import plugin="org.eclipse.core.resources"/> - <import plugin="org.eclipse.compare"/> - <import plugin="org.apache.xerces"/> - </requires> - - <runtime> - <library name="xmlcompareexamples.jar"> - <export name="*"/> - </library> - </runtime> + <runtime> + <library name="xmlcompareexamples.jar"> + <export name="*"/> + </library> + </runtime> + <requires> + <import plugin="org.eclipse.ui"/> + <import plugin="org.eclipse.core.resources"/> + <import plugin="org.eclipse.compare"/> + <import plugin="org.eclipse.jface.text"/> + <import plugin="org.junit"/> + </requires> - <extension-point - id="idMapping" - name="%idMapping" - schema="schema/idMapping.exsd" - /> - <extension - point="org.eclipse.compare.examples.xml.idMapping"> - - <idmap id="antMap" name="%antMap"> - <mapping signature="project" id="name"/> - <mapping signature="project>target" id="name"/> - <ordered signature="project>target"/> - </idmap> - - <idmap id="eclipsePluginMap" name="%eclipsePluginMap"> - <mapping signature="plugin" id="id"/> - <mapping signature="plugin>requires>import" id="plugin"/> - <mapping signature="plugin>runtime>library" id="name"/> - <mapping signature="plugin>runtime>library>export" id="name"/> - <mapping signature="plugin>extension-point" id="id"/> - <mapping signature="plugin>extension" id="point"/> - </idmap> - - <idmap id="classpathMap" name="%classpathMap" extension="CLASSPATH"> - <mapping signature="classpath>classpathentry" id="path"/> - </idmap> - - </extension> + <extension-point id="idMapping" name="%idMapping" schema="schema/idMapping.exsd"/> - <extension - point="org.eclipse.compare.structureMergeViewers"> - <structureMergeViewer - extensions="xml,classpath" - class="org.eclipse.compare.examples.xml.XMLStructureViewerCreator"> - </structureMergeViewer> - </extension> - - <extension - point="org.eclipse.ui.preferencePages"> - <page name="%pluginNamePreferencePage" - id="org.eclipse.compare.examples.xml.XMLComparePreferencePage" - class="org.eclipse.compare.examples.xml.XMLComparePreferencePage" - category= "org.eclipse.ui.preferencePages.Workbench"> - </page> - </extension> + <extension + point="org.eclipse.compare.examples.xml.idMapping"> + <idmap + name="%antMap" + id="antMap"> + <mapping + signature="project" + id="name"> + </mapping> + <mapping + signature="project>target" + id="name"> + </mapping> + <ordered + signature="project>target"> + </ordered> + </idmap> + <idmap + name="%eclipsePluginMap" + id="eclipsePluginMap"> + <mapping + signature="plugin" + id="id"> + </mapping> + <mapping + signature="plugin>requires>import" + id="plugin"> + </mapping> + <mapping + signature="plugin>runtime>library" + id="name"> + </mapping> + <mapping + signature="plugin>runtime>library>export" + id="name"> + </mapping> + <mapping + signature="plugin>extension-point" + id="id"> + </mapping> + <mapping + signature="plugin>extension" + id="point"> + </mapping> + </idmap> + <idmap + name="%classpathMap" + id="classpathMap" + extension="CLASSPATH"> + <mapping + signature="classpath>classpathentry" + id="path"> + </mapping> + </idmap> + </extension> + <extension + point="org.eclipse.compare.structureMergeViewers"> + <structureMergeViewer + extensions="xml,classpath" + class="org.eclipse.compare.examples.xml.XMLStructureViewerCreator"> + </structureMergeViewer> + </extension> + <extension + point="org.eclipse.ui.preferencePages"> + <page + name="%pluginNamePreferencePage" + category="org.eclipse.ui.preferencePages.Workbench" + class="org.eclipse.compare.examples.xml.XMLComparePreferencePage" + id="org.eclipse.compare.examples.xml.XMLComparePreferencePage"> + </page> + </extension> </plugin> diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLComparePreferencePage.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLComparePreferencePage.java index 77db954a2..612aff3c4 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLComparePreferencePage.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLComparePreferencePage.java @@ -27,7 +27,7 @@ import org.eclipse.ui.*; /** * The XMLComparePreferencePage is the page used to set ID Mappings for XML Compare */ -public class XMLComparePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener { +public class XMLComparePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener { private Table fIdMapsTable; private Button fAddIdMapButton; diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureCreator.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureCreator.java index b879996c0..57e548d64 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureCreator.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureCreator.java @@ -18,7 +18,9 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; -import org.apache.xerces.parsers.SAXParser; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + import org.eclipse.compare.IEditableContent; import org.eclipse.compare.IStreamContentAccessor; import org.eclipse.compare.structuremergeviewer.Differencer; @@ -86,7 +88,8 @@ public class XMLStructureCreator implements IStructureCreator { public static final char ID_SEPARATOR = '<'; public static final char ID_TYPE_BODY = '<'; - private static final String parserName = "org.apache.xerces.parsers.SAXParser"; //$NON-NLS-1$ + //private static final String parserName = "org.apache.xerces.parsers.SAXParser"; //$NON-NLS-1$ + private static final String parserName = "org.apache.crimson.parser.XMLReaderImpl"; //$NON-NLS-1$ private static boolean setValidation = false; //defaults private static boolean setNameSpaces = true; @@ -547,18 +550,28 @@ public class XMLStructureCreator implements IStructureCreator { XMLHandler handler = new XMLHandler(); try { - SAXParser parser = (SAXParser)Class.forName(parserName).newInstance(); - - parser.setFeature( "http://xml.org/sax/features/validation",setValidation); //$NON-NLS-1$ - parser.setFeature( "http://xml.org/sax/features/namespaces",setNameSpaces ); //$NON-NLS-1$ - parser.setFeature( "http://apache.org/xml/features/nonvalidating/load-external-dtd", false); //$NON-NLS-1$ - parser.setFeature( "http://apache.org/xml/features/validation/schema",setSchemaSupport ); //$NON-NLS-1$ - parser.setFeature( "http://apache.org/xml/features/validation/schema-full-checking",setSchemaFullSupport ); //$NON-NLS-1$ - - parser.setContentHandler(handler); - parser.setErrorHandler(handler); - - parser.parse(new InputSource(sca.getContents())); +// /* original xerces code +// SAXParser parser = (SAXParser)Class.forName(parserName).newInstance(); +// */ +// XMLReader parser = XMLReaderFactory.createXMLReader(parserName); +// +// parser.setFeature( "http://xml.org/sax/features/validation", setValidation); //$NON-NLS-1$ +// parser.setFeature( "http://xml.org/sax/features/namespaces", setNameSpaces ); //$NON-NLS-1$ +// /* +// parser.setFeature( "http://apache.org/xml/features/nonvalidating/load-external-dtd", false); //$NON-NLS-1$ +// parser.setFeature( "http://apache.org/xml/features/validation/schema", setSchemaSupport ); //$NON-NLS-1$ +// parser.setFeature( "http://apache.org/xml/features/validation/schema-full-checking", setSchemaFullSupport); //$NON-NLS-1$ +// */ +// parser.setContentHandler(handler); +// parser.setErrorHandler(handler); +// +// parser.parse(new InputSource(sca.getContents())); + + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + SAXParser parser = factory.newSAXParser(); + parser.parse(new InputSource(sca.getContents()), handler); + if (XMLStructureCreator.DEBUG_MODE) System.out.println("End of parse"); //$NON-NLS-1$ } catch (SAXParseException e) { XMLPlugin.log(e); diff --git a/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestXMLStructureCreator.java b/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestXMLStructureCreator.java index 811c9ca20..9a80ed14e 100644 --- a/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestXMLStructureCreator.java +++ b/examples/org.eclipse.compare.examples.xml/tests/org/eclipse/compare/examples/xml/TestXMLStructureCreator.java @@ -17,7 +17,7 @@ import junit.framework.*; import org.eclipse.jface.text.Document; -import org.eclipse.compare.IStreamContentAccessor; +import org.eclipse.compare.IStreamContentAccessorExtension2; import org.eclipse.compare.examples.xml.XMLChildren; import org.eclipse.compare.examples.xml.XMLNode; import org.eclipse.compare.examples.xml.XMLStructureCreator; @@ -28,7 +28,7 @@ public class TestXMLStructureCreator extends TestCase { Document fdoc; XMLStructureCreator fsc; - public class TestStream implements IStreamContentAccessor { + public class TestStream implements IStreamContentAccessorExtension2 { String fString; public TestStream(String string) { @@ -36,7 +36,15 @@ public class TestXMLStructureCreator extends TestCase { } public InputStream getContents() throws CoreException { - return new ByteArrayInputStream(fString.getBytes()); + try { + return new ByteArrayInputStream(fString.getBytes("UTF-16")); + } catch (Exception e) { + return new ByteArrayInputStream(fString.getBytes()); + } + } + + public String getCharset() { + return "UTF-16"; } } |