diff options
author | Elliott Hughes <enh@google.com> | 2010-05-13 12:36:25 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2010-05-13 12:49:12 -0700 |
commit | f33eae7e84eb6d3b0f4e86b59605bb3de73009f3 (patch) | |
tree | f6cb62c04ce2669d2fa4715fbab86d38c8fca06d /xml/src/main/java | |
parent | d21d78fd49a2d798218e8c8aefbddb26a0e71bbb (diff) | |
download | libcore-f33eae7e84eb6d3b0f4e86b59605bb3de73009f3.zip libcore-f33eae7e84eb6d3b0f4e86b59605bb3de73009f3.tar.gz libcore-f33eae7e84eb6d3b0f4e86b59605bb3de73009f3.tar.bz2 |
Remove all trailing whitespace from the dalvik team-maintained parts of libcore.
Gentlemen, you may now set your editors to "strip trailing whitespace"...
Change-Id: I85b2f6c80e5fbef1af6cab11789790b078c11b1b
Diffstat (limited to 'xml/src/main/java')
-rw-r--r-- | xml/src/main/java/org/kxml2/io/KXmlParser.java | 32 | ||||
-rw-r--r-- | xml/src/main/java/org/kxml2/io/KXmlSerializer.java | 8 | ||||
-rw-r--r-- | xml/src/main/java/org/kxml2/kdom/Document.java | 22 | ||||
-rw-r--r-- | xml/src/main/java/org/kxml2/kdom/Element.java | 98 | ||||
-rw-r--r-- | xml/src/main/java/org/kxml2/kdom/Node.java | 38 | ||||
-rw-r--r-- | xml/src/main/java/org/xmlpull/v1/XmlPullParserFactory.java | 2 | ||||
-rw-r--r-- | xml/src/main/java/org/xmlpull/v1/XmlSerializer.java | 50 |
7 files changed, 125 insertions, 125 deletions
diff --git a/xml/src/main/java/org/kxml2/io/KXmlParser.java b/xml/src/main/java/org/kxml2/io/KXmlParser.java index af97e9f..66e7fb2 100644 --- a/xml/src/main/java/org/kxml2/io/KXmlParser.java +++ b/xml/src/main/java/org/kxml2/io/KXmlParser.java @@ -93,7 +93,7 @@ public class KXmlParser implements XmlPullParser { // private int stackMismatch = 0; private String error; - /** + /** * A separate peek buffer seems simpler than managing * wrap around in the first level read buffer */ @@ -172,7 +172,7 @@ public class KXmlParser implements XmlPullParser { // BEGIN android-changed if (keepNamespaceAttributes) { - // explicitly set the namespace for unprefixed attributes + // explicitly set the namespace for unprefixed attributes // such as xmlns="http://foo" attributes[i] = "http://www.w3.org/2000/xmlns/"; any = true; @@ -276,8 +276,8 @@ public class KXmlParser implements XmlPullParser { null); } - /** - * common base for next and nextToken. Clears the state, except from + /** + * common base for next and nextToken. Clears the state, except from * txtPos and whitespace. Does not set the type variable */ private final void nextImpl() throws IOException, XmlPullParserException { @@ -357,7 +357,7 @@ public class KXmlParser implements XmlPullParser { if (isWhitespace) type = IGNORABLE_WHITESPACE; // make exception switchable for instances.chg... !!!! - // else + // else // exception ("text '"+getText ()+"' not allowed outside root element"); } return; @@ -757,7 +757,7 @@ public class KXmlParser implements XmlPullParser { elementStack[sp + 2] = name; } - /** + /** * result: isWhitespace; if the setName parameter is set, * the name of the entity is stored in "name" */ @@ -765,8 +765,8 @@ public class KXmlParser implements XmlPullParser { throws IOException, XmlPullParserException { push(read()); // & - - + + int pos = txtPos; while (true) { @@ -780,12 +780,12 @@ public class KXmlParser implements XmlPullParser { if(!relaxed){ error("unterminated entity ref"); } - + // BEGIN android-removed: avoid log spam. // System.out.println("broken entitiy: "+get(pos-1)); // END android-removed - - //; ends with:"+(char)c); + + //; ends with:"+(char)c); // if (c != -1) // push(c); return; @@ -893,7 +893,7 @@ public class KXmlParser implements XmlPullParser { peek[0] = peek[1]; } // else { - // result = peek[0]; + // result = peek[0]; // System.arraycopy (peek, 1, peek, 0, peekCount-1); // } peekCount--; @@ -1036,7 +1036,7 @@ public class KXmlParser implements XmlPullParser { try { if (enc == null) { - // read four bytes + // read four bytes int chk = 0; @@ -1378,7 +1378,7 @@ public class KXmlParser implements XmlPullParser { nextImpl(); if (type < minType) minType = type; - // if (curr <= TEXT) type = curr; + // if (curr <= TEXT) type = curr; } while (minType > ENTITY_REF // ignorable || (minType >= TEXT && peekType() >= TEXT)); @@ -1468,10 +1468,10 @@ public class KXmlParser implements XmlPullParser { /** * Skip sub tree that is currently porser positioned on. * <br>NOTE: parser must be on START_TAG and when funtion returns - * parser will be positioned on corresponding END_TAG. + * parser will be positioned on corresponding END_TAG. */ - // Implementation copied from Alek's mail... + // Implementation copied from Alek's mail... public void skipSubTree() throws XmlPullParserException, IOException { require(START_TAG, null, null); diff --git a/xml/src/main/java/org/kxml2/io/KXmlSerializer.java b/xml/src/main/java/org/kxml2/io/KXmlSerializer.java index 1f13357..4ad78bf 100644 --- a/xml/src/main/java/org/kxml2/io/KXmlSerializer.java +++ b/xml/src/main/java/org/kxml2/io/KXmlSerializer.java @@ -17,7 +17,7 @@ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ - + package org.kxml2.io; @@ -31,7 +31,7 @@ public class KXmlSerializer implements XmlSerializer { // BEGIN android-added /** size (in characters) for the write buffer */ private static final int WRITE_BUFFER_SIZE = 500; - // END android-added + // END android-added // BEGIN android-changed // (Guarantee that the writer is always buffered.) @@ -102,9 +102,9 @@ public class KXmlSerializer implements XmlSerializer { case '\n': case '\r': case '\t': - if(quot == -1) + if(quot == -1) writer.write(c); - else + else writer.write("&#"+((int) c)+';'); break; case '&' : diff --git a/xml/src/main/java/org/kxml2/kdom/Document.java b/xml/src/main/java/org/kxml2/kdom/Document.java index 859334c..9123e62 100644 --- a/xml/src/main/java/org/kxml2/kdom/Document.java +++ b/xml/src/main/java/org/kxml2/kdom/Document.java @@ -17,7 +17,7 @@ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ - + package org.kxml2.kdom; @@ -39,15 +39,15 @@ public class Document extends Node { public String getEncoding () { return encoding; } - + public void setEncoding(String enc) { this.encoding = enc; } - + public void setStandalone (Boolean standalone) { this.standalone = standalone; } - + public Boolean getStandalone() { return standalone; } @@ -82,11 +82,11 @@ public class Document extends Node { throws IOException, XmlPullParserException { parser.require(XmlPullParser.START_DOCUMENT, null, null); - parser.nextToken (); + parser.nextToken (); encoding = parser.getInputEncoding(); standalone = (Boolean)parser.getProperty ("http://xmlpull.org/v1/doc/properties.html#xmldecl-standalone"); - + super.parse(parser); if (parser.getEventType() != XmlPullParser.END_DOCUMENT) @@ -111,19 +111,19 @@ public class Document extends Node { return (Element) getChild(rootIndex); } - - + + /** Writes this node to the given XmlWriter. For node and document, this method is identical to writeChildren, except that the stream is flushed automatically. */ public void write(XmlSerializer writer) throws IOException { - + writer.startDocument(encoding, standalone); writeChildren(writer); writer.endDocument(); } - - + + }
\ No newline at end of file diff --git a/xml/src/main/java/org/kxml2/kdom/Element.java b/xml/src/main/java/org/kxml2/kdom/Element.java index 6a5777b..a9cb426 100644 --- a/xml/src/main/java/org/kxml2/kdom/Element.java +++ b/xml/src/main/java/org/kxml2/kdom/Element.java @@ -25,7 +25,7 @@ import java.util.*; import org.xmlpull.v1.*; -/** +/** * In order to create an element, please use the createElement method * instead of invoking the constructor directly. The right place to * add user defined initialization code is the init method. */ @@ -41,7 +41,7 @@ public class Element extends Node { public Element() { } - /** + /** * called when all properties are set, but before children * are parsed. Please do not use setParent for initialization * code any longer. */ @@ -52,7 +52,7 @@ public class Element extends Node { - /** + /** * removes all children and attributes */ public void clear() { @@ -60,20 +60,20 @@ public class Element extends Node { children = null; } - /** + /** * Forwards creation request to parent if any, otherwise * calls super.createElement. */ public Element createElement( String namespace, - String name) { + String name) { return (this.parent == null) ? super.createElement(namespace, name) : this.parent.createElement(namespace, name); } - /** + /** * Returns the number of attributes of this element. */ public int getAttributeCount() { @@ -91,47 +91,47 @@ public class Element extends Node { public String getAttributeName (int index) { return ((String []) attributes.elementAt (index)) [1]; } - + public String getAttributeValue (int index) { return ((String []) attributes.elementAt (index)) [2]; } - - + + public String getAttributeValue (String namespace, String name) { for (int i = 0; i < getAttributeCount (); i++) { - if (name.equals (getAttributeName (i)) + if (name.equals (getAttributeName (i)) && (namespace == null || namespace.equals (getAttributeNamespace(i)))) { return getAttributeValue (i); } - } - return null; + } + return null; } - /** - * Returns the root node, determined by ascending to the + /** + * Returns the root node, determined by ascending to the * all parents un of the root element. */ public Node getRoot() { Element current = this; - + while (current.parent != null) { if (!(current.parent instanceof Element)) return current.parent; current = (Element) current.parent; } - + return current; } - /** + /** * returns the (local) name of the element */ public String getName() { return name; } - /** + /** * returns the namespace of the element */ public String getNamespace() { @@ -139,21 +139,21 @@ public class Element extends Node { } - /** + /** * returns the namespace for the given prefix */ - + public String getNamespaceUri (String prefix) { int cnt = getNamespaceCount (); for (int i = 0; i < cnt; i++) { if (prefix == getNamespacePrefix (i) || (prefix != null && prefix.equals (getNamespacePrefix (i)))) - return getNamespaceUri (i); + return getNamespaceUri (i); } return parent instanceof Element ? ((Element) parent).getNamespaceUri (prefix) : null; } - /** + /** * returns the number of declared namespaces, NOT including * parent elements */ @@ -171,15 +171,15 @@ public class Element extends Node { } - /** + /** * Returns the parent node of this element */ public Node getParent() { return parent; } - /* - * Returns the parent element if available, null otherwise + /* + * Returns the parent element if available, null otherwise public Element getParentElement() { return (parent instanceof Element) @@ -188,9 +188,9 @@ public class Element extends Node { } */ - /** - * Builds the child elements from the given Parser. By overwriting - * parse, an element can take complete control over parsing its + /** + * Builds the child elements from the given Parser. By overwriting + * parse, an element can take complete control over parsing its * subtree. */ public void parse(XmlPullParser parser) @@ -200,9 +200,9 @@ public class Element extends Node { i < parser.getNamespaceCount (parser.getDepth ()); i++) { setPrefix (parser.getNamespacePrefix (i), parser.getNamespaceUri(i)); } - - - for (int i = 0; i < parser.getAttributeCount (); i++) + + + for (int i = 0; i < parser.getAttributeCount (); i++) setAttribute (parser.getAttributeNamespace (i), // parser.getAttributePrefix (i), parser.getAttributeName (i), @@ -214,7 +214,7 @@ public class Element extends Node { init(); - if (parser.isEmptyElementTag()) + if (parser.isEmptyElementTag()) parser.nextToken (); else { parser.nextToken (); @@ -223,76 +223,76 @@ public class Element extends Node { if (getChildCount() == 0) addChild(IGNORABLE_WHITESPACE, ""); } - + parser.require( XmlPullParser.END_TAG, getNamespace(), getName()); - + parser.nextToken (); } - /** + /** * Sets the given attribute; a value of null removes the attribute */ public void setAttribute (String namespace, String name, String value) { - if (attributes == null) + if (attributes == null) attributes = new Vector (); - if (namespace == null) + if (namespace == null) namespace = ""; - + for (int i = attributes.size()-1; i >=0; i--){ String[] attribut = (String[]) attributes.elementAt(i); if (attribut[0].equals(namespace) && attribut[1].equals(name)){ - + if (value == null) { attributes.removeElementAt(i); } else { attribut[2] = value; } - return; + return; } } - attributes.addElement + attributes.addElement (new String [] {namespace, name, value}); } - /** - * Sets the given prefix; a namespace value of null removess the + /** + * Sets the given prefix; a namespace value of null removess the * prefix */ public void setPrefix (String prefix, String namespace) { if (prefixes == null) prefixes = new Vector (); - prefixes.addElement (new String [] {prefix, namespace}); + prefixes.addElement (new String [] {prefix, namespace}); } - /** + /** * sets the name of the element */ public void setName(String name) { this.name = name; } - /** + /** * sets the namespace of the element. Please note: For no * namespace, please use Xml.NO_NAMESPACE, null is not a legal * value. Currently, null is converted to Xml.NO_NAMESPACE, but * future versions may throw an exception. */ public void setNamespace(String namespace) { - if (namespace == null) + if (namespace == null) throw new NullPointerException ("Use \"\" for empty namespace"); this.namespace = namespace; } - /** + /** * Sets the Parent of this element. Automatically called from the * add method. Please use with care, you can simply * create inconsitencies in the document tree structure using @@ -303,7 +303,7 @@ public class Element extends Node { } - /** + /** * Writes this element and all children to the given XmlWriter. */ public void write(XmlSerializer writer) diff --git a/xml/src/main/java/org/kxml2/kdom/Node.java b/xml/src/main/java/org/kxml2/kdom/Node.java index a3cc78d..820390c 100644 --- a/xml/src/main/java/org/kxml2/kdom/Node.java +++ b/xml/src/main/java/org/kxml2/kdom/Node.java @@ -132,38 +132,38 @@ public class Node { //implements XmlIO{ return getElement(i); } - /* returns "#document-fragment". For elements, the element name is returned - + /* returns "#document-fragment". For elements, the element name is returned + public String getName() { return "#document-fragment"; } - + /** Returns the namespace of the current element. For Node - and Document, Xml.NO_NAMESPACE is returned. - + and Document, Xml.NO_NAMESPACE is returned. + public String getNamespace() { return ""; } - + public int getNamespaceCount () { return 0; } - + /** returns the text content if the element has text-only content. Throws an exception for mixed content - + public String getText() { - + StringBuffer buf = new StringBuffer(); int len = getChildCount(); - + for (int i = 0; i < len; i++) { if (isText(i)) buf.append(getText(i)); else if (getType(i) == ELEMENT) throw new RuntimeException("not text-only content!"); } - + return buf.toString(); } */ @@ -175,7 +175,7 @@ public class Node { //implements XmlIO{ return (isText(index)) ? (String) getChild(index) : null; } - /** Returns the type of the child at the given index. Possible + /** Returns the type of the child at the given index. Possible types are ELEMENT, TEXT, COMMENT, and PROCESSING_INSTRUCTION */ public int getType(int index) { @@ -183,8 +183,8 @@ public class Node { //implements XmlIO{ } /** Convenience method for indexOf (getNamespace (), name, - startIndex). - + startIndex). + public int indexOf(String name, int startIndex) { return indexOf(getNamespace(), name, startIndex); } @@ -217,7 +217,7 @@ public class Node { //implements XmlIO{ } /** Recursively builds the child elements from the given parser - until an end tag or end document is found. + until an end tag or end document is found. The end tag is not consumed. */ public void parse(XmlPullParser parser) @@ -227,9 +227,9 @@ public class Node { //implements XmlIO{ do { int type = parser.getEventType(); - + // System.out.println(parser.getPositionDescription()); - + switch (type) { case XmlPullParser.START_TAG : @@ -241,7 +241,7 @@ public class Node { //implements XmlIO{ // child.setAttributes (event.getAttributes ()); addChild(ELEMENT, child); - // order is important here since + // order is important here since // setparent may perform some init code! child.parse(parser); @@ -288,7 +288,7 @@ public class Node { //implements XmlIO{ } /* returns a valid XML representation of this Element including - attributes and children. + attributes and children. public String toString() { try { ByteArrayOutputStream bos = diff --git a/xml/src/main/java/org/xmlpull/v1/XmlPullParserFactory.java b/xml/src/main/java/org/xmlpull/v1/XmlPullParserFactory.java index 7814651..8ad1b89 100644 --- a/xml/src/main/java/org/xmlpull/v1/XmlPullParserFactory.java +++ b/xml/src/main/java/org/xmlpull/v1/XmlPullParserFactory.java @@ -243,7 +243,7 @@ public class XmlPullParserFactory { * to create XML pull parsers (see class description for more * details). * - * @return a new instance of a PullParserFactory, as returned by newInstance (null, null); + * @return a new instance of a PullParserFactory, as returned by newInstance (null, null); */ public static XmlPullParserFactory newInstance () throws XmlPullParserException { return newInstance(null, null); diff --git a/xml/src/main/java/org/xmlpull/v1/XmlSerializer.java b/xml/src/main/java/org/xmlpull/v1/XmlSerializer.java index 09503ba..101a247 100644 --- a/xml/src/main/java/org/xmlpull/v1/XmlSerializer.java +++ b/xml/src/main/java/org/xmlpull/v1/XmlSerializer.java @@ -33,7 +33,7 @@ import java.io.Writer; */ public interface XmlSerializer { - + /** * Set feature identified by name (recommended to be URI for uniqueness). * Some well known optional features are defined in @@ -48,8 +48,8 @@ public interface XmlSerializer { void setFeature(String name, boolean state) throws IllegalArgumentException, IllegalStateException; - - + + /** * Return the current value of the feature with given name. * <p><strong>NOTE:</strong> unknown properties are <strong>always</strong> returned as null @@ -59,8 +59,8 @@ public interface XmlSerializer { * @exception IllegalArgumentException if feature string is null */ boolean getFeature(String name); - - + + /** * Set the value of a property. * (the property name is recommended to be URI for uniqueness). @@ -76,7 +76,7 @@ public interface XmlSerializer { void setProperty(String name, Object value) throws IllegalArgumentException, IllegalStateException; - + /** * Look up the value of a property. * @@ -87,20 +87,20 @@ public interface XmlSerializer { * @return The value of named property. */ Object getProperty(String name); - + /** * Set to use binary output stream with given encoding. */ void setOutput (OutputStream os, String encoding) throws IOException, IllegalArgumentException, IllegalStateException; - + /** * Set the output to the given writer. * <p><b>WARNING</b> no information about encoding is available! */ void setOutput (Writer writer) throws IOException, IllegalArgumentException, IllegalStateException; - + /** * Write <?xml declaration with encoding (if encoding not null) * and standalone flag (if standalone not null) @@ -108,7 +108,7 @@ public interface XmlSerializer { */ void startDocument (String encoding, Boolean standalone) throws IOException, IllegalArgumentException, IllegalStateException; - + /** * Finish writing. All unclosed start tags will be closed and output * will be flushed. After calling this method no more output can be @@ -116,7 +116,7 @@ public interface XmlSerializer { */ void endDocument () throws IOException, IllegalArgumentException, IllegalStateException; - + /** * Binds the given prefix to the given namespace. * This call is valid for the next element including child elements. @@ -138,7 +138,7 @@ public interface XmlSerializer { */ void setPrefix (String prefix, String namespace) throws IOException, IllegalArgumentException, IllegalStateException; - + /** * Return namespace that corresponds to given prefix * If there is no prefix bound to this namespace return null @@ -153,7 +153,7 @@ public interface XmlSerializer { */ String getPrefix (String namespace, boolean generatePrefix) throws IllegalArgumentException; - + /** * Returns the current depth of the element. * Outside the root element, the depth is 0. The @@ -172,7 +172,7 @@ public interface XmlSerializer { * </pre> */ int getDepth(); - + /** * Returns the namespace URI of the current element as set by startTag(). * @@ -184,7 +184,7 @@ public interface XmlSerializer { * @return namespace set by startTag() that is currently in scope */ String getNamespace (); - + /** * Returns the name of the current element as set by startTag(). * It can only be null before first call to startTag() @@ -193,7 +193,7 @@ public interface XmlSerializer { * @return namespace set by startTag() that is currently in scope */ String getName(); - + /** * Writes a start tag with the given namespace and name. * If there is no prefix defined for the given namespace, @@ -208,7 +208,7 @@ public interface XmlSerializer { */ XmlSerializer startTag (String namespace, String name) throws IOException, IllegalArgumentException, IllegalStateException; - + /** * Write an attribute. Calls to attribute() MUST follow a call to * startTag() immediately. If there is no prefix defined for the @@ -218,7 +218,7 @@ public interface XmlSerializer { */ XmlSerializer attribute (String namespace, String name, String value) throws IOException, IllegalArgumentException, IllegalStateException; - + /** * Write end tag. Repetition of namespace and name is just for avoiding errors. * <p><b>Background:</b> in kXML endTag had no arguments, and non matching tags were @@ -229,8 +229,8 @@ public interface XmlSerializer { */ XmlSerializer endTag (String namespace, String name) throws IOException, IllegalArgumentException, IllegalStateException; - - + + // /** // * Writes a start tag with the given namespace and name. // * <br />If there is no prefix defined (prefix == null) for the given namespace, @@ -283,19 +283,19 @@ public interface XmlSerializer { // ALEK: This is really optional as prefix in end tag MUST correspond to start tag but good for error checking // XmlSerializer endTag (String prefix, String namespace, String name) // throws IOException, IllegalArgumentException, IllegalStateException; - + /** * Writes text, where special XML chars are escaped automatically */ XmlSerializer text (String text) throws IOException, IllegalArgumentException, IllegalStateException; - + /** * Writes text, where special XML chars are escaped automatically */ XmlSerializer text (char [] buf, int start, int len) throws IOException, IllegalArgumentException, IllegalStateException; - + void cdsect (String text) throws IOException, IllegalArgumentException, IllegalStateException; void entityRef (String text) throws IOException, @@ -308,7 +308,7 @@ public interface XmlSerializer { throws IOException, IllegalArgumentException, IllegalStateException; void ignorableWhitespace (String text) throws IOException, IllegalArgumentException, IllegalStateException; - + /** * Write all pending output to the stream. * If method startTag() or attribute() was called then start tag is closed (final >) @@ -321,5 +321,5 @@ public interface XmlSerializer { */ void flush () throws IOException; - + } |