priti_s 0 Newbie Poster

hi
i am new to java
i have been assigned to a work where i have to take DTD file as input & i have to generate TRN file & i have been told to write the program into different classes. From DTD file i have to make a different class for ELEMENTS which will contain its properties like PCDATA,EMPTY & all, different class for ATTRIBUTES having element name, attribute name, attribute value & type. Right now what am i doing is, i have class (DTDReaderTest) with main() method, there i am taking file name & passing file name to a method readDTD(), which is in DTDReader class, there i am reading the file & separating the statements starting with <!ELEMENT & <!ATTLIST , & storing them in an arraylist. This arraylist i have created in DTDReader class, & set-get method for these arraylist are written in a class Store. Please tell me how to proceed next, finally after storing the elements i have to generate TRN file using these stored elements plz guide me
PART OF CODE:

/** DTDReaderTest class */

public class DTDReaderTest {
public static void main(String args[]){
        // 1. Create an InputStreamReader using the standard input stream.
        InputStreamReader isr = new InputStreamReader(System.in);

        // 2. Create a BufferedReader using the InputStreamReader created.
        BufferedReader stdin = new BufferedReader(isr);

        boolean continueRead = true;
        String fileName = null;
        String filePath = null;
        try {
            while (continueRead) {
                System.out.println("To exit at any time, type '.'");

                System.out.println("Please input the source path ");
                filePath = (stdin.readLine()).trim();

                if (".".equals(filePath)) {
                    continueRead = false;
                    break;
                }
                System.out.println("Please input the source fileName (Eg: Huawei.dtd):");
                fileName = (stdin.readLine()).trim();                           if (".".equals(filePath)) {
                    continueRead = false;
                    break;
                }
                DTDReader dtdReader = new DTDReader();
                Store root = dtdReader.readDTD(filePath, fileName);   
                ArrayList elementList = root.getElementList();
                ArrayList attributeList = root.getAttributeList();
                            Element element = null;
                Attribute attribute = null;      

/** DISPLAY THE CONTENTS OF ELEMENT ARRAYLIST   */   
                for (int i = 0, count = elementList.size(); i < count; i++) {
                    element = (Element) elementList.get(i);
                    System.out.println("Found Element: " + element.getName());    
                }
                System.out.println();

          /** DISPLAY THE CONTENTS OF ATTRIBUTE ARRAYLIST   */   
                for (int i = 0, count = attributeList.size(); i < count; i++) {
                    attribute = (Attribute) attributeList.get(i);
                    System.out.println("Found Attrtibute: " + attribute.getWholeAttribute());   
                }   
                System.out.println(); 
 } //continueRead ends      
          } catch (IOException ioe) {
            ioe.printStackTrace();
            }       
   } //main ends
}// "class" ends


/** DTDReader class */

public class DTDReader {
    public Store readDTD(String filePath, String fileName) {
        String dtdFile = filePath + File.separator + fileName;
        DataInputStream dataInputStream = null;
        String text = null;

        Store root = new Store();
        Element element = null;
        Attribute attribute = null;
        root.setElementList(elementList);                                    root.setAttributeList(attributeList);

try {
      /** READING THE FILE & SEPARATING THE STMTS WITH ELEMENT & ATTRIBUTE **/      
            dataInputStream = new DataInputStream(new FileInputStream(dtdFile));            
            while ((text = dataInputStream.readLine()) != null) {               
                if (text.startsWith("<!ELEMENT")) {
                    text = removeXMLTags(text, "ELEMENT");
                    text = text.trim();
                    element = new Element();
                    element.setName(text);
                    elementList.add(element);
                } else if (text.startsWith("<!ATTLIST")) {
                    text = removeXMLTags(text, "ATTLIST");
                    text = text.trim();
                    attribute = new Attribute();
                    attribute.setWholeAttribute(text);                  
                    attributeList.add(attribute);                  
                } 
            } //file reading ends

 } catch (FileNotFoundException fnfe) {
            fnfe.printStackTrace();
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
        return root;
    } // readDTD ends

    public String removeXMLTags(String mainString, String stringToRemove) {
        String xmlNode = "<!" + stringToRemove;
        mainString = mainString.replaceAll(xmlNode, "");
        mainString = mainString.replaceAll(">","");
        mainString = mainString.replaceAll(", " , ",");
        return mainString;        
    }  
}

/** Element Class */

public class Element {

    private String name;

    private String pcData;

    private boolean empty;

    private HashMap childElementMap;

    private String parent;

    private String occurence;

    /**
     * @return Returns the occurence.
     */
    public String getOccurence() {
        return occurence;
    }
    /**
     * @param occurence The occurence to set.
     */
    public void setOccurence(String occurence) {
        this.occurence = occurence;
    }

    /**
     * @return Returns the empty.
     */
    public boolean isEmpty() {
        return empty;
    }
    /**
     * @param empty The empty to set.
     */
    public void setEmpty(boolean empty) {
        this.empty = empty;
    }
    /**
     * @return Returns the pcData.
     */
    public String getPcData() {
        return pcData;
    }
    /**
     * @param pcData The pcData to set.
     */
    public void setPcData(String pcData) {
        this.pcData = pcData;
    }
    /**
     * @return Returns the name.
     */
    public String getName() {
        return name;
    }
    /**
     * @param name The name to set.
     */
    public void setName(String name) {
        this.name = name;
    }
}

/**Attribute class */

public class Attribute {

    private String elementName;

    private String name;

    private String value;

    /**
     * @return Returns the name.
     */
    public String getName() {
        return name;
    }
    /**
     * @param name The name to set.
     */
    public void setName(String name) {
        this.name = name;
    }
    /**
     * @return Returns the value.
     */
    public String getValue() {
        return value;
    }
    /**
     * @param value The value to set.
     */
    public void setValue(String value) {
        this.value = value;
    }
    /**
     * @return Returns the elementName.
     */
    public String getElementName() {
        return elementName;
    }
    /**
     * @param elementName The elementName to set.
     */
    public void setElementName(String elementName) {
        this.elementName = elementName;
    }
}

/**Store Class */

public class Store {

    private ArrayList elementList;

    private ArrayList attributeList;

    /**
     * @return Returns the attributeList.
     */
    public ArrayList getAttributeList() {
        return attributeList;
    }
    /**
     * @param attributeList The attributeList to set.
     */
    public void setAttributeList(ArrayList attributeList) {
        this.attributeList = attributeList;
    }
    /**
     * @return Returns the elementList.
     */
    public ArrayList getElementList() {
        return elementList;
    }
    /**
     * @param elementList The elementList to set.
     */
    public void setElementList(ArrayList elementList) {
        this.elementList = elementList;
    }
}

Sorry for posting such a lengthy matter!
now where i want help is how to store elements & attributes depending upon their type, value etc & how to extract them while writing a trn file?
note: DTD is available on: http://www.w3schools.com/dtd/default.asp