KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mr > core > util > xml > sax > NonNSContentHandler


1 package org.mr.core.util.xml.sax;
2
3 import org.xml.sax.Attributes JavaDoc;
4 import org.xml.sax.ContentHandler JavaDoc;
5 import org.xml.sax.Locator JavaDoc;
6 import org.xml.sax.SAXException JavaDoc;
7 import org.xml.sax.helpers.AttributesImpl JavaDoc;
8
9 /*
10  * Copyright 2002 by
11  * <a HREF="http://www.coridan.com">Coridan</a>
12  * <a HREF="mailto: support@coridan.com ">support@coridan.com</a>
13  *
14  * The contents of this file are subject to the Mozilla Public License Version
15  * 1.1 (the "License"); you may not use this file except in compliance with the
16  * License. You may obtain a copy of the License at
17  * http://www.mozilla.org/MPL/
18  *
19  * Software distributed under the License is distributed on an "AS IS" basis,
20  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
21  * for the specific language governing rights and limitations under the
22  * License.
23  *
24  * The Original Code is "MantaRay" (TM).
25  *
26  * The Initial Developer of the Original Code is Coridan.
27  * Portions created by the Initial Developer are Copyright (C) 2006
28  * Coridan Inc. All Rights Reserved.
29  *
30  * Contributor(s): all the names of the contributors are added in the source
31  * code where applicable.
32  *
33  * Alternatively, the contents of this file may be used under the terms of the
34  * LGPL license (the "GNU LESSER GENERAL PUBLIC LICENSE"), in which case the
35  * provisions of LGPL are applicable instead of those above. If you wish to
36  * allow use of your version of this file only under the terms of the LGPL
37  * License and not to allow others to use your version of this file under
38  * the MPL, indicate your decision by deleting the provisions above and
39  * replace them with the notice and other provisions required by the LGPL.
40  * If you do not delete the provisions above, a recipient may use your version
41  * of this file under either the MPL or the GNU LESSER GENERAL PUBLIC LICENSE.
42  
43  *
44  * This library is free software; you can redistribute it and/or modify it
45  * under the terms of the MPL as stated above or under the terms of the GNU
46  * Lesser General Public License as published by the Free Software Foundation;
47  * either version 2.1 of the License, or any later version.
48  *
49  * This library is distributed in the hope that it will be useful, but WITHOUT
50  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
51  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
52  * License for more details.
53  */

54
55  /**
56  * User: Moti Tal
57  * Date: Apr 6, 2005
58  * Time: 9:26:09 AM
59  *
60  * Holds a ContentHandler Object, whih receives notification of the logical content of a document.
61  * This class is used to help writing XML class easly without having to insert simple parameters.
62  *
63  */

64 public class NonNSContentHandler{
65
66     private ContentHandler JavaDoc m_handler;
67     public final static Attributes JavaDoc EMPTY_ATTRIBUTES = new AttributesImpl JavaDoc();
68     public static final String JavaDoc EMPTY_NS = "";
69
70     public NonNSContentHandler(ContentHandler JavaDoc i_handler) {
71         m_handler = i_handler;
72     }
73
74     /**
75      * get a ContentHandler that holds the current xml.
76       * @return
77      */

78     public ContentHandler JavaDoc getHandler() {
79         return m_handler;
80     }
81
82     public void setDocumentLocator(Locator JavaDoc i_locator) {
83         m_handler.setDocumentLocator(i_locator);
84     }
85
86     public void startDocument()
87             throws SAXException JavaDoc {
88         m_handler.startDocument();
89     }
90
91     public void endDocument()
92             throws SAXException JavaDoc {
93         m_handler.endDocument();
94     }
95
96     public void startElement(String JavaDoc i_name, NonNSAttributes i_attributes)
97             throws SAXException JavaDoc {
98         m_handler.startElement(EMPTY_NS, i_name, i_name, i_attributes.toAttributes());
99     }
100
101     public void startElement(String JavaDoc i_name)
102             throws SAXException JavaDoc {
103         m_handler.startElement(EMPTY_NS, i_name, i_name, EMPTY_ATTRIBUTES);
104     }
105
106     public void endElement(String JavaDoc i_name)
107             throws SAXException JavaDoc {
108         m_handler.endElement(EMPTY_NS, i_name, i_name);
109     }
110
111     public void characters(char i_chars[], int i_startIndex, int i_length)
112             throws SAXException JavaDoc {
113         m_handler.characters(i_chars, i_startIndex, i_length);
114     }
115
116     public void characters(String JavaDoc i_str)
117             throws SAXException JavaDoc {
118         m_handler.characters(i_str.toCharArray(), 0, i_str.length());
119     }
120
121     public void ignorableWhitespace(char i_chars[], int i_startIndex, int i_length)
122             throws SAXException JavaDoc {
123         m_handler.ignorableWhitespace(i_chars, i_startIndex, i_length);
124     }
125
126     public void processingInstruction(String JavaDoc i_target, String JavaDoc i_data)
127             throws SAXException JavaDoc {
128         m_handler.processingInstruction(i_target, i_data);
129     }
130
131     public void skippedEntity(String JavaDoc i_name)
132             throws SAXException JavaDoc {
133         m_handler.skippedEntity(i_name);
134     }
135 }
136
Popular Tags