out.writeShort(prefixes.size()); String pfx; for (Iterator i = prefixes.iterator(); i.hasNext();) { pfx = (String) i.next(); out.writeUTF(pfx);
out.writeShort(namespaceMappings.size()); Map.Entry entry; short nsId; for (Iterator i = namespaceMappings.entrySet().iterator(); i.hasNext();) { entry = (Map.Entry) i.next(); out.writeUTF((String) entry.getKey()); nsId = ownerDocument.getSymbols().getNSSymbol((String) entry.getValue()); out.writeShort(nsId);
	public byte[] serialize() {		try {			byte[] prefixData = null;			// serialize namespace prefixes declared in this element			if (prefixes != null && prefixes.size() > 0) {				ByteArrayOutputStream bout = new ByteArrayOutputStream();				DataOutputStream out = new DataOutputStream(bout);				out.writeShort(prefixes.size());				String pfx;				for (Iterator i = prefixes.iterator(); i.hasNext();) {					pfx = (String) i.next();					out.writeUTF(pfx);				}				prefixData = bout.toByteArray();			}			final short id = ownerDocument.getSymbols().getSymbol(this);			final byte attrSizeType = Signatures.getSizeType(attributes);			final byte idSizeType = Signatures.getSizeType(id);			final byte signature =				(byte) ((Signatures.Elem << 0x5) | (attrSizeType << 0x2) | idSizeType);			byte[] data =				ByteArrayPool.getByteArray(					5						+ Signatures.getLength(attrSizeType)						+ Signatures.getLength(idSizeType)						+ (prefixData != null ? prefixData.length : 0));			data[0] = signature;			ByteConversion.intToByte(children, data, 1);			Signatures.write(attrSizeType, attributes, data, 5);			Signatures.write(idSizeType, id, data, 5 + Signatures.getLength(attrSizeType));			if (prefixData != null)				System.arraycopy(					prefixData,					0,					data,					5 + Signatures.getLength(attrSizeType) + Signatures.getLength(idSizeType),					prefixData.length);			return data;		} catch (IOException e) {			return null;		}	}