KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > jcr > api > serialization > MockContentHandler


1 /*
2  * Copyright 2001-2003 The eXo platform SARL All rights reserved.
3  * Please look at license.txt in info directory for more license detail.
4  */

5
6 package org.exoplatform.services.jcr.api.serialization;
7
8 import org.xml.sax.ContentHandler JavaDoc;
9 import org.xml.sax.SAXException JavaDoc;
10 import org.xml.sax.Locator JavaDoc;
11 import org.xml.sax.Attributes JavaDoc;
12
13 /**
14  * Created y the eXo platform team
15  * User: Benjamin Mestrallet
16  * Date: 18 ao�t 2004
17  */

18 public class MockContentHandler implements ContentHandler JavaDoc {
19   public boolean reached;
20   public int nodes;
21   public int properties;
22   public int docElement;
23
24   public void endDocument() throws SAXException JavaDoc {
25   }
26
27   public void startDocument() throws SAXException JavaDoc {
28     reached = true;
29   }
30
31   public void characters(char ch[], int start, int length) throws SAXException JavaDoc {
32   }
33
34   public void ignorableWhitespace(char ch[], int start, int length) throws SAXException JavaDoc {
35   }
36
37   public void endPrefixMapping(String JavaDoc prefix) throws SAXException JavaDoc {
38   }
39
40   public void skippedEntity(String JavaDoc name) throws SAXException JavaDoc {
41   }
42
43   public void setDocumentLocator(Locator JavaDoc locator) {
44   }
45
46   public void processingInstruction(String JavaDoc target, String JavaDoc data) throws SAXException JavaDoc {
47   }
48
49   public void startPrefixMapping(String JavaDoc prefix, String JavaDoc uri) throws SAXException JavaDoc {
50   }
51
52   public void endElement(String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc qName) throws SAXException JavaDoc {
53   }
54
55   public void startElement(String JavaDoc namespaceURI, String JavaDoc localName,
56                            String JavaDoc qName, Attributes JavaDoc atts) throws SAXException JavaDoc {
57     if ("sv:node".equals(qName))
58       nodes++;
59     else if ("sv:property".equals(qName))
60       properties++;
61     else
62       docElement++;
63
64
65   }
66 }
67
68
Popular Tags