Author: mrglavas
Date: Mon Jan 24 03:59:55 2011
New Revision: 1062638
URL: http://svn.apache.org/viewvc?rev=1062638&view=rev
Log:
Use ArrayList instead of Vector.
Modified:
xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java
Modified: xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java?rev=1062638&r1=1062637&r2=1062638&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java
(original)
+++ xerces/java/branches/xml-schema-1.1-dev/samples/xni/PSVIWriter.java Mon Jan
24 03:59:55 2011
@@ -18,10 +18,12 @@
package xni;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.Stack;
-import java.util.Vector;
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xerces.impl.Constants;
@@ -144,10 +146,10 @@ public class PSVIWriter implements XMLCo
protected int fIndent;
/** The map used to store IDs for types and elements */
- protected HashMap fIDMap;
+ protected Map fIDMap;
/** A list of ids for defined XSObjects */
- protected Vector fDefined;
+ protected List fDefined;
private char[] fIndentChars =
{ '\t', '\t', '\t', '\t', '\t', '\t', '\t', '\t' };
@@ -179,7 +181,7 @@ public class PSVIWriter implements XMLCo
fAnonNum = 1000;
fIDMap = new HashMap();
- fDefined = new Vector();
+ fDefined = new ArrayList();
fIndent = 0;
fPSVINamespaceContext = new NamespaceSupport();
} // reset(XMLComponentManager)
@@ -387,7 +389,7 @@ public class PSVIWriter implements XMLCo
fPSVINamespaceContext,
null);
- Vector attributes = new Vector();
+ List attributes = new ArrayList();
attributes.add("xmlns:xsi");
attributes.add("http://www.w3.org/2001/XMLSchema-instance");
attributes.add(XMLSymbols.fCDATASymbol);
@@ -1722,10 +1724,10 @@ public class PSVIWriter implements XMLCo
private void processPSVIElementRef(
String elementName,
- Vector attributes,
+ List attributes,
XSObject obj) {
if (attributes == null) {
- attributes = new Vector();
+ attributes = new ArrayList();
}
String ref = this.getID(obj);
if (ref != null) {
@@ -1753,7 +1755,7 @@ public class PSVIWriter implements XMLCo
private void processPSVIAttributeDeclarationRef(XSAttributeDeclaration
att) {
if (att == null)
return;
- Vector attributes = new Vector();
+ List attributes = new ArrayList();
attributes.add("name");
attributes.add(att.getName());
attributes.add(XMLSymbols.fCDATASymbol);
@@ -1880,7 +1882,7 @@ public class PSVIWriter implements XMLCo
this.sendEmptyElementEvent(tagname, null);
} //sendEmptyElementEvent
- private void sendEmptyElementEvent(String tagname, Vector attributes) {
+ private void sendEmptyElementEvent(String tagname, List attributes) {
this.sendIndent();
fDocumentHandler.emptyElement(
createQName(tagname),
@@ -1896,7 +1898,7 @@ public class PSVIWriter implements XMLCo
*
* @throws IOEXception
*/
- private void sendStartElementEvent(String tagname, Vector attributes) {
+ private void sendStartElementEvent(String tagname, List attributes) {
fDocumentHandler.startElement(
createQName(tagname),
createAttributes(attributes),
@@ -1926,7 +1928,7 @@ public class PSVIWriter implements XMLCo
this.sendIndentedElement(tagName, null);
} //sendIndentedElement
- private void sendIndentedElement(String tagName, Vector attributes) {
+ private void sendIndentedElement(String tagName, List attributes) {
this.sendIndent();
this.sendStartElementEvent(tagName, attributes);
this.sendNewLine();
@@ -1971,7 +1973,7 @@ public class PSVIWriter implements XMLCo
private void sendElementEvent(
String elementName,
- Vector attributes,
+ List attributes,
String elementValue) {
XMLString text =
elementValue == null
@@ -1985,11 +1987,11 @@ public class PSVIWriter implements XMLCo
private void sendElementEvent(
String elementName,
- Vector attributes,
+ List attributes,
XMLString elementValue) {
if (elementValue == null || elementValue.length == 0) {
if (attributes == null) {
- attributes = new Vector();
+ attributes = new ArrayList();
}
attributes.add("xsi:nil");
attributes.add("true");
@@ -2010,7 +2012,7 @@ public class PSVIWriter implements XMLCo
// since this method is called everytime we define something with an
ID,
// may as well mark the ID as defined here
fDefined.add(id);
- Vector attributes = new Vector();
+ List attributes = new ArrayList();
attributes.add("id");
attributes.add(id);
attributes.add(XMLSymbols.fIDSymbol);
@@ -2047,13 +2049,13 @@ public class PSVIWriter implements XMLCo
return new QName(prefix, localpart, rawname, uri);
}
- private XMLAttributes createAttributes(Vector atts) {
+ private XMLAttributes createAttributes(List atts) {
XMLAttributes attributes = new XMLAttributesImpl();
if (atts != null) {
for (int i = 0; i < atts.size(); i += 3) {
- String rawname = (String)atts.elementAt(i);
- String value = (String)atts.elementAt(i + 1);
- String type = (String)atts.elementAt(i + 2);
+ String rawname = (String)atts.get(i);
+ String value = (String)atts.get(i + 1);
+ String type = (String)atts.get(i + 2);
attributes.addAttribute(createQName(rawname), type, value);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]