Mercurial > hg > mpdl-group
view software/eXist/mpdl-modules/src/de/mpg/mpiwg/berlin/mpdl/donatus/example/ParseDonatusResult.java @ 0:408254cf2f1d
Erstellung
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 24 Nov 2010 17:24:23 +0100 |
parents | |
children |
line wrap: on
line source
package de.mpg.mpiwg.berlin.mpdl.donatus.example; import org.xml.sax.*; public class ParseDonatusResult implements ContentHandler { public String value = null; public void startDocument() throws SAXException { System.out.println("<?xml version=\"1.0\"?>"); } public void endDocument() throws SAXException { } public void characters(char[] c, int start, int length) throws SAXException { //System.out.print(new String(c, start, length)); } public void ignorableWhitespace(char[] c, int start, int length) throws SAXException { //characters(c, start, length); } public void processingInstruction(String target, String data) throws SAXException { /*System.out.print("<?"); System.out.print(target); if (data != null && data.length() > 0) System.out.print(" " + data); System.out.println("?>");*/ } public void setDocumentLocator(org.xml.sax.Locator arg1) { } public void endElement(String uri, String localName, String name) throws SAXException { // TODO Auto-generated method stub } public void endPrefixMapping(String prefix) throws SAXException { // TODO Auto-generated method stub } public void skippedEntity(String name) throws SAXException { // TODO Auto-generated method stub } public void startElement(String uri, String localName, String name, Attributes attrs) throws SAXException { if (name.equals("lemma")) if (attrs != null) { int length = attrs.getLength(); for (int i = 0; (i < length) & (value==null); i++) { if (attrs.getLocalName(i).equals("form")) value = attrs.getValue(i); } } } public void startPrefixMapping(String prefix, String uri) throws SAXException { // TODO Auto-generated method stub } }