data. ... got lost
[mir.git] / source / mircoders / input / XmlHandler.java
1 /**
2  * Title:        Indy
3  * Description:
4  * Copyright:    Copyright (c) 2001
5  * Company:      indymedia.de
6  * @author idfx
7  * @version 1.0
8  *
9  * formatted with JxBeauty (c) johann.langhofer@nextra.at
10  */
11
12
13 package mircoders.input;
14
15 import  org.xml.sax.helpers.DefaultHandler;
16 import  org.xml.sax.Attributes;
17 import  java.util.HashMap;
18
19
20 /**
21  * put your documentation comment here
22  */
23 public class XmlHandler extends DefaultHandler {
24   static HashMap valueHash = new HashMap();
25
26   /**
27    * parses every starting XML-Element
28    * @param uri
29    * @param name
30    * @param qname
31    * @param atts
32    */
33   public void startElement (String uri, String name, String qname, Attributes atts) {
34     HashMap values = new HashMap();
35     if (name.equals("content")) {
36       //table content
37       valueHash.put("table", "Content");
38       valueHash.put("values", values);
39       // content-articles should be published immediatly
40       ((HashMap)valueHash.get("values")).put("is_published", "1");
41     }
42     else if (name.equals("breaking")) {
43       //table content
44       valueHash.put("table", "Breaking");
45       valueHash.put("values", values);
46     }
47     else {
48       //System.out.println(name + ": " + atts.getValue("value"));
49       ((HashMap)valueHash.get("values")).put(name, atts.getValue("value"));
50     }
51   }
52
53   /**
54    * Returns the HashMap filled with the Values of the parsed XML-File
55    * @return
56    */
57   public static HashMap returnHash () {
58     return  valueHash;
59   }
60 }
61
62
63