Source code: com/steadystate/css/CSS2Parser.java
1 /*
2 * CSS2Parser.java
3 *
4 * Steady State CSS2 Parser
5 *
6 * Copyright (C) 1999, 2002 Steady State Software Ltd. All rights reserved.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * To contact the authors of the library, write to Steady State Software Ltd.,
23 * 49 Littleworth, Wing, Buckinghamshire, LU7 0JX, England
24 *
25 * http://www.steadystate.com/css/
26 * mailto:css@steadystate.co.uk
27 *
28 * $Id: CSS2Parser.java,v 1.1.1.1 2003/12/28 21:22:43 davidsch Exp $
29 */
30
31 package com.steadystate.css;
32
33 import java.io.*;
34 import org.w3c.dom.*;
35 import org.w3c.dom.stylesheets.*;
36 import org.w3c.dom.css.*;
37 import org.w3c.css.sac.InputSource;
38 import com.steadystate.css.dom.*;
39 import com.steadystate.css.parser.CSSOMParser;
40
41 /**
42 *
43 * @author David Schweinsberg
44 * @version $Release$
45 * @deprecated As of 0.9.0, replaced by
46 * {@link com.steadystate.css.parsers.CSSOMParser}
47 */
48 public class CSS2Parser {
49
50 private CSSOMParser _parser = null;
51 private InputSource _is = null;
52
53 public CSS2Parser(
54 Reader stream,
55 Node ownerNode,
56 String href,
57 String title,
58 String media) {
59 _parser = new CSSOMParser();
60 _is = new InputSource(stream);
61 }
62
63 public CSS2Parser(
64 InputStream stream,
65 Node ownerNode,
66 String href,
67 String title,
68 String media) {
69 this(new InputStreamReader(stream), ownerNode, href, title, media);
70 }
71
72 public CSS2Parser(Reader stream) {
73 this(stream, null, null, null, null);
74 }
75
76 public CSS2Parser(InputStream stream) {
77 this(stream, null, null, null, null);
78 }
79 /*
80 public CSS2Parser(
81 InputStream stream,
82 StyleSheet parentStyleSheet,
83 CSSRule ownerRule,
84 String href,
85 String title,
86 String media) {
87 _parentStyleSheet = parentStyleSheet;
88 _ownerRule = ownerRule;
89 _href = href;
90 _title = title;
91 _media = media;
92 }
93
94 public CSS2Parser(
95 Reader stream,
96 StyleSheet parentStyleSheet,
97 CSSRule ownerRule,
98 String href,
99 String title,
100 String media) {
101 _parser = new CSSOMParser();
102 _is = new InputSource(stream);
103 }
104 */
105 public CSSStyleSheet styleSheet() {
106 try {
107 return _parser.parseStyleSheet(_is);
108 } catch (IOException e) {
109 return null;
110 }
111 }
112
113 public CSSRuleList styleSheetRuleList() throws IOException {
114 return null;
115 }
116
117 public CSSCharsetRule charsetRule() throws IOException {
118 return null;
119 }
120
121 public CSSUnknownRule unknownRule() throws IOException {
122 return null;
123 }
124
125 public CSSImportRule importRule() throws IOException {
126 return null;
127 }
128
129 public CSSMediaRule mediaRule() throws IOException {
130 return null;
131 }
132
133 public CSSPageRule pageRule() throws IOException {
134 return null;
135 }
136
137 public CSSFontFaceRule fontFaceRule() throws IOException {
138 return null;
139 }
140
141 public CSSStyleRule styleRule() throws IOException {
142 return null;
143 }
144
145 public CSSStyleDeclaration styleDeclaration() {
146 try {
147 return _parser.parseStyleDeclaration(_is);
148 } catch (IOException e) {
149 return null;
150 }
151 }
152
153 public CSSValue expr() {
154 try {
155 return _parser.parsePropertyValue(_is);
156 } catch (IOException e) {
157 return null;
158 }
159 }
160 }