01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: Xml2SiteModel.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.gui.model;
09:
10: import com.uwyn.rife.xml.Xml2Data;
11: import org.xml.sax.Attributes;
12:
13: public class Xml2SiteModel extends Xml2Data {
14: private StringBuilder mCharacterData = null;
15: private SiteModel mCurrentSite = null;
16:
17: public SiteModel getSiteModel() {
18: return mCurrentSite;
19: }
20:
21: public void startDocument() {
22: mCharacterData = new StringBuilder();
23: mCurrentSite = null;
24: }
25:
26: public void endDocument() {
27: mCharacterData = null;
28: mCurrentSite = null;
29: }
30:
31: public void startElement(String namespaceURI, String localName,
32: String qName, Attributes atts) {
33: if (qName.equals("element")) {
34: } else if (qName.equals("description")) {
35: mCharacterData = new StringBuilder();
36: }
37: }
38:
39: public void endElement(String namespaceURI, String localName,
40: String qName) {
41: if (qName.equals("description")) {
42: mCharacterData = new StringBuilder();
43: }
44: }
45:
46: public void characters(char[] ch, int start, int length) {
47: if (length > 0) {
48: mCharacterData
49: .append(String.copyValueOf(ch, start, length));
50: }
51: }
52: }
|