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
cusax-fix
Damian Minkov 19 years ago
parent 568464c2fc
commit ba1491c343

@ -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)
{

@ -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

@ -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);

Loading…
Cancel
Save