Index: axis/ParseTopdl.java
===================================================================
--- axis/ParseTopdl.java	(revision 3c159d04369c66ad7e34514a8c36fb353acf35fa)
+++ axis/ParseTopdl.java	(revision c6f04f77459ce101cb19be5ac382b00faafcab75)
@@ -1,5 +1,4 @@
 // WSDL generated classes
 import edu.isi.www.fedd_types.*;
-import edu.isi.www.fedd_wsdl.*;
 import edu.isi.www.topdl.*;
 
@@ -19,4 +18,6 @@
     protected class TopdlHandler extends DefaultHandler {
 	protected String topName;
+
+	// Topology parameters
 	protected TopologyType topo;
 	protected ElementType element;
@@ -26,8 +27,50 @@
 	protected OtherType other;
 
+	// Many elements have a name
 	protected String name;
 
+	// CPU parameters
 	protected String type;
-
+	protected int ncpus;
+
+	// Operatingsystem parameters
+	protected String version;
+	protected String distribution;
+	protected String distributionversion;
+
+	// Software parameters
+	protected String install;
+	protected String location;
+
+	// Storage parameters
+	protected double amount;
+	protected PersistenceType persistence;
+
+	// Interface Parameters
+	protected Vector<String> ifsubs;
+	protected edu.isi.www.topdl.CapacityType cap;
+	protected LatencyType lat;
+
+	// Capacity parameters
+	protected double rate;
+	protected edu.isi.www.topdl.KindType kind;
+
+	// Latency parameters (shares kind)
+	protected double time;
+
+	// Testbed parameters (shares interfaces, type)
+	protected String uri;
+
+	// Segment parameters (shares interfaces, type, uri)
+	protected IDType id;
+	// IDType parameters
+	protected byte[] uuid;
+	protected byte[] fedid;
+	protected String id_uri;
+	protected String localname;
+	protected String kerberosUsername;
+	protected boolean inID;
+
+	// Attribute parameters
 	protected String aname;
 	protected String aval;
@@ -37,5 +80,11 @@
 	protected Vector<AttributeType> attrs;
 	protected Vector<CpuType> cpus;
-
+	protected Vector<OperatingsystemType> oses;
+	protected Vector<SoftwareType> software;
+	protected Vector<StorageType> storage;
+	protected Vector<InterfaceType> interfaces;
+
+	protected Set<String> attrElements;
+	protected Stack<Vector<AttributeType>> attrStack;
 	protected char[] c;
 
@@ -50,9 +99,48 @@
 
 	    type = null;
-	    name = aname = aval = null;
+	    name = null;
+	    ncpus = 1;
+
+	    version = distribution = distributionversion = null;
+
+	    install = location = null;
+
+	    amount = 0.0;
+	    persistence = null;
+
+	    ifsubs = new Vector<String>();
+	    cap = null;
+	    lat = null;
+
+	    rate = 0.0;
+	    kind = null;
+
+	    time = 0.0;
+
+	    uri = null;
+
+	    id = null;
+
+	    uuid = fedid = null;
+	    id_uri = localname = kerberosUsername = null;
+	    inID = false;
+
+	    aname = aval = null;
 
 	    elements = new Vector<ElementType>();
 	    subs = new Vector<SubstrateType>();
 	    attrs = new Vector<AttributeType>();
+	    oses = new Vector<OperatingsystemType>();
+	    software = new Vector<SoftwareType>();
+	    storage = new Vector<StorageType>();
+	    interfaces = new Vector<InterfaceType>();
+
+	    attrElements = new TreeSet<String>();
+	    for (String e : new String[] {
+		topName, "computer", "cpu", "os", "software", "storage",
+		"interface", "segment", "testbed", "other", "substrates" 
+	    }) attrElements.add(e);
+
+	    attrStack = new Stack<Vector<AttributeType>>();
 	    c = new char[0];
 	}
@@ -62,4 +150,14 @@
 
 	    c = new char[0];
+	    if ( attrElements.contains(qn) ) {
+		attrStack.push(attrs);
+		attrs = new Vector<AttributeType>();
+	    }
+	    if (qn.equals("id")) inID = true;
+	    if (qn.equals("cpu")) {
+		String n = a.getValue("count");
+		if ( n != null) ncpus = Integer.valueOf(n);
+		else ncpus = 1;
+	    }
 	}
 
@@ -74,5 +172,5 @@
 		elements = new Vector<ElementType>();
 		subs = new Vector<SubstrateType>();
-		attrs = new Vector<AttributeType>();
+		attrs = attrStack.pop();
 	    }
 	    else if (qn.equals("element")) {
@@ -86,24 +184,157 @@
 		comp = new ComputerType(name, 
 			cpus.toArray(new CpuType[cpus.size()]), 
-			null, null, null, null, null);
+			oses.toArray(new OperatingsystemType[oses.size()]), 
+			software.toArray(new SoftwareType[software.size()]), 
+			storage.toArray(new StorageType[storage.size()]), 
+			interfaces.toArray(
+			    new InterfaceType[interfaces.size()]),
+			attrs.toArray(new AttributeType[attrs.size()]));
 		name = null;
 		cpus = new Vector<CpuType>();
-	    }
-	    else if (qn.equals("testbed")) {
-		tb = new TestbedType(null, null, null, null);
-	    }
-	    else if (qn.equals("segment")) {
-		seg = new SegmentType(null, null, null, null, null);
-	    }
-	    else if (qn.equals("other")) { 
-		other = new OtherType(null, null);
+		oses = new Vector<OperatingsystemType>();
+		software = new Vector<SoftwareType>();
+		storage = new Vector<StorageType>();
+		interfaces = new Vector<InterfaceType>();
+		attrs = attrStack.pop();
 	    }
 	    else if (qn.equals("cpu")) {
 		cpus.add(new CpuType(type, 
-			attrs.toArray(new AttributeType[attrs.size()]), 1));
+			attrs.toArray(new AttributeType[attrs.size()]), ncpus));
 		type = null;
-		attrs = new Vector<AttributeType>();
-	    }
-	    else if (qn.equals("type")) { type = new String(c); }
+		attrs = attrStack.pop();
+		ncpus = 1;
+	    }
+	    else if (qn.equals("type")) { type = new String(c).trim(); }
+	    else if (qn.equals("os")) {
+		oses.add(new OperatingsystemType(name, version, 
+			distribution, distributionversion, 
+			attrs.toArray(new AttributeType[attrs.size()])));
+		name = version = distribution = distributionversion = null;
+		attrs = attrStack.pop();
+	    }
+	    else if ( qn.equals("version")) { version = new String(c).trim(); }
+	    else if ( qn.equals("distribution")) {
+		distribution = new String(c).trim();
+	    }
+	    else if ( qn.equals("distributionversion")) {
+		distributionversion = new String(c).trim();
+	    }
+	    else if (qn.equals("software")) {
+		software.add(new SoftwareType(location, install, 
+			    attrs.toArray(new AttributeType[attrs.size()])));
+		location = install = null;
+		attrs = attrStack.pop();
+	    }
+	    else if ( qn.equals("location")) { 
+		location = new String(c).trim();
+	    }
+	    else if ( qn.equals("install")) { install = new String(c).trim(); }
+	    else if (qn.equals("storage")) {
+		storage.add(new StorageType(amount, persistence, 
+			    attrs.toArray(new AttributeType[attrs.size()])));
+		amount = 0.0;
+		persistence = null;
+		attrs = attrStack.pop();
+	    }
+	    else if ( qn.equals("amount")) { 
+		amount = Double.valueOf(new String(c));
+	    }
+	    else if ( qn.equals("persistence")) { 
+		persistence = PersistenceType.fromValue(new String(c));
+	    }
+	    else if (qn.equals("interface")) {
+		interfaces.add(new InterfaceType(
+			    ifsubs.toArray(new String[ifsubs.size()]),
+			    name,
+			    cap, lat,
+			    attrs.toArray(new AttributeType[attrs.size()])));
+		ifsubs = new Vector<String>();
+		cap = null;
+		lat = null;
+		attrs = attrStack.pop();
+	    }
+	    else if (qn.equals("substrate")) {
+		ifsubs.add(new String(c).trim());
+	    }
+	    else if (qn.equals("capacity")) {
+		cap = new edu.isi.www.topdl.CapacityType(rate, kind);
+		rate = 0.0;
+		kind = null;
+	    }
+	    else if ( qn.equals("rate")) { 
+		rate = Double.valueOf(new String(c));
+	    }
+	    else if ( qn.equals("kind")) { 
+		kind = edu.isi.www.topdl.KindType.fromValue(new String(c));
+	    }
+	    else if (qn.equals("latency")) {
+		lat = new LatencyType(time, kind);
+		time = 0.0;
+		kind = null;
+	    }
+	    else if ( qn.equals("time")) { 
+		time = Double.valueOf(new String(c));
+	    }
+	    else if (qn.equals("testbed")) {
+		tb = new TestbedType(uri, type, 
+			interfaces.toArray(
+			    new InterfaceType[interfaces.size()]),
+			attrs.toArray(new AttributeType[attrs.size()]));
+		uri = type = null;
+		interfaces = new Vector<InterfaceType>();
+		attrs = attrStack.pop();
+	    }
+	    else if (qn.equals("uri")) { 
+		if (inID) id_uri = new String(c).trim();
+		else uri = new String(c).trim();
+	    }
+	    else if (qn.equals("segment")) {
+		seg = new SegmentType(id, type, uri,
+			interfaces.toArray(
+			    new InterfaceType[interfaces.size()]),
+			attrs.toArray(new AttributeType[attrs.size()]));
+		id = null;
+		type = uri = null;
+		interfaces = new Vector<InterfaceType>();
+		attrs = attrStack.pop();
+	    }
+	    else if (qn.equals("id")) { 
+		id = new IDType(uuid, fedid, id_uri, localname, 
+			kerberosUsername);
+		uuid = null;
+		fedid = null;
+		id_uri = null;
+		localname = null;
+		kerberosUsername = null;
+		inID = false;
+	    }
+	    else if (qn.equals("uuid")) {
+		uuid = new String(c).trim().getBytes();
+	    }
+	    else if (qn.equals("fedid")) {
+		fedid = new String(c).trim().getBytes();
+	    }
+	    else if (qn.equals("localname")) {
+		localname = new String(c).trim();
+	    }
+	    else if (qn.equals("kerberosUsername")) { 
+		kerberosUsername = new String(c).trim();
+	    }
+	    else if (qn.equals("other")) { 
+		other = new OtherType(
+			interfaces.toArray(
+			    new InterfaceType[interfaces.size()]),
+			attrs.toArray(new AttributeType[attrs.size()]));
+		interfaces = new Vector<InterfaceType>();
+		attrs = attrStack.pop();
+	    }
+	    else if (qn.equals("substrates")) {
+		subs.add(new SubstrateType(name, cap, lat, 
+			attrs.toArray(new AttributeType[attrs.size()])));
+		name = null;
+		cap = null;
+		lat = null;
+		attrs = attrStack.pop();
+	    }
 	    else if (qn.equals("attribute")) {
 		if ( aname != null && aval != null ) {
@@ -111,10 +342,20 @@
 		    aname = aval = null;
 		}
-		else { aname = new String(c); }
-	    }
-	    else if ( qn.equals("value")) { aval = new String(c); }
-	    else if ( qn.equals("name")) { name = new String(c); }
+		else { aname = new String(c).trim(); }
+	    }
+	    else if ( qn.equals("value")) { aval = new String(c).trim(); }
+	    else if ( qn.equals("name")) { name = new String(c).trim(); }
 
 	    c = new char[0];
+	}
+
+	/** 
+	 * Collect text.
+	 */
+	public void characters(char[] ch, int s, int l) {
+	    char[] nc = new char[c.length + l];
+	    System.arraycopy(c, 0, nc, 0, c.length);
+	    System.arraycopy(ch, s, nc, c.length, l);
+	    c = nc;
 	}
     }
