001 /* 002 * Copyright (c) 2000 World Wide Web Consortium, 003 * (Massachusetts Institute of Technology, Institut National de 004 * Recherche en Informatique et en Automatique, Keio University). All 005 * Rights Reserved. This program is distributed under the W3C's Software 006 * Intellectual Property License. This program is distributed in the 007 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even 008 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 009 * PURPOSE. 010 * See W3C License http://www.w3.org/Consortium/Legal/ for more details. 011 */ 012 013 package org.w3c.dom.css; 014 015 import org.w3c.dom.DOMException; 016 017 /** 018 * The <code>CSSCharsetRule</code> interface represents a @charset rule in a 019 * CSS style sheet. The value of the <code>encoding</code> attribute does 020 * not affect the encoding of text data in the DOM objects; this encoding is 021 * always UTF-16. After a stylesheet is loaded, the value of the 022 * <code>encoding</code> attribute is the value found in the 023 * <code>@charset</code> rule. If there was no <code>@charset</code> in the 024 * original document, then no <code>CSSCharsetRule</code> is created. The 025 * value of the <code>encoding</code> attribute may also be used as a hint 026 * for the encoding used on serialization of the style sheet. 027 * <p> The value of the @charset rule (and therefore of the 028 * <code>CSSCharsetRule</code>) may not correspond to the encoding the 029 * document actually came in; character encoding information e.g. in an HTTP 030 * header, has priority (see CSS document representation) but this is not 031 * reflected in the <code>CSSCharsetRule</code>. 032 * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>. 033 * @since DOM Level 2 034 */ 035 public interface CSSCharsetRule extends CSSRule { 036 /** 037 * The encoding information used in this <code>@charset</code> rule. 038 */ 039 public String getEncoding(); 040 /** 041 * The encoding information used in this <code>@charset</code> rule. 042 * @exception DOMException 043 * SYNTAX_ERR: Raised if the specified encoding value has a syntax error 044 * and is unparsable. 045 * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this encoding rule is 046 * readonly. 047 */ 048 public void setEncoding(String encoding) 049 throws DOMException; 050 051 }