Added more white space and tab space in the code

This commit is contained in:
Willem Cazander 2025-01-29 18:43:31 +01:00
parent 275c4aa161
commit 5ba12c3a3e
15 changed files with 349 additions and 357 deletions

View file

@ -127,8 +127,7 @@ public class SAX3WriterEnum<TAG extends Enum<?>,TAG_WRITER extends ContentWriter
private String toTagString(TAG tag) {
String result = tag.name();
if (result.startsWith("_"))
{
if (result.startsWith("_")) {
result = result.substring(1); // remove _
}
return result;

View file

@ -180,18 +180,18 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, Charset.forName(encoding)));
try {
StringBuilder sb = new StringBuilder();
sb.append('\n'); // like plugin
sb.append('\n'); // like plugin
sb.append('\n');
sb.append('\n');
String line = br.readLine();
while (line != null) {
if (line.length() > 0) {
sb.append(" "); // like plugin
sb.append(" ");
}
sb.append(line);
sb.append('\n');
line = br.readLine();
}
sb.append('\n'); // like plugin
sb.append('\n');
String out = sb.toString();
return out;
} finally {
@ -279,7 +279,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
}
public void startElementTag(String uri, String localName) throws SAXException {
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) || uri == null) {
startElement.append(localName);
} else {
String prefix = prefixMapping.get(uri);
@ -339,12 +339,10 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
if (SAX3XMLConstants.NULL_NS_URI.equals(uri2)) {
continue; // don't print empty namespace uri location
}
if (first) {
startElement.append(getPropertyConfig().getPropertyString(OUTPUT_CHAR_NEWLINE));
first = false;
}
startElement.append(' ');
startElement.append(SAX3XMLConstants.XMLNS_ATTRIBUTE);
if ("".equals(prefix) == false) {
@ -383,8 +381,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
} else {
startElement.append(' ');
}
if (SAX3XMLConstants.NULL_NS_URI.equals(attributeUri) | attributeUri ==null) {
if (SAX3XMLConstants.NULL_NS_URI.equals(attributeUri) || attributeUri == null) {
startElement.append(attributeName);
} else {
startElement.append(attributeUri);
@ -420,7 +417,6 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
* @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
*/
public void endElement(String uri, String localName, String name) throws SAXException {
if (elements.size() > 0 && elements.peek().equals((localName)) == false) {
throw new SAXException("Unexpected end tag: " + localName + " should be: " + elements.peek());
}
@ -447,7 +443,7 @@ public class AbstractContentWriterHandler implements ContentHandler, Closeable {
}
write(SAX3XMLConstants.TAG_OPEN_END);
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) || uri == null) {
write(localName);
} else {
String prefix = prefixMapping.get(uri);

View file

@ -358,7 +358,7 @@ public class AttributeMap<K,V> implements Map<K,V> {
public boolean equals(Object o) {
if (o instanceof Map.Entry) {
Map.Entry mapEntry = (Map.Entry) o;
if (mapEntry.getKey().equals(key) & mapEntry.getValue().equals(value)) {
if (mapEntry.getKey().equals(key) && mapEntry.getValue().equals(value)) {
return true;
}
}

View file

@ -403,7 +403,6 @@ public final class SAX3PropertyConfig implements Cloneable {
@SuppressWarnings("unchecked")
public final void setPropertyParsedValue(String key,String value) {
Class<?> valueType = getPropertyType(key);
//System.out.println("key: "+key+" value: "+value+" type: "+valueType);
if (String.class.equals(valueType)) {
setProperty(key, value);
return;

View file

@ -407,7 +407,6 @@ public final class SAX3XMLConstants {
for (int ii = 0; ii < indent; ii++) {
result.append(charTab);
}
continue;
}
result.appendCodePoint(c);

View file

@ -198,18 +198,18 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, Charset.forName(encoding)));
try {
StringBuilder sb = new StringBuilder();
sb.append('\n'); // like plugin
sb.append('\n'); // like plugin
sb.append('\n');
sb.append('\n');
String line = br.readLine();
while (line != null) {
if (line.length()>0) {
sb.append(" "); // like plugin
sb.append(" ");
}
sb.append(line);
sb.append('\n');
line = br.readLine();
}
sb.append('\n'); // like plugin
sb.append('\n');
String out = sb.toString();
return out;
} finally {
@ -282,7 +282,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
startElementTag(uri,localName,name);
startElementNamespace(uri);
startElementAttributes(atts);
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) || uri == null) {
elements.push(localName);
} else {
elements.push(uri + ":" + name);
@ -291,7 +291,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
public void startElementTag(String uri, String localName, String name) throws SAXException {
boolean localNameIdx = xdbxStringId(localName);
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) || uri==null) {
if (localNameIdx) {
writeTag(XDBXContentTag.ELEMENT_I);
writeVariableInteger(xdbxStringStore(localName));
@ -320,7 +320,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
}
public void startElementNamespace(String uri) throws SAXException {
if ((uri!=null & SAX3XMLConstants.NULL_NS_URI.equals(uri)==false) && printedMappings.contains(uri)==false) {
if ((uri != null && SAX3XMLConstants.NULL_NS_URI.equals(uri) == false) && printedMappings.contains(uri) == false) {
String prefix = prefixMapping.get(uri);
if (prefix == null) {
throw new SAXException("preFixUri: "+uri+" is not started.");
@ -366,7 +366,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
boolean attributeValueSimple = attributeValue.equals(attributeValueSafe);
boolean attributeNameIdx = xdbxStringId(attributeName);
if (SAX3XMLConstants.NULL_NS_URI.equals(attributeUri) | attributeUri ==null) {
if (SAX3XMLConstants.NULL_NS_URI.equals(attributeUri) || attributeUri ==null) {
if (attributeNameIdx) {
writeTag(XDBXContentTag.ATTRIBUTE_I);
writeVariableInteger(xdbxStringStore(attributeName));
@ -407,7 +407,7 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
* @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
*/
public void endElement(String uri, String localName, String name) throws SAXException {
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) | uri==null) {
if (SAX3XMLConstants.NULL_NS_URI.equals(uri) || uri==null) {
if (elements.size() > 0 && elements.peek().equals(localName) == false) {
throw new SAXException("Unexpected end tag: " + localName + " should be: " + elements.peek());
}
@ -436,7 +436,6 @@ public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
writeTagLengthValue(XDBXContentTag.STRING_ID, prefix);
writeVariableInteger(prefixIdxNum);
}
boolean uriIdx = xdbxStringId(uri);
if (!uriIdx) {
int uriIdxNum = xdbxStringStore(uri);