iterator = values.iterator();
159 |
160 | while (iterator.hasNext()) {
161 |
162 | Selector selector = iterator.next();
163 |
164 | sb.append(selector.toString());
165 |
166 | if (iterator.hasNext()) {
167 | sb.append(", ");
168 | }
169 |
170 | }
171 |
172 | return sb.toString();
173 |
174 | }
175 |
176 | /**
177 | * Removes a property value from the rule.
178 | *
179 | * @param propertyValue The property value that should be removed.
180 | */
181 |
182 | public void removePropertyValue(final PropertyValue propertyValue) {
183 | propertyValues.remove(propertyValue);
184 | }
185 |
186 | /**
187 | * Adds a selector to the rule.
188 | *
189 | * @param selector The selector that should be attached to the rule.
190 | */
191 |
192 | public void addSelector(final Selector selector) {
193 | selectors.add(selector);
194 | }
195 |
196 | /**
197 | * Removes a selector from the rule.
198 | *
199 | * @param selector The selector that should be removed from the rule.
200 | */
201 |
202 | public void removeSelector(final Selector selector) {
203 | selectors.remove(selector);
204 | }
205 |
206 | }
207 |
--------------------------------------------------------------------------------
/doc/javadoc/deprecated-list.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Deprecated List
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | |
37 |
38 |
49 | |
50 |
51 |
52 | |
53 |
54 |
55 |
56 | |
57 | PREV
58 | NEXT |
59 |
60 | FRAMES
61 | NO FRAMES
62 |
69 |
72 |
73 |
74 | |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | Deprecated API
84 |
85 |
86 | Contents
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 | | Package |
102 | Class |
103 | Use |
104 | Tree |
105 | Deprecated |
106 | Index |
107 | Help |
108 |
109 |
110 | |
111 |
112 |
113 | |
114 |
115 |
116 |
117 | |
118 | PREV
119 | NEXT |
120 |
121 | FRAMES
122 | NO FRAMES
123 |
130 |
133 |
134 |
135 | |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
--------------------------------------------------------------------------------
/doc/javadoc/constant-values.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Constant Field Values
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | |
37 |
38 |
49 | |
50 |
51 |
52 | |
53 |
54 |
55 |
56 | |
57 | PREV
58 | NEXT |
59 |
60 | FRAMES
61 | NO FRAMES
62 |
69 |
72 |
73 |
74 | |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | Constant Field Values
84 |
85 |
86 | Contents
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 | |
98 |
99 |
110 | |
111 |
112 |
113 | |
114 |
115 |
116 |
117 | |
118 | PREV
119 | NEXT |
120 |
121 | FRAMES
122 | NO FRAMES
123 |
130 |
133 |
134 |
135 | |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
--------------------------------------------------------------------------------
/doc/javadoc/src-html/com/osbcp/cssparser/Selector.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 001 /*
5 | 002 * Licensed under the Apache License, Version 2.0 (the "License");
6 | 003 * you may not use this file except in compliance with the License.
7 | 004 * You may obtain a copy of the License at
8 | 005 *
9 | 006 * http://www.apache.org/licenses/LICENSE-2.0
10 | 007 *
11 | 008 * Unless required by applicable law or agreed to in writing, software
12 | 009 * distributed under the License is distributed on an "AS IS" BASIS,
13 | 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | 011 * See the License for the specific language governing permissions and
15 | 012 * limitations under the License.
16 | 013 *
17 | 014 * See the NOTICE file distributed with this work for additional
18 | 015 * information regarding copyright ownership.
19 | 016 */
20 | 017
21 | 018 package com.osbcp.cssparser;
22 | 019
23 | 020 /**
24 | 021 * Represents a CSS selector.
25 | 022 *
26 | 023 * @author <a href="mailto:christoffer@christoffer.me">Christoffer Pettersson</a>
27 | 024 */
28 | 025
29 | 026 public final class Selector {
30 | 027
31 | 028 private String name;
32 | 029
33 | 030 /**
34 | 031 * Creates a new selector.
35 | 032 *
36 | 033 * @param name Selector name.
37 | 034 */
38 | 035
39 | 036 public Selector(final String name) {
40 | 037 this.name = name;
41 | 038 }
42 | 039
43 | 040 @Override
44 | 041 public String toString() {
45 | 042 return name;
46 | 043 }
47 | 044
48 | 045 @Override
49 | 046 public boolean equals(final Object object) {
50 | 047
51 | 048 if (object instanceof Selector) {
52 | 049
53 | 050 Selector target = (Selector) object;
54 | 051
55 | 052 return target.name.equalsIgnoreCase(name);
56 | 053
57 | 054 }
58 | 055
59 | 056 return false;
60 | 057
61 | 058 }
62 | 059
63 | 060 @Override
64 | 061 public int hashCode() {
65 | 062 return toString().hashCode();
66 | 063 }
67 | 064
68 | 065 }
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/doc/javadoc/com/osbcp/cssparser/class-use/CSSParser.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Uses of Class com.osbcp.cssparser.CSSParser
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | |
37 |
38 |
49 | |
50 |
51 |
52 | |
53 |
54 |
55 |
56 | |
57 | PREV
58 | NEXT |
59 |
60 | FRAMES
61 | NO FRAMES
62 |
69 |
72 |
73 |
74 | |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | Uses of Class
com.osbcp.cssparser.CSSParser
84 |
85 | No usage of com.osbcp.cssparser.CSSParser
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | |
96 |
97 |
108 | |
109 |
110 |
111 | |
112 |
113 |
114 |
115 | |
116 | PREV
117 | NEXT |
118 |
119 | FRAMES
120 | NO FRAMES
121 |
128 |
131 |
132 |
133 | |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/doc/javadoc/com/osbcp/cssparser/class-use/IncorrectFormatException.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Uses of Class com.osbcp.cssparser.IncorrectFormatException
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | |
37 |
38 |
49 | |
50 |
51 |
52 | |
53 |
54 |
55 |
56 | |
57 | PREV
58 | NEXT |
59 |
60 | FRAMES
61 | NO FRAMES
62 |
69 |
72 |
73 |
74 | |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | Uses of Class
com.osbcp.cssparser.IncorrectFormatException
84 |
85 | No usage of com.osbcp.cssparser.IncorrectFormatException
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | |
96 |
97 |
108 | |
109 |
110 |
111 | |
112 |
113 |
114 |
115 | |
116 | PREV
117 | NEXT |
118 |
119 | FRAMES
120 | NO FRAMES
121 |
128 |
131 |
132 |
133 | |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/doc/javadoc/index-files/index-2.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | C-Index
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
77 |
78 |
79 |
80 | A C E G H I P R S T V
81 |
82 | C
83 |
84 | - com.osbcp.cssparser - package com.osbcp.cssparser
- Main package.
- CSSParser - Class in com.osbcp.cssparser
- Main logic for the CSS parser.
85 |
86 |
87 |
88 |
89 |
90 |
91 |
134 |
135 |
136 |
137 | A C E G H I P R S T V
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/doc/javadoc/index-files/index-5.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | H-Index
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
77 |
78 |
79 |
80 | A C E G H I P R S T V
81 |
82 | H
83 |
84 | - hashCode() -
85 | Method in class com.osbcp.cssparser.PropertyValue
86 |
-
87 |
- hashCode() -
88 | Method in class com.osbcp.cssparser.Selector
89 |
-
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
140 |
141 |
142 |
143 | A C E G H I P R S T V
144 |
145 |
146 |
147 |
--------------------------------------------------------------------------------
/doc/javadoc/index-files/index-9.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | S-Index
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
77 |
78 |
79 |
80 | A C E G H I P R S T V
81 |
82 | S
83 |
84 | - Selector - Class in com.osbcp.cssparser
- Represents a CSS selector.
- Selector(String) -
85 | Constructor for class com.osbcp.cssparser.Selector
86 |
- Creates a new selector.
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
137 |
138 |
139 |
140 | A C E G H I P R S T V
141 |
142 |
143 |
144 |
--------------------------------------------------------------------------------
/doc/javadoc/index-files/index-3.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | E-Index
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
77 |
78 |
79 |
80 | A C E G H I P R S T V
81 |
82 | E
83 |
84 | - equals(Object) -
85 | Method in class com.osbcp.cssparser.PropertyValue
86 |
-
87 |
- equals(Object) -
88 | Method in class com.osbcp.cssparser.Selector
89 |
-
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
140 |
141 |
142 |
143 | A C E G H I P R S T V
144 |
145 |
146 |
147 |
--------------------------------------------------------------------------------
/doc/javadoc/index-files/index-6.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | I-Index
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
77 |
78 |
79 |
80 | A C E G H I P R S T V
81 |
82 | I
83 |
84 | - IncorrectFormatException - Exception in com.osbcp.cssparser
- An exception that is thrown when the CSS parser finds a character it shouldn't have.
- IncorrectFormatException.ErrorCode - Enum in com.osbcp.cssparser
- List of unique error codes.
85 |
86 |
87 |
88 |
89 |
90 |
91 |
134 |
135 |
136 |
137 | A C E G H I P R S T V
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/doc/javadoc/serialized-form.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Serialized Form
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | |
37 |
38 |
49 | |
50 |
51 |
52 | |
53 |
54 |
55 |
56 | |
57 | PREV
58 | NEXT |
59 |
60 | FRAMES
61 | NO FRAMES
62 |
69 |
72 |
73 |
74 | |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | Serialized Form
84 |
85 |
86 |
87 |
88 |
89 | |
90 | Package com.osbcp.cssparser |
91 |
92 |
93 |
94 |
95 |
96 |
102 |
103 |
104 | serialVersionUID: 1L
105 |
106 |
107 |
108 |
109 |
110 | |
111 | Serialized Fields |
112 |
113 |
114 |
115 |
116 | errorCode
117 |
118 | IncorrectFormatException.ErrorCode errorCode
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 | |
134 |
135 |
146 | |
147 |
148 |
149 | |
150 |
151 |
152 |
153 | |
154 | PREV
155 | NEXT |
156 |
157 | FRAMES
158 | NO FRAMES
159 |
166 |
169 |
170 |
171 | |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
--------------------------------------------------------------------------------
/doc/javadoc/index-files/index-10.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | T-Index
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
77 |
78 |
79 |
80 | A C E G H I P R S T V
81 |
82 | T
83 |
84 | - toString() -
85 | Method in class com.osbcp.cssparser.PropertyValue
86 |
-
87 |
- toString() -
88 | Method in class com.osbcp.cssparser.Rule
89 |
-
90 |
- toString() -
91 | Method in class com.osbcp.cssparser.Selector
92 |
-
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
143 |
144 |
145 |
146 | A C E G H I P R S T V
147 |
148 |
149 |
150 |
--------------------------------------------------------------------------------
/doc/javadoc/index-files/index-11.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | V-Index
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
77 |
78 |
79 |
80 | A C E G H I P R S T V
81 |
82 | V
83 |
84 | - valueOf(String) -
85 | Static method in enum com.osbcp.cssparser.IncorrectFormatException.ErrorCode
86 |
- Returns the enum constant of this type with the specified name.
87 |
- values() -
88 | Static method in enum com.osbcp.cssparser.IncorrectFormatException.ErrorCode
89 |
- Returns an array containing the constants of this enum type, in
90 | the order they are declared.
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | |
101 |
102 |
113 | |
114 |
115 |
116 | |
117 |
118 |
119 |
120 | |
121 | PREV LETTER
122 | NEXT LETTER |
123 |
124 | FRAMES
125 | NO FRAMES
126 |
133 |
136 |
137 |
138 | |
139 |
140 |
141 |
142 |
143 |
144 | A C E G H I P R S T V
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/doc/javadoc/overview-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Class Hierarchy
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | |
37 |
38 |
49 | |
50 |
51 |
52 | |
53 |
54 |
55 |
56 | |
57 | PREV
58 | NEXT |
59 |
60 | FRAMES
61 | NO FRAMES
62 |
69 |
72 |
73 |
74 | |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | Hierarchy For All Packages
84 |
85 |
86 | - Package Hierarchies:
- com.osbcp.cssparser
87 |
88 |
89 | Class Hierarchy
90 |
91 |
92 | - java.lang.Object
93 | - com.osbcp.cssparser.CSSParser
- com.osbcp.cssparser.PropertyValue
- com.osbcp.cssparser.Rule
- com.osbcp.cssparser.Selector
- java.lang.Throwable (implements java.io.Serializable)
94 |
95 | - java.lang.Exception
97 |
98 |
99 |
100 |
101 | Enum Hierarchy
102 |
103 |
104 | - java.lang.Object
105 | - java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable)
106 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 | |
119 |
120 |
131 | |
132 |
133 |
134 | |
135 |
136 |
137 |
138 | |
139 | PREV
140 | NEXT |
141 |
142 | FRAMES
143 | NO FRAMES
144 |
151 |
154 |
155 |
156 | |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
--------------------------------------------------------------------------------
/doc/javadoc/index-files/index-1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | A-Index
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
77 |
78 |
79 |
80 | A C E G H I P R S T V
81 |
82 | A
83 |
84 | - addPropertyValue(PropertyValue) -
85 | Method in class com.osbcp.cssparser.Rule
86 |
- Adds a property value to the rule.
87 |
- addSelector(Selector) -
88 | Method in class com.osbcp.cssparser.Rule
89 |
- Adds a selector to the rule.
90 |
- addSelectors(List<Selector>) -
91 | Method in class com.osbcp.cssparser.Rule
92 |
- Adds a list of selectors to the existing list of selectors.
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | |
103 |
104 |
115 | |
116 |
117 |
118 | |
119 |
120 |
121 |
122 | |
123 | PREV LETTER
124 | NEXT LETTER |
125 |
126 | FRAMES
127 | NO FRAMES
128 |
135 |
138 |
139 |
140 | |
141 |
142 |
143 |
144 |
145 |
146 | A C E G H I P R S T V
147 |
148 |
149 |
150 |
--------------------------------------------------------------------------------
/doc/javadoc/com/osbcp/cssparser/package-tree.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | com.osbcp.cssparser Class Hierarchy
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | |
37 |
38 |
49 | |
50 |
51 |
52 | |
53 |
54 |
55 |
56 | |
57 | PREV
58 | NEXT |
59 |
60 | FRAMES
61 | NO FRAMES
62 |
69 |
72 |
73 |
74 | |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | Hierarchy For Package com.osbcp.cssparser
84 |
85 |
86 |
87 | Class Hierarchy
88 |
89 |
90 | - java.lang.Object
91 | - com.osbcp.cssparser.CSSParser
- com.osbcp.cssparser.PropertyValue
- com.osbcp.cssparser.Rule
- com.osbcp.cssparser.Selector
- java.lang.Throwable (implements java.io.Serializable)
92 |
93 | - java.lang.Exception
95 |
96 |
97 |
98 |
99 | Enum Hierarchy
100 |
101 |
102 | - java.lang.Object
103 | - java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable)
104 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 | |
117 |
118 |
129 | |
130 |
131 |
132 | |
133 |
134 |
135 |
136 | |
137 | PREV
138 | NEXT |
139 |
140 | FRAMES
141 | NO FRAMES
142 |
149 |
152 |
153 |
154 | |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/doc/javadoc/index-files/index-7.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | P-Index
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
77 |
78 |
79 |
80 | A C E G H I P R S T V
81 |
82 | P
83 |
84 | - parse(String) -
85 | Static method in class com.osbcp.cssparser.CSSParser
86 |
- Reads CSS as a String and returns back a list of Rules.
87 |
- PropertyValue - Class in com.osbcp.cssparser
- Represents a property and its value of a CSS rule.
- PropertyValue(String, String) -
88 | Constructor for class com.osbcp.cssparser.PropertyValue
89 |
- Creates a new PropertyValue based on a property and its value.
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
140 |
141 |
142 |
143 | A C E G H I P R S T V
144 |
145 |
146 |
147 |
--------------------------------------------------------------------------------
/doc/javadoc/com/osbcp/cssparser/package-use.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Uses of Package com.osbcp.cssparser
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | |
37 |
38 |
49 | |
50 |
51 |
52 | |
53 |
54 |
55 |
56 | |
57 | PREV
58 | NEXT |
59 |
60 | FRAMES
61 | NO FRAMES
62 |
69 |
72 |
73 |
74 | |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | Uses of Package
com.osbcp.cssparser
84 |
85 |
86 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 | |
127 |
128 |
139 | |
140 |
141 |
142 | |
143 |
144 |
145 |
146 | |
147 | PREV
148 | NEXT |
149 |
150 | FRAMES
151 | NO FRAMES
152 |
159 |
162 |
163 |
164 | |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
--------------------------------------------------------------------------------
/doc/javadoc/com/osbcp/cssparser/class-use/Rule.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Uses of Class com.osbcp.cssparser.Rule
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | |
37 |
38 |
49 | |
50 |
51 |
52 | |
53 |
54 |
55 |
56 | |
57 | PREV
58 | NEXT |
59 |
60 | FRAMES
61 | NO FRAMES
62 |
69 |
72 |
73 |
74 | |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | Uses of Class
com.osbcp.cssparser.Rule
84 |
85 |
86 |
92 |
93 |
94 |
95 |
96 |
97 | | Methods in com.osbcp.cssparser that return types with arguments of type Rule |
98 |
99 |
100 |
101 | static java.util.List<Rule> |
102 | CSSParser.parse(java.lang.String css)
103 |
104 |
105 | Reads CSS as a String and returns back a list of Rules. |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 | |
119 |
120 |
131 | |
132 |
133 |
134 | |
135 |
136 |
137 |
138 | |
139 | PREV
140 | NEXT |
141 |
142 | FRAMES
143 | NO FRAMES
144 |
151 |
154 |
155 |
156 | |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
--------------------------------------------------------------------------------
/doc/javadoc/src-html/com/osbcp/cssparser/IncorrectFormatException.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 001 /*
5 | 002 * Licensed under the Apache License, Version 2.0 (the "License");
6 | 003 * you may not use this file except in compliance with the License.
7 | 004 * You may obtain a copy of the License at
8 | 005 *
9 | 006 * http://www.apache.org/licenses/LICENSE-2.0
10 | 007 *
11 | 008 * Unless required by applicable law or agreed to in writing, software
12 | 009 * distributed under the License is distributed on an "AS IS" BASIS,
13 | 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | 011 * See the License for the specific language governing permissions and
15 | 012 * limitations under the License.
16 | 013 *
17 | 014 * See the NOTICE file distributed with this work for additional
18 | 015 * information regarding copyright ownership.
19 | 016 */
20 | 017
21 | 018 package com.osbcp.cssparser;
22 | 019
23 | 020 /**
24 | 021 * An exception that is thrown when the CSS parser finds a character it shouldn't have.
25 | 022 *
26 | 023 * @author <a href="mailto:christoffer@christoffer.me">Christoffer Pettersson</a>
27 | 024 */
28 | 025
29 | 026 public class IncorrectFormatException extends Exception {
30 | 027
31 | 028 private static final long serialVersionUID = 1L;
32 | 029
33 | 030 private ErrorCode errorCode;
34 | 031
35 | 032 /**
36 | 033 * Creates a new IncorrectFormatExeption with an error message;
37 | 034 *
38 | 035 * @param errorCode S unique error code associated with the error.
39 | 036 * @param message Error message describing the problem.
40 | 037 */
41 | 038
42 | 039 IncorrectFormatException(final ErrorCode errorCode, final String message) {
43 | 040 super(message);
44 | 041 this.errorCode = errorCode;
45 | 042 }
46 | 043
47 | 044 /**
48 | 045 * Returns a unique error code associated with the error.
49 | 046 *
50 | 047 * @return A unique error code associated with the error.
51 | 048 */
52 | 049
53 | 050 public ErrorCode getErrorCode() {
54 | 051 return errorCode;
55 | 052 }
56 | 053
57 | 054 /**
58 | 055 * List of unique error codes.
59 | 056 *
60 | 057 * @author <a href="mailto:christoffer@christoffer.me">Christoffer Pettersson</a>
61 | 058 */
62 | 059
63 | 060 public enum ErrorCode {
64 | 061
65 | 062 /**
66 | 063 * When the parse founds a semicolon ; when reading the property name.
67 | 064 */
68 | 065 FOUND_SEMICOLON_WHEN_READING_PROPERTY_NAME,
69 | 066
70 | 067 /**
71 | 068 * When the parse founds an end bracket } before the value's semicolon ; ending.
72 | 069 */
73 | 070 FOUND_END_BRACKET_BEFORE_SEMICOLON,
74 | 071
75 | 072 /**
76 | 073 * When the parse founds a colon , before reading a real selector name.
77 | 074 */
78 | 075 FOUND_COLON_WHEN_READING_SELECTOR_NAME;
79 | 076
80 | 077 }
81 | 078
82 | 079 }
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/doc/javadoc/src-html/com/osbcp/cssparser/IncorrectFormatException.ErrorCode.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 001 /*
5 | 002 * Licensed under the Apache License, Version 2.0 (the "License");
6 | 003 * you may not use this file except in compliance with the License.
7 | 004 * You may obtain a copy of the License at
8 | 005 *
9 | 006 * http://www.apache.org/licenses/LICENSE-2.0
10 | 007 *
11 | 008 * Unless required by applicable law or agreed to in writing, software
12 | 009 * distributed under the License is distributed on an "AS IS" BASIS,
13 | 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | 011 * See the License for the specific language governing permissions and
15 | 012 * limitations under the License.
16 | 013 *
17 | 014 * See the NOTICE file distributed with this work for additional
18 | 015 * information regarding copyright ownership.
19 | 016 */
20 | 017
21 | 018 package com.osbcp.cssparser;
22 | 019
23 | 020 /**
24 | 021 * An exception that is thrown when the CSS parser finds a character it shouldn't have.
25 | 022 *
26 | 023 * @author <a href="mailto:christoffer@christoffer.me">Christoffer Pettersson</a>
27 | 024 */
28 | 025
29 | 026 public class IncorrectFormatException extends Exception {
30 | 027
31 | 028 private static final long serialVersionUID = 1L;
32 | 029
33 | 030 private ErrorCode errorCode;
34 | 031
35 | 032 /**
36 | 033 * Creates a new IncorrectFormatExeption with an error message;
37 | 034 *
38 | 035 * @param errorCode S unique error code associated with the error.
39 | 036 * @param message Error message describing the problem.
40 | 037 */
41 | 038
42 | 039 IncorrectFormatException(final ErrorCode errorCode, final String message) {
43 | 040 super(message);
44 | 041 this.errorCode = errorCode;
45 | 042 }
46 | 043
47 | 044 /**
48 | 045 * Returns a unique error code associated with the error.
49 | 046 *
50 | 047 * @return A unique error code associated with the error.
51 | 048 */
52 | 049
53 | 050 public ErrorCode getErrorCode() {
54 | 051 return errorCode;
55 | 052 }
56 | 053
57 | 054 /**
58 | 055 * List of unique error codes.
59 | 056 *
60 | 057 * @author <a href="mailto:christoffer@christoffer.me">Christoffer Pettersson</a>
61 | 058 */
62 | 059
63 | 060 public enum ErrorCode {
64 | 061
65 | 062 /**
66 | 063 * When the parse founds a semicolon ; when reading the property name.
67 | 064 */
68 | 065 FOUND_SEMICOLON_WHEN_READING_PROPERTY_NAME,
69 | 066
70 | 067 /**
71 | 068 * When the parse founds an end bracket } before the value's semicolon ; ending.
72 | 069 */
73 | 070 FOUND_END_BRACKET_BEFORE_SEMICOLON,
74 | 071
75 | 072 /**
76 | 073 * When the parse founds a colon , before reading a real selector name.
77 | 074 */
78 | 075 FOUND_COLON_WHEN_READING_SELECTOR_NAME;
79 | 076
80 | 077 }
81 | 078
82 | 079 }
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/doc/javadoc/index-files/index-4.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | G-Index
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
77 |
78 |
79 |
80 | A C E G H I P R S T V
81 |
82 | G
83 |
84 | - getErrorCode() -
85 | Method in exception com.osbcp.cssparser.IncorrectFormatException
86 |
- Returns a unique error code associated with the error.
87 |
- getProperty() -
88 | Method in class com.osbcp.cssparser.PropertyValue
89 |
- Returns the property.
90 |
- getPropertyValues() -
91 | Method in class com.osbcp.cssparser.Rule
92 |
- Returns a list of all property values attached to the rule.
93 |
- getSelectors() -
94 | Method in class com.osbcp.cssparser.Rule
95 |
- Returns a list of all selectors attached to the rule.
96 |
- getValue() -
97 | Method in class com.osbcp.cssparser.PropertyValue
98 |
- Returns the value.
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
149 |
150 |
151 |
152 | A C E G H I P R S T V
153 |
154 |
155 |
156 |
--------------------------------------------------------------------------------
/doc/javadoc/index-files/index-8.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | R-Index
8 |
9 |
10 |
11 |
12 |
13 |
14 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
77 |
78 |
79 |
80 | A C E G H I P R S T V
81 |
82 | R
83 |
84 | - removePropertyValue(PropertyValue) -
85 | Method in class com.osbcp.cssparser.Rule
86 |
- Removes a property value from the rule.
87 |
- removeSelector(Selector) -
88 | Method in class com.osbcp.cssparser.Rule
89 |
- Removes a selector from the rule.
90 |
- Rule - Class in com.osbcp.cssparser
- Represents a CSS rule.
- Rule(Selector) -
91 | Constructor for class com.osbcp.cssparser.Rule
92 |
- Creates a rule with a single selector.
93 |
- Rule() -
94 | Constructor for class com.osbcp.cssparser.Rule
95 |
- Creates an empty rule.
96 |
- Rule(List<Selector>) -
97 | Constructor for class com.osbcp.cssparser.Rule
98 |
- Creates a new rule based on a list of selectors.
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
149 |
150 |
151 |
152 | A C E G H I P R S T V
153 |
154 |
155 |
156 |
--------------------------------------------------------------------------------
/doc/javadoc/src-html/com/osbcp/cssparser/PropertyValue.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 001 /*
5 | 002 * Licensed under the Apache License, Version 2.0 (the "License");
6 | 003 * you may not use this file except in compliance with the License.
7 | 004 * You may obtain a copy of the License at
8 | 005 *
9 | 006 * http://www.apache.org/licenses/LICENSE-2.0
10 | 007 *
11 | 008 * Unless required by applicable law or agreed to in writing, software
12 | 009 * distributed under the License is distributed on an "AS IS" BASIS,
13 | 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | 011 * See the License for the specific language governing permissions and
15 | 012 * limitations under the License.
16 | 013 *
17 | 014 * See the NOTICE file distributed with this work for additional
18 | 015 * information regarding copyright ownership.
19 | 016 */
20 | 017
21 | 018 package com.osbcp.cssparser;
22 | 019
23 | 020 /**
24 | 021 * Represents a property and its value of a CSS rule.
25 | 022 *
26 | 023 * @author <a href="mailto:christoffer@christoffer.me">Christoffer Pettersson</a>
27 | 024 */
28 | 025
29 | 026 public final class PropertyValue {
30 | 027
31 | 028 private String property;
32 | 029 private String value;
33 | 030
34 | 031 /**
35 | 032 * Creates a new PropertyValue based on a property and its value.
36 | 033 *
37 | 034 * @param property The CSS property (such as 'width' or 'color').
38 | 035 * @param value The value of the property (such as '100px' or 'red').
39 | 036 */
40 | 037
41 | 038 public PropertyValue(final String property, final String value) {
42 | 039 this.property = property;
43 | 040 this.value = value;
44 | 041 }
45 | 042
46 | 043 @Override
47 | 044 public String toString() {
48 | 045 return property + ": " + value;
49 | 046 }
50 | 047
51 | 048 @Override
52 | 049 public boolean equals(final Object object) {
53 | 050
54 | 051 if (object instanceof PropertyValue) {
55 | 052
56 | 053 PropertyValue target = (PropertyValue) object;
57 | 054
58 | 055 return target.property.equalsIgnoreCase(property) && target.value.equalsIgnoreCase(value);
59 | 056
60 | 057 }
61 | 058
62 | 059 return false;
63 | 060
64 | 061 }
65 | 062
66 | 063 @Override
67 | 064 public int hashCode() {
68 | 065 return toString().hashCode();
69 | 066 }
70 | 067
71 | 068 /**
72 | 069 * Returns the property.
73 | 070 *
74 | 071 * @return The property.
75 | 072 */
76 | 073
77 | 074 public String getProperty() {
78 | 075 return property;
79 | 076 }
80 | 077
81 | 078 /**
82 | 079 * Returns the value.
83 | 080 *
84 | 081 * @return The value.
85 | 082 */
86 | 083
87 | 084 public String getValue() {
88 | 085 return value;
89 | 086 }
90 | 087
91 | 088 }
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/test/com/osbcp/cssparser/CSSParserTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | *
14 | * See the NOTICE file distributed with this work for additional
15 | * information regarding copyright ownership.
16 | */
17 |
18 | package com.osbcp.cssparser;
19 |
20 | import java.util.List;
21 |
22 | import junit.framework.Assert;
23 |
24 | import org.apache.commons.io.IOUtils;
25 | import org.junit.Test;
26 |
27 | public final class CSSParserTest {
28 |
29 | @Test
30 | public void testNull() throws Exception {
31 | CSSParser.parse(null);
32 | }
33 |
34 | @Test
35 | public void testEmpty() throws Exception {
36 | CSSParser.parse(" ");
37 | CSSParser.parse(" \n ");
38 | CSSParser.parse(" \n \t ");
39 | CSSParser.parse(" \n \t \r ");
40 | }
41 |
42 | @Test
43 | public void testComments() throws Exception {
44 | CSSParser.parse(" /* this should be ok */ ");
45 | CSSParser.parse(" /** JavaDoc comment **/ ");
46 | CSSParser.parse(" /** comment with \n new line **/ ");
47 | CSSParser.parse(" /* double **/ /** comment */ ");
48 | }
49 |
50 | @Test
51 | public void testBasicSingle() throws Exception {
52 |
53 | List rules = CSSParser.parse("div { width: 100px; }");
54 |
55 | Assert.assertEquals(1, rules.size());
56 |
57 | Rule rule = rules.get(0);
58 |
59 | Assert.assertEquals("div", rule.getSelectors().get(0).toString());
60 | Assert.assertEquals("width", rule.getPropertyValues().get(0).getProperty());
61 | Assert.assertEquals("100px", rule.getPropertyValues().get(0).getValue());
62 |
63 | }
64 |
65 | @Test
66 | public void testCommentInsideRule() throws Exception {
67 |
68 | List rules = CSSParser.parse("table /* and a comment here */ td { width: 100px; /* should be ignored */ text-decoration: underlined; }");
69 |
70 | Assert.assertEquals(1, rules.size());
71 |
72 | Rule rule = rules.get(0);
73 | Assert.assertEquals("table td", rule.getSelectors().get(0).toString());
74 | Assert.assertEquals("width", rule.getPropertyValues().get(0).getProperty());
75 | Assert.assertEquals("100px", rule.getPropertyValues().get(0).getValue());
76 | Assert.assertEquals("text-decoration", rule.getPropertyValues().get(1).getProperty());
77 | Assert.assertEquals("underlined", rule.getPropertyValues().get(1).getValue());
78 |
79 | }
80 |
81 | @Test
82 | public void testBase64() throws Exception {
83 |
84 | List rules = CSSParser.parse("image { background-image:url(data:image/gif;base64,ABC123/ABC123=ABC123);}");
85 |
86 | Assert.assertEquals(1, rules.size());
87 |
88 | Rule rule = rules.get(0);
89 | Assert.assertEquals("image", rule.getSelectors().get(0).toString());
90 |
91 | Assert.assertEquals("background-image", rule.getPropertyValues().get(0).getProperty());
92 | Assert.assertEquals("url(data:image/gif;base64,ABC123/ABC123=ABC123)", rule.getPropertyValues().get(0).getValue());
93 |
94 | }
95 |
96 | @Test
97 | public void testEmptPropertyValues() throws Exception {
98 |
99 | List rules = CSSParser.parse("its-all-empty { /*empty*/ } empty { }");
100 |
101 | Assert.assertEquals(0, rules.size());
102 |
103 | }
104 |
105 | @Test
106 | public void testDoubleComments() throws Exception {
107 |
108 | List rules = CSSParser.parse("its-all-empty { /* /* double comment */ } empty { height: 200px; /* /* double comment */width: 100px; }");
109 |
110 | System.out.println(rules);
111 |
112 | Assert.assertEquals(1, rules.size());
113 |
114 | Rule rule = rules.get(0);
115 |
116 | Assert.assertEquals("height", rule.getPropertyValues().get(0).getProperty());
117 | Assert.assertEquals("200px", rule.getPropertyValues().get(0).getValue());
118 |
119 | Assert.assertEquals("width", rule.getPropertyValues().get(1).getProperty());
120 | Assert.assertEquals("100px", rule.getPropertyValues().get(1).getValue());
121 |
122 | }
123 |
124 | @Test
125 | public void testBasicMultipleValues() throws Exception {
126 |
127 | List rules = CSSParser.parse("div { width: 100px; -mozilla-opacity: 345; } /* a comment */ beta{height:200px;display:blocked;}table td{}");
128 |
129 | Assert.assertEquals(2, rules.size());
130 |
131 | Rule rule = rules.get(0);
132 | Assert.assertEquals("div", rule.getSelectors().get(0).toString());
133 | Assert.assertEquals("width", rule.getPropertyValues().get(0).getProperty());
134 | Assert.assertEquals("100px", rule.getPropertyValues().get(0).getValue());
135 | Assert.assertEquals("-mozilla-opacity", rule.getPropertyValues().get(1).getProperty());
136 | Assert.assertEquals("345", rule.getPropertyValues().get(1).getValue());
137 |
138 | rule = rules.get(1);
139 | Assert.assertEquals("beta", rule.getSelectors().get(0).toString());
140 | Assert.assertEquals("height", rule.getPropertyValues().get(0).getProperty());
141 | Assert.assertEquals("200px", rule.getPropertyValues().get(0).getValue());
142 | Assert.assertEquals("display", rule.getPropertyValues().get(1).getProperty());
143 | Assert.assertEquals("blocked", rule.getPropertyValues().get(1).getValue());
144 |
145 | }
146 |
147 | @Test
148 | public void testDuplicatePropertiesSameOrder() throws Exception {
149 |
150 | List rules = CSSParser.parse("product-row { background: #ABC123; border: 1px black solid; border: none;background: url(http://www.domain.com/image.jpg);}");
151 |
152 | Rule rule = rules.get(0);
153 | Assert.assertEquals("product-row", rule.getSelectors().get(0).toString());
154 |
155 | Assert.assertEquals("background", rule.getPropertyValues().get(0).getProperty());
156 | Assert.assertEquals("#ABC123", rule.getPropertyValues().get(0).getValue());
157 |
158 | Assert.assertEquals("border", rule.getPropertyValues().get(1).getProperty());
159 | Assert.assertEquals("1px black solid", rule.getPropertyValues().get(1).getValue());
160 |
161 | Assert.assertEquals("border", rule.getPropertyValues().get(2).getProperty());
162 | Assert.assertEquals("none", rule.getPropertyValues().get(2).getValue());
163 |
164 | Assert.assertEquals("background", rule.getPropertyValues().get(3).getProperty());
165 | Assert.assertEquals("url(http://www.domain.com/image.jpg)", rule.getPropertyValues().get(3).getValue());
166 |
167 | }
168 |
169 | @Test
170 | public void testMultipleSelectors() throws Exception {
171 |
172 | List rules = CSSParser.parse("alpha, beta { width: 100px; text-decoration: underlined; } gamma delta { } epsilon, /* some comment */ zeta { height: 34px; } ");
173 |
174 | Assert.assertEquals(2, rules.size());
175 |
176 | /*
177 | * Rule 1
178 | */
179 |
180 | Rule rule = rules.get(0);
181 | Assert.assertEquals("alpha", rule.getSelectors().get(0).toString());
182 | Assert.assertEquals("beta", rule.getSelectors().get(1).toString());
183 |
184 | Assert.assertEquals("width", rule.getPropertyValues().get(0).getProperty());
185 | Assert.assertEquals("100px", rule.getPropertyValues().get(0).getValue());
186 | Assert.assertEquals("text-decoration", rule.getPropertyValues().get(1).getProperty());
187 | Assert.assertEquals("underlined", rule.getPropertyValues().get(1).getValue());
188 |
189 | /*
190 | * Rule 2
191 | */
192 |
193 | rule = rules.get(1);
194 | Assert.assertEquals("epsilon", rule.getSelectors().get(0).toString());
195 | Assert.assertEquals("zeta", rule.getSelectors().get(1).toString());
196 |
197 | Assert.assertEquals("height", rule.getPropertyValues().get(0).getProperty());
198 | Assert.assertEquals("34px", rule.getPropertyValues().get(0).getValue());
199 |
200 | }
201 |
202 | @Test
203 | public void testFileBasic() throws Exception {
204 |
205 | String contents = IOUtils.toString(this.getClass().getResourceAsStream("css.css"), "UTF-8");
206 |
207 | List rules = CSSParser.parse(contents);
208 |
209 | for (Rule rule : rules) {
210 | System.out.println(rule);
211 | }
212 |
213 | }
214 | }
215 |
--------------------------------------------------------------------------------