From ba1491c34364c59287510359fa7a87b8a443b243 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Fri, 1 Jun 2007 09:39:32 +0000 Subject: [PATCH] 1. Fix identing xml files : - transformerFactory.setAttribute("indent-number",4); - works for jdk 1.5 and 1.6, but on 1.4 throws Exception - serializer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "4"); - works for 1.4 and 1.6. On 1.5 there is bug report which hasn't been fixed 2. Fix resource loading for jabberaccregwizz --- .../jabberaccregwizz/JabberServerChooserDialog.java | 4 +++- .../plugin/jabberaccregwizz/resources.properties | 2 +- src/net/java/sip/communicator/util/xml/XMLUtils.java | 10 ++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java index 17f569e99..35ab81330 100644 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberServerChooserDialog.java @@ -309,7 +309,9 @@ public ServerChooserTableModel() // Create the builder and parse the file serverComments = factory.newDocumentBuilder() - .parse(new File(Resources.getString("commentsFile"))); + .parse( + JabberServerChooserDialog.class.getClassLoader() + .getResourceAsStream(Resources.getString("commentsFile"))); } catch (SAXException e) { diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources.properties b/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources.properties index 32e192b68..f7532ea20 100755 --- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources.properties +++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/resources.properties @@ -29,7 +29,7 @@ userExist=This user already exist on this server. Choose another user or server. unknownXmppError=Unknown XMPP error. Verify that the server name is correct. notSamePassword=The two entered password aren't the same. -commentsFile=classes/net/java/sip/communicator/plugin/jabberaccregwizz/resources/servercomments.xml +commentsFile=net/java/sip/communicator/plugin/jabberaccregwizz/resources/servercomments.xml protocolIcon=resources/images/jabber/jabber16x16-online.png pageImage=resources/images/jabber/jabber48x48.png diff --git a/src/net/java/sip/communicator/util/xml/XMLUtils.java b/src/net/java/sip/communicator/util/xml/XMLUtils.java index 0d5dc8992..660db5be9 100644 --- a/src/net/java/sip/communicator/util/xml/XMLUtils.java +++ b/src/net/java/sip/communicator/util/xml/XMLUtils.java @@ -249,6 +249,13 @@ public static void writeXML(Document document, { DOMSource domSource = new DOMSource(document); TransformerFactory tf = TransformerFactory.newInstance(); + + // not working for jdk 1.4 + try + { + tf.setAttribute("indent-number", new Integer(4)); + }catch(Exception e){} + Transformer serializer = tf.newTransformer(); if(doctypeSystem != null) serializer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, @@ -256,6 +263,9 @@ public static void writeXML(Document document, if(doctypePublic != null) serializer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, doctypePublic); + // not working for jdk 1.5 + serializer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "4"); + serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); serializer.setOutputProperty(OutputKeys.INDENT, "yes"); serializer.transform(domSource, streamResult);