Project

General

Profile

« Previous | Next » 

Revision 92

Added by bojilova almost 24 years ago

made changes about document doctypes

View differences:

DBSAXHandler.java
33 33
{
34 34

  
35 35
   static int elementNo = 0;
36
   private String docname;
36
   static String docname;
37 37
   private String doctype;
38 38
   private String systemid;
39 39
   private boolean 	debug 	= false;
......
76 76
    // here is a bug: dtd.getPublicId() and dtd.getSustemId() return null.
77 77
    docname = dtd.getName();
78 78
    doctype = dtd.getPublicId();
79
    //if (doctype == null) {
80
      //doctype = docname;
81
    //}
82 79
    systemid = dtd.getSystemId();
83 80
    System.out.println("DOCNAME: " + docname);
84 81
    System.out.println("DOCTYPE: " + doctype);
......
92 89
   public void endDoctype() throws SAXException
93 90
   {
94 91
    System.out.println("end of DOCTYPE");
95
    if (doctype == null)
92
    if (doctype == null) {
96 93
        doctype = DBEntityResolver.doctype;
94
        //if (doctype == null) 
95
        //    doctype = docname;
96
    }
97 97
   }
98 98

  
99 99
   /** SAX Handler that is called at the start of each XML element */
......
117 117
      expName = name.getExpandedName();
118 118
      
119 119
      elementNo++;
120
      if ((elementNo == 1) && (doctype == null))
121
        throw new SAXException("No DOCTYPE declaration or PUBLIC ID provided");
120
      if (docname == null)
121
        throw new SAXException("No DOCTYPE declaration provided");
122 122
      // Get a reference to the parent element for the id
123 123
      long parent_id;
124 124
      int nodeIndex;
......
190 190
   {
191 191
    if (elementNo > 0) {
192 192
      DBSAXElement currentElement = (DBSAXElement)elementStack.peek();
193
      currentElement.writeCommentToDB(data);
193
      int nodeIndex = currentElement.incChildNum();
194
      currentElement.writeCommentToDB(data, nodeIndex);
194 195
    }
195 196
   }
197
   public void processingInstruction(String target, String data) throws SAXException
198
   {
199
    if (elementNo == 0)
200
        System.out.println("target:" + target + "\ndata:" + data);
201
    else if (elementNo > 0)
202
        System.out.println("targetHere:" + target + "\ndata:" + data);
203
   }
196 204

  
197 205
   /** SAX Handler that is called at the end of each XML element */
198 206
   public void endElement(NSName name) throws SAXException 

Also available in: Unified diff