5_xmltag - { attributes.addElement(att); } public void...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// Date: 4/25/02 // Author: Paul Robertson, Copyright (c) DOLL, Inc. // File: XMLTag.java // Description: XML Basic stream I/O support // Stream for reading and writing XML package mit16_410_13; import java.util.Vector; import java.io.InputStream; import java.io.PrintStream; import java.io.EOFException; import java.io.IOException; import java.io.FileInputStream; public class XMLTag { String tagid; Vector attributes=new Vector(); public XMLTag () { tagid=null; } public XMLTag (String name) { tagid=name; } public String getTagID () { return tagid; } public Vector getAttributes () { return attributes; } void setTagID (String name) { tagid=name; } void addAttribute (XMLAttribute att)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { attributes.addElement(att); } public void writeTag (XMLStream strm) { PrintStream ostrm=strm.getPrintStream(); ostrm.print("<"+tagid); // emit the attributes. for (int i=0; i<attributes.size(); i++) { ostrm.print(" "); XMLAttribute anAttribute=(XMLAttribute)attributes.elementAt(i); anAttribute.writeAttribute(strm); } ostrm.println(">"); } public String getAttribute (String attrib) { for (int i=0; i<attributes.size(); i++) { XMLAttribute anAttribute=(XMLAttribute)attributes.elementAt(i); if (attrib.equals(anAttribute.getName())) { return anAttribute.getValue(); } } return null; } }...
View Full Document

Page1 / 2

5_xmltag - { attributes.addElement(att); } public void...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online