ICU-3501 Reduce dependency on xerces

X-SVN-Rev: 16001
This commit is contained in:
George Rhoten 2004-07-15 06:11:15 +00:00
parent ceecae267f
commit 631687c0f1
5 changed files with 20 additions and 19 deletions

View file

@ -12,7 +12,7 @@ import java.awt.event.*;
import java.io.*;
import java.util.*;
import org.apache.xerces.dom.*;
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xml.serialize.*;
import org.w3c.dom.*;
@ -566,7 +566,7 @@ public class RBReporter extends JFrame {
*/
public Document getXMLReportz(boolean detailed) {
DocumentImpl xml = new DocumentImpl();
Document xml = new DocumentImpl();
Element root = xml.createElement("REPORT");
root.setAttribute("BASECLASS", rbm.getBaseClass());
root.setAttribute("DATE", (new Date()).toString());

View file

@ -11,7 +11,7 @@ import java.io.*;
import javax.swing.*;
import java.util.*;
import org.apache.xerces.dom.*;
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xml.serialize.*;
import org.w3c.dom.*;
@ -94,7 +94,7 @@ public class RBTMXExporter extends RBExporter {
return "";
}
private void appendTUV(DocumentImpl xml, Element tu, BundleItem item) {
private void appendTUV(Document xml, Element tu, BundleItem item) {
Element tuv = xml.createElement("tuv");
tuv.setAttribute("lang", convertEncoding(item));
tuv.setAttribute("creationdate",convertToISO(item.getCreatedDate()));
@ -149,7 +149,7 @@ public class RBTMXExporter extends RBExporter {
Vector bundle_v = rbm.getBundles();
Bundle main_bundle = (Bundle)bundle_v.elementAt(0);
DocumentImpl xml = new DocumentImpl();
Document xml = new DocumentImpl();
Element root = xml.createElement("tmx");
root.setAttribute("version", "1.2");
xml.appendChild(root);

View file

@ -9,7 +9,8 @@ package com.ibm.rbm;
import java.io.*;
import java.util.*;
import org.apache.xerces.parsers.DOMParser;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
@ -56,16 +57,17 @@ public class RBTMXImporter extends RBImporter {
File tmx_file = getChosenFile();
try {
InputSource is = new InputSource(new FileInputStream(tmx_file));
//is.setEncoding("UTF-8");
DOMParser parser = new DOMParser();
parser.parse(is);
tmx_xml = parser.getDocument();
FileInputStream fis = new FileInputStream(tmx_file);
InputSource is = new InputSource(fis);
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
tmx_xml = builder.parse(is);
fis.close();
} catch (Exception e) {
RBManagerGUI.debugMsg(e.getMessage());
e.printStackTrace(System.err);
throw new IOException(e.getMessage());
}
if (tmx_xml == null) return;
if (tmx_xml == null)
return;
importDoc();
}

View file

@ -51,13 +51,11 @@ public class RBxliffImporter extends RBImporter {
protected void beginImport() throws IOException {
super.beginImport();
File xlf_file = getChosenFile();
FileInputStream fis;
try {
fis = new FileInputStream(xlf_file);
FileInputStream fis = new FileInputStream(xlf_file);
InputSource is = new InputSource(fis);
DocumentBuilder builder;
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
xlf_xml = builder.parse(is);
fis.close();
}
@ -73,7 +71,6 @@ public class RBxliffImporter extends RBImporter {
return;
importDoc();
fis.close();
}
@ -99,7 +96,8 @@ public class RBxliffImporter extends RBImporter {
while (header != null
&& !(header.getNodeType() == Node.ELEMENT_NODE
&& (header.getNodeName().equalsIgnoreCase("header")
|| header.getNodeName().equalsIgnoreCase("body")))) {
|| header.getNodeName().equalsIgnoreCase("body"))))
{
header = header.getNextSibling();
}
if (header.getNodeName().equalsIgnoreCase("header")) {

View file

@ -1526,6 +1526,7 @@ class RBManagerMenuBar extends JMenuBar {
boolean xmlAvailable;
try {
Class.forName("org.apache.xerces.parsers.DOMParser");
Class.forName("javax.xml.parsers.DocumentBuilder");
xmlAvailable = true;
} catch (ClassNotFoundException e) {
xmlAvailable = false;