001 /* 002 * Copyright (c) 2005 Henri Sivonen 003 * Copyright (c) 2007 Mozilla Foundation 004 * 005 * Permission is hereby granted, free of charge, to any person obtaining a 006 * copy of this software and associated documentation files (the "Software"), 007 * to deal in the Software without restriction, including without limitation 008 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 009 * and/or sell copies of the Software, and to permit persons to whom the 010 * Software is furnished to do so, subject to the following conditions: 011 * 012 * The above copyright notice and this permission notice shall be included in 013 * all copies or substantial portions of the Software. 014 * 015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 018 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 020 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 021 * DEALINGS IN THE SOFTWARE. 022 */ 023 024 package nu.validator.messages; 025 026 import nu.validator.xml.EmptyAttributes; 027 import nu.validator.xml.SaxEmitter; 028 029 import org.xml.sax.Attributes; 030 import org.xml.sax.ContentHandler; 031 import org.xml.sax.SAXException; 032 033 /** 034 * @version $Id: XhtmlSaxEmitter.java 9 2007-08-11 08:40:38Z hsivonen $ 035 * @author hsivonen 036 */ 037 public class XmlSaxEmitter extends SaxEmitter { 038 039 /** 040 * @param contentHandler 041 */ 042 public XmlSaxEmitter(ContentHandler contentHandler) { 043 super(contentHandler); 044 } 045 046 public static final String NAMESPACE = "http://n.validator.nu/messages/"; 047 048 public void startElement(String name, Attributes attrs) throws SAXException { 049 this.contentHandler.startElement(NAMESPACE, name, name, attrs); 050 } 051 052 public void startElement(String name) throws SAXException { 053 this.contentHandler.startElement(NAMESPACE, name, name, EmptyAttributes.EMPTY_ATTRIBUTES); 054 } 055 056 public void endElement(String name) throws SAXException { 057 this.contentHandler.endElement(NAMESPACE, name, name); 058 } 059 060 }