Commit 5b0e0c92 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Formatting.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@922 b35dd754-fafc-0310-a699-88a17e54d16e
parent 919511cd
...@@ -267,59 +267,52 @@ public class XPPPacketReader { ...@@ -267,59 +267,52 @@ public class XPPPacketReader {
int type = -1; int type = -1;
type = pp.nextToken(); type = pp.nextToken();
switch (type) { switch (type) {
case XmlPullParser.PROCESSING_INSTRUCTION: case XmlPullParser.PROCESSING_INSTRUCTION: {
{ String text = pp.getText();
String text = pp.getText(); int loc = text.indexOf(" ");
int loc = text.indexOf(" "); if (loc >= 0) {
if (loc >= 0) { document.addProcessingInstruction(text.substring(0, loc), text.substring(loc + 1));
document.addProcessingInstruction(text.substring(0, loc), text.substring(loc + 1));
}
else
document.addProcessingInstruction(text, "");
break;
} }
case XmlPullParser.COMMENT: else
{ document.addProcessingInstruction(text, "");
if (parent != null) break;
parent.addComment(pp.getText()); }
else case XmlPullParser.COMMENT: {
document.addComment(pp.getText()); if (parent != null)
break; parent.addComment(pp.getText());
else
document.addComment(pp.getText());
break;
}
case XmlPullParser.CDSECT: {
String text = pp.getText();
if (parent != null) {
parent.addCDATA(text);
} }
case XmlPullParser.CDSECT: else {
{ if (text.trim().length() > 0) {
String text = pp.getText(); throw new DocumentException("Cannot have text content outside of the root document");
if (parent != null) {
parent.addCDATA(text);
} }
else { }
if (text.trim().length() > 0) { break;
throw new DocumentException("Cannot have text content outside of the root document");
}
}
break;
}
case XmlPullParser.ENTITY_REF: {
String text = pp.getText();
if (parent != null) {
parent.addText(text);
} }
case XmlPullParser.ENTITY_REF: else {
{ if (text.trim().length() > 0) {
String text = pp.getText(); throw new DocumentException("Cannot have an entityref outside of the root document");
if (parent != null) {
parent.addText(text);
}
else {
if (text.trim().length() > 0) {
throw new DocumentException("Cannot have an entityref outside of the root document");
}
} }
break;
}
case XmlPullParser.END_DOCUMENT:
{
return document;
} }
case XmlPullParser.START_TAG: break;
{ }
case XmlPullParser.END_DOCUMENT: {
return document;
}
case XmlPullParser.START_TAG: {
QName qname = (pp.getPrefix() == null) ? df.createQName(pp.getName(), pp.getNamespace()) : df.createQName(pp.getName(), pp.getPrefix(), pp.getNamespace()); QName qname = (pp.getPrefix() == null) ? df.createQName(pp.getName(), pp.getNamespace()) : df.createQName(pp.getName(), pp.getPrefix(), pp.getNamespace());
Element newElement = null; Element newElement = null;
if ("jabber:client".equals(qname.getNamespaceURI())) { if ("jabber:client".equals(qname.getNamespaceURI())) {
...@@ -348,34 +341,32 @@ public class XPPPacketReader { ...@@ -348,34 +341,32 @@ public class XPPPacketReader {
count++; count++;
break; break;
} }
case XmlPullParser.END_TAG: case XmlPullParser.END_TAG: {
{ if (parent != null) {
if (parent != null) { parent = parent.getParent();
parent = parent.getParent();
}
count--;
if (count == 0) {
return document;
}
break;
} }
case XmlPullParser.TEXT: count--;
{ if (count == 0) {
String text = pp.getText(); return document;
if (parent != null) { }
parent.addText(text); break;
} }
else { case XmlPullParser.TEXT: {
if (text.trim().length() > 0) { String text = pp.getText();
throw new DocumentException("Cannot have text content outside of the root document"); if (parent != null) {
} parent.addText(text);
}
else {
if (text.trim().length() > 0) {
throw new DocumentException("Cannot have text content outside of the root document");
} }
break;
} }
break;
}
default: default:
{ {
; ;
} }
} }
} }
} }
...@@ -399,7 +390,6 @@ public class XPPPacketReader { ...@@ -399,7 +390,6 @@ public class XPPPacketReader {
} }
} }
/* /*
* Redistribution and use of this software and associated documentation * Redistribution and use of this software and associated documentation
* ("Software"), with or without modification, are permitted provided * ("Software"), with or without modification, are permitted provided
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment