equal
deleted
inserted
replaced
80 String suffixMatch = null; |
80 String suffixMatch = null; |
81 |
81 |
82 //The length of the longest match of a suffix type |
82 //The length of the longest match of a suffix type |
83 int longestSuffixMatch = 0; |
83 int longestSuffixMatch = 0; |
84 |
84 |
|
85 //Indicate whether a system entry has been searched |
|
86 boolean systemEntrySearched = false; |
|
87 |
85 /** |
88 /** |
86 * PreferType represents possible values of the prefer property |
89 * PreferType represents possible values of the prefer property |
87 */ |
90 */ |
88 public static enum PreferType { |
91 public static enum PreferType { |
89 PUBLIC("public"), |
92 PUBLIC("public"), |
154 isInstantMatch = false; |
157 isInstantMatch = false; |
155 rewriteMatch = null; |
158 rewriteMatch = null; |
156 longestRewriteMatch = 0; |
159 longestRewriteMatch = 0; |
157 suffixMatch = null; |
160 suffixMatch = null; |
158 longestSuffixMatch = 0; |
161 longestSuffixMatch = 0; |
|
162 systemEntrySearched = false; |
159 } |
163 } |
160 /** |
164 /** |
161 * Constructs a group entry. |
165 * Constructs a group entry. |
162 * @param catalog The parent catalog |
166 * @param catalog The parent catalog |
163 * @param base The baseURI attribute |
167 * @param base The baseURI attribute |
210 * referenced. |
214 * referenced. |
211 * |
215 * |
212 * @return An URI string if a mapping is found, or null otherwise. |
216 * @return An URI string if a mapping is found, or null otherwise. |
213 */ |
217 */ |
214 public String matchSystem(String systemId) { |
218 public String matchSystem(String systemId) { |
|
219 systemEntrySearched = true; |
215 String match = null; |
220 String match = null; |
216 for (BaseEntry entry : entries) { |
221 for (BaseEntry entry : entries) { |
217 switch (entry.type) { |
222 switch (entry.type) { |
218 case SYSTEM: |
223 case SYSTEM: |
219 match = ((SystemEntry) entry).match(systemId); |
224 match = ((SystemEntry) entry).match(systemId); |
275 * referenced. |
280 * referenced. |
276 * |
281 * |
277 * @return An URI string if a mapping is found, or null otherwise. |
282 * @return An URI string if a mapping is found, or null otherwise. |
278 */ |
283 */ |
279 public String matchPublic(String publicId) { |
284 public String matchPublic(String publicId) { |
280 //as the specification required |
285 /* |
281 if (!isPreferPublic) { |
286 When both public and system identifiers are specified, and prefer is |
|
287 not public (that is, system), only system entry will be used. |
|
288 */ |
|
289 if (!isPreferPublic && systemEntrySearched) { |
282 return null; |
290 return null; |
283 } |
291 } |
284 |
|
285 //match public entries |
292 //match public entries |
286 String match = null; |
293 String match = null; |
287 for (BaseEntry entry : entries) { |
294 for (BaseEntry entry : entries) { |
288 switch (entry.type) { |
295 switch (entry.type) { |
289 case PUBLIC: |
296 case PUBLIC: |