KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > XMLCopyrightHandler


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.core;
12
13 import org.xml.sax.SAXException JavaDoc;
14 import org.xml.sax.ext.LexicalHandler JavaDoc;
15
16 public class XMLCopyrightHandler implements LexicalHandler JavaDoc {
17     
18     private String JavaDoc fCopyright = null;
19     private XMLDefaultHandler fHandler = null;
20     
21     public XMLCopyrightHandler(XMLDefaultHandler handler) {
22         fHandler = handler;
23     }
24
25     public void comment(char[] ch, int start, int length) throws SAXException JavaDoc {
26         // if we haven't parsed any elements, we assume it is a copyright
27
if (fHandler != null && fCopyright == null &&
28                 fHandler.fElementStack.isEmpty()) {
29             fCopyright = new String JavaDoc(ch, start, length);
30         }
31     }
32
33     public void endCDATA() throws SAXException JavaDoc {
34     }
35
36     public void endDTD() throws SAXException JavaDoc {
37     }
38
39     public void endEntity(String JavaDoc name) throws SAXException JavaDoc {
40     }
41
42     public void startCDATA() throws SAXException JavaDoc {
43     }
44
45     public void startDTD(String JavaDoc name, String JavaDoc publicId, String JavaDoc systemId)
46             throws SAXException JavaDoc {
47     }
48
49     public void startEntity(String JavaDoc name) throws SAXException JavaDoc {
50     }
51     
52     public String JavaDoc getCopyright() {
53         return fCopyright;
54     }
55
56 }
57
Popular Tags