- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 14 Sep 2005 15:14:20 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/css In directory hutz:/tmp/cvs-serv9389/org/w3c/css/css Modified Files: CssCascadingOrder.java CssParser.java CssRuleList.java CssStyleRule.java HTMLStyleSheetParser.java StyleReport.java StyleReportFactory.java StyleReportSOAP12.java StyleSheet.java StyleSheetGenerator.java StyleSheetGenerator2.java StyleSheetGeneratorHTML.java StyleSheetGeneratorHTML2.java StyleSheetOrigin.java StyleSheetParser.java XMLStyleSheetHandler.java Log Message: >From Jean-Guilhem Rouel (again!) Reformatting of code Fix for bug 774 [1] (even more warnings) Fix for bug 768 [2] Modification of the soap output format (each warning list and error list has the URI it refers to) [1] http://www.w3.org/Bugs/Public/show_bug.cgi?id=774 [2] http://www.w3.org/Bugs/Public/show_bug.cgi?id=768 Index: XMLStyleSheetHandler.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/XMLStyleSheetHandler.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- XMLStyleSheetHandler.java 7 Sep 2005 15:57:00 -0000 1.20 +++ XMLStyleSheetHandler.java 14 Sep 2005 15:14:18 -0000 1.21 @@ -45,7 +45,7 @@ * @version $Revision$ * @author Philippe Le Hegaret */ -public class XMLStyleSheetHandler implements ContentHandler, +public class XMLStyleSheetHandler implements ContentHandler, LexicalHandler, ErrorHandler, EntityResolver { static String XHTML_NS = "http://www.w3.org/1999/xhtml"; @@ -59,8 +59,8 @@ URL documentURI = null; URL baseURI = null; - // StyleSheet styleSheet = new StyleSheet(); - StyleSheetParser styleSheetParser = new StyleSheetParser(); + // StyleSheet styleSheet = new StyleSheet(); + StyleSheetParser styleSheetParser = new StyleSheetParser(); boolean inStyle = false; String media = null; @@ -80,7 +80,7 @@ this.baseURI = baseURI; this.ac = ac; } - + public void setDocumentLocator (Locator locator) { this.locator = locator; } @@ -101,7 +101,7 @@ public void endPrefixMapping (String prefix) throws SAXException { } - + public void characters (char ch[], int start, int length) throws SAXException { if (inStyle) { @@ -128,9 +128,9 @@ String rel = (String) atts.get("alternate"); String type = (String) atts.get("type"); String href = (String) atts.get("href"); - + if (Util.onDebug) { - System.err.println("<?xml-stylesheet alternate=\"" + rel + System.err.println("<?xml-stylesheet alternate=\"" + rel + "\" type=\"" + type + "\"" + " href=\"" + href + "\"?>"); } @@ -164,25 +164,25 @@ try { new MimeType(type); } catch (Exception ex) { /* at worst, null */ }; - if (mt != null && (MimeType.TEXT_CSS.match(mt) == + if (mt != null && (MimeType.TEXT_CSS.match(mt) == MimeType.MATCH_SPECIFIC_SUBTYPE)) { // we're dealing with a stylesheet... URL url; - - try { + + try { if (baseURI != null) { - url = new URL(baseURI, href); + url = new URL(baseURI, href); } else { - url = new URL(href); + url = new URL(href); } } catch (MalformedURLException e) { return; // Ignore errors } - + if (Util.onDebug) { System.err.println("[XMLStyleSheetHandler::"+ "initialize(): " - + "should parse CSS url: " + + "should parse CSS url: " + url.toString() + "]"); } String media = (String) atts.get("media"); @@ -190,7 +190,7 @@ media="all"; } styleSheetParser.parseURL(ac, - url, + url, (String) atts.get("title"), rel, media, @@ -218,30 +218,30 @@ if (XHTML_NS.equals(namespaceURI)) { if ("base".equals(localName)) { String href = atts.getValue("href"); - + if (Util.onDebug) { System.err.println("BASE href=\"" + href + "\""); } - + if (href != null) { //URL url; - + try { - baseURI = new URL(documentURI, href); + baseURI = new URL(documentURI, href); documentURI = baseURI; } catch (MalformedURLException e) { return; // Ignore errors } } - + } else if ("link".equals(localName)) { String rel = atts.getValue("rel"); String type = atts.getValue("type"); String href = atts.getValue("href"); - + if (Util.onDebug) { - System.err.println("link rel=\"" + rel + System.err.println("link rel=\"" + rel + "\" type=\"" + type + "\"" + " href=\"" + href + "\""); } @@ -254,13 +254,13 @@ } catch (MimeTypeFormatException mtfe) { return; } - if (MimeType.TEXT_CSS.match(mt) != + if (MimeType.TEXT_CSS.match(mt) != MimeType.MATCH_SPECIFIC_SUBTYPE) { return; } if (href == null) { int line = -1; - + if (locator != null) { line = locator.getLineNumber(); } @@ -273,26 +273,26 @@ styleSheetParser.notifyErrors(ers); return; } - - if ((rel != null) && + + if ((rel != null) && rel.toLowerCase().indexOf("stylesheet") != -1) { // we're dealing with a stylesheet... // @@TODO alternate stylesheet URL url; - - try { + + try { if (baseURI != null) { - url = new URL(baseURI, href); + url = new URL(baseURI, href); } else { - url = new URL(href); + url = new URL(href); } } catch (MalformedURLException e) { return; // Ignore errors } - + if (Util.onDebug) { System.err.println("[XMLStyleSheetHandler::initialize(): " - + "should parse CSS url: " + + "should parse CSS url: " + url.toString() + "]"); } String media = atts.getValue("media"); @@ -300,7 +300,7 @@ media="all"; } styleSheetParser.parseURL(ac, - url, + url, atts.getValue("title"), rel, media, @@ -313,7 +313,7 @@ media = atts.getValue("media"); type = atts.getValue("type"); title = atts.getValue("title"); - + if (media == null) { media = "all"; } @@ -322,10 +322,10 @@ + "\" type=\"" + type + "\"" + " title=\"" + title + "\""); } - + if (type == null) { int line = -1; - + if (locator != null) { line = locator.getLineNumber(); } @@ -339,7 +339,7 @@ } else { try { MimeType mt = new MimeType(type); - if (MimeType.TEXT_CSS.match(mt) == + if (MimeType.TEXT_CSS.match(mt) == MimeType.MATCH_SPECIFIC_SUBTYPE) { text.setLength(0); inStyle = true; @@ -354,19 +354,19 @@ if (value != null) { // here we have a style attribute String id = atts.getValue("id"); handleStyleAttribute(value, id); - } + } } } else { // the style attribute, recommended by UI Tech TF String value = atts.getValue(XHTML_NS, "style"); - + if (value != null) { // here we have a style attribute String id = atts.getValue(XHTML_NS, "id"); handleStyleAttribute(value, id); - } + } } } - + public void endElement (String namespaceURI, String localName, String qName) throws SAXException { @@ -385,12 +385,12 @@ } styleSheetParser .parseStyleElement(ac, - new StringBufferInputStream(text.toString()), - title, media, + new StringBufferInputStream(text.toString()), + title, media, documentURI, line); } } - + } } } @@ -398,9 +398,9 @@ public void handleStyleAttribute(String value, String id) { if (id == null) { // but we have no id: create one. // a normal id should NOT contain a "#" character. - id = "#autoXML" + autoIdCount; + id = "#autoXML" + autoIdCount; // workaround a java hashcode bug. - id += "" + autoIdCount++; + id += "" + autoIdCount++; } int line = 0; if (locator != null) { @@ -409,13 +409,13 @@ // parse the style attribute. styleSheetParser .parseStyleAttribute(ac, - new ByteArrayInputStream(value.getBytes()), + new ByteArrayInputStream(value.getBytes()), id, documentURI, line); } public StyleSheet getStyleSheet() { return styleSheetParser.getStyleSheet(); - } + } public void startDTD (String name, String publicId, String systemId) @@ -451,7 +451,7 @@ public void warning(SAXParseException exception) throws SAXException { } - + public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { String uri = null; @@ -477,7 +477,7 @@ } } uri = catalog.getProperty(publicId); - } + } if (uri == null && systemId != null) { uri = catalog.getProperty(systemId); } @@ -496,7 +496,7 @@ try { xmlParser.setProperty("http://xml.org/sax/properties/lexical-handler", this); - xmlParser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); + xmlParser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); xmlParser.setFeature("http://xml.org/sax/features/validation", false); /* xmlParser.setFeature("http://xml.org/sax/features/external-parameter-entities", @@ -538,7 +538,7 @@ xmlParser.setProperty("http://xml.org/sax/properties/lexical-handler", this); xmlParser.setFeature("http://xml.org/sax/features/namespace-prefixes", true); - + xmlParser.setFeature("http://xml.org/sax/features/validation", false); xmlParser.setErrorHandler(this); xmlParser.setEntityResolver(this); @@ -558,7 +558,7 @@ // if text/html and no given charset, let's assume // iso-8859-1. Ideally, the parser would change the // encoding if it find a mismatch, not sure, but well... - if (repmime.match(MimeType.TEXT_HTML) == + if (repmime.match(MimeType.TEXT_HTML) == MimeType.MATCH_SPECIFIC_SUBTYPE) { source.setEncoding("iso-8859-1"); } @@ -572,7 +572,7 @@ cis.close(); } } - + Hashtable getValues(String data) { int length = data.length(); int current = 0; @@ -690,7 +690,7 @@ case 'a': case 'm': case 'p': case 'l': case 't': case 'g': case 'q': case 'u': case 'o': - case 's': + case 's': entity_name.append(c); break; case ';': Index: StyleSheetGeneratorHTML2.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetGeneratorHTML2.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- StyleSheetGeneratorHTML2.java 26 Aug 2005 14:09:49 -0000 1.16 +++ StyleSheetGeneratorHTML2.java 14 Sep 2005 15:14:17 -0000 1.17 @@ -38,35 +38,35 @@ */ public final class StyleSheetGeneratorHTML2 extends StyleReport implements CssPrinterStyle { - + StyleSheet style; - + Vector items; - + Warnings warnings; - + Errors errors; - + ApplContext ac; - + private CssSelectors selector; - + //private CssProperty property; - + private PrintWriter out; - + private int warningLevel; - + private Utf8Properties general; - + private static Utf8Properties availableFormat; - + private static Utf8Properties availablePropertiesURL; - + private static Hashtable formats = new Hashtable(); - + int counter = 0; - + /** * Create a new StyleSheetGenerator * @@ -81,7 +81,7 @@ */ public StyleSheetGeneratorHTML2(ApplContext ac, String title, StyleSheet style, String document, int warningLevel) { - + if (document == null) { document = "html.en"; } @@ -95,14 +95,14 @@ warnings = style.getWarnings(); errors = style.getErrors(); items = style.newGetRules(); - + this.warningLevel = warningLevel; - + general.put("errors-count", Integer.toString(errors.getErrorCount())); general.put("warnings-count", Integer.toString(warnings .getWarningCount())); general.put("rules-count", Integer.toString(items.size())); - + if (errors.getErrorCount() == 0) { desactivateError(); } @@ -123,24 +123,24 @@ } else { general.put("no-rules", ""); // remove no-rules } - + if (errors.getErrorCount() != 0 || warnings.getWarningCount() != 0) { // remove no-error-or-warning - general.put("no-error-or-warning", ""); + general.put("no-error-or-warning", ""); } - + if (Util.onDebug) general.list(System.err); - + DateFormat df = null; - + if (ac.getLang() != null) { try { df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, new Locale(ac.getLang() .substring(0, 2), "US")); } catch (Exception e) { - df = DateFormat.getDateTimeInstance(DateFormat.FULL, + df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US); } } @@ -150,12 +150,12 @@ general.put("today", new Date().toString()); } } - + public void desactivateError() { general.put("go-errors", ""); // remove go-errors general.put("errors", ""); // remove errors } - + /** * Returns a string representation of the object. */ @@ -167,31 +167,31 @@ } else { out.println(ac.getMsg().getGeneratorString("request")); } - + out.flush(); } - + // prints the stylesheet at the screen - public void produceStyleSheet() { - Vector atRules = style.newGetRules(); - for (int idx = 0; idx < atRules.size(); idx++) { + public void produceStyleSheet() { + Vector atRules = style.newGetRules(); + for (int idx = 0; idx < atRules.size(); idx++) { // out.print(((CssRuleList)atRules.elementAt(idx)).toHTML()); ((CssRuleList) atRules.elementAt(idx)).toHTML(out); out.print("\n"); } } - + public void print(CssProperty property) { Utf8Properties prop = new Utf8Properties(general); prop.put("property-name", property.getPropertyName().toString()); prop.put("property-value", property.toString()); - + if (!property.getImportant()) { prop.put("important-style", ""); } out.print(processStyle(prop.getProperty("declaration"), prop)); } - + public void produceParseException(CssParseException error, StringBuffer ret) { ret.append(' '); if (error.getContexts() != null && error.getContexts().size() != 0) { @@ -242,22 +242,22 @@ ret.append(queryReplace(error.getExp().toStringFromStart())); ret.append("<span>"); ret.append(queryReplace(error.getExp().toString())); - ret.append("</span>\n"); + ret.append("</span>\n"); } - } else { + } else { ret.append(ac.getMsg().getGeneratorString("unrecognize")); ret.append(" - <span class='error'>"); ret.append(queryReplace(error.getSkippedString())); ret.append("</span>\n"); } - + } - + public void produceError() { StringBuffer ret = new StringBuffer(1024); String oldSourceFile = null; boolean open = false; - + try { if (errors.getErrorCount() != 0) { int i = 0; @@ -282,7 +282,7 @@ ret.append(ac.getMsg().getGeneratorString("not-found")); ret.append("<span class='error'>"); ret.append(ex.getMessage()); - ret.append("</span>\n"); + ret.append("</span>\n"); } else if (ex instanceof CssParseException) { produceParseException((CssParseException) ex, ret); } else if (ex instanceof InvalidParamException) { @@ -299,12 +299,12 @@ ret.append("\n<p>"); CssErrorToken terror = (CssErrorToken) error[i]; ret.append(terror.getErrorDescription()).append(" : "); - ret.append(terror.getSkippedString()).append('\n'); + ret.append(terror.getSkippedString()).append('\n'); } else { ret.append("\n<p>" + "<span class='error'>Uncaught error</span> "); ret.append(ex).append('\n'); - + if (ex instanceof NullPointerException) { // ohoh, a bug ex.printStackTrace(); @@ -317,16 +317,16 @@ } ret.append("</div>"); } - + out.println(ret.toString()); } catch (Exception e) { out.println(ac.getMsg().getGeneratorString("request")); e.printStackTrace(); } } - + public void produceWarning() { - + boolean open = false; StringBuffer ret = new StringBuffer(1024); String oldSourceFile = ""; @@ -337,7 +337,7 @@ int i = 0; warnings.sort(); for (Warning[] warning = warnings.getWarnings(); i < warning.length; i++) { - + Warning warn = warning[i]; if (warn.getLevel() <= warningLevel) { if (!warn.getSourceFile().equals(oldSourceFile)) { @@ -350,26 +350,27 @@ ret.append(oldSourceFile).append("</a></h3><ul>"); open = true; } - if (warn.getLine() != oldLine - || !warn.getWarningMessage().equals(oldMessage)) { +// if (warn.getLine() != oldLine +// || !warn.getWarningMessage().equals(oldMessage)) { oldLine = warn.getLine(); oldMessage = warn.getWarningMessage(); ret.append("\n<li><span class='warning'>"); ret.append(ac.getMsg().getGeneratorString("line")); ret.append(" : "); - ret.append(oldLine); + ret.append(oldLine); if (warn.getLevel() != 0) { - ret.append(" Level : "); + ret.append(" (Level : "); ret.append(warn.getLevel()); + ret.append(")"); } ret.append("</span> "); ret.append(Util.escapeHTML(oldMessage)); - + if (warn.getContext() != null) { ret.append(" : ").append(warn.getContext()); } ret.append("</li>"); - } +// } } } if (open) { @@ -383,12 +384,12 @@ e.printStackTrace(); } } - + private String queryReplace(String s) { if (s != null) { int len = s.length(); - StringBuffer ret = new StringBuffer(len); - + StringBuffer ret = new StringBuffer(len); + for (int i = 0; i < len; i++) { char c = s.charAt(i); if (c == '<') { @@ -404,11 +405,11 @@ return "[empty string]"; } } - + private final String processSimple(String s) { return processStyle(general.getProperty(s), general); } - + private String processStyle(String str, Utf8Properties prop) { try { int i = 0; @@ -416,7 +417,7 @@ int lastIndexOfEntity = str.indexOf("-->", i); String entity = str.substring(i + 6, lastIndexOfEntity - 1) .toLowerCase(); - + if (entity.equals("rule")) { out.print(str.substring(0, i)); str = str.substring(lastIndexOfEntity + 3); @@ -436,7 +437,7 @@ str = str.substring(lastIndexOfEntity + 3); i = 0; } - } else if (entity.equals("selector")) { + } else if (entity.equals("selector")) { str = str.substring(lastIndexOfEntity + 3); i = 0; } else if (entity.equals("charset")) { @@ -461,12 +462,12 @@ out.print(str.substring(0, i)); str = str.substring(lastIndexOfEntity + 3); i = 0; - if (style.getType().equals("text/html")) { + if (style.getType().equals("text/html")) { out.println(ac.getMsg().getGeneratorString("doc-html", general.get("file-title").toString())); } else { out.println(ac.getMsg().getGeneratorString("doc")); - } + } } else { String value = prop.getProperty(entity); if (value != null) { @@ -477,14 +478,14 @@ } } } - + return str; } catch (Exception e) { e.printStackTrace(); return str; } } - + public final static void printAvailableFormat(PrintWriter out) { Enumeration e = availableFormat.propertyNames(); out.println(" -- listing available output format --"); @@ -497,12 +498,12 @@ } out.flush(); } - - private Utf8Properties setDocumentBase(String document) { - Utf8Properties properties = (Utf8Properties) formats.get(document); + + private Utf8Properties setDocumentBase(String document) { + Utf8Properties properties = (Utf8Properties) formats.get(document); if (properties == null) { URL url; - properties = new Utf8Properties(); + properties = new Utf8Properties(); try { url = StyleSheetGenerator.class.getResource(document); java.io.InputStream f = url.openStream(); @@ -518,17 +519,17 @@ } formats.put(document, properties); } - + return new Utf8Properties(properties); } - - private final static String getDocumentName(ApplContext ac, + + private final static String getDocumentName(ApplContext ac, String documentName) { documentName = documentName.toLowerCase(); String document = null; if (ac != null && ac.getLang() != null) { StringTokenizer tokens = new StringTokenizer(ac.getLang(), ","); - + while (tokens.hasMoreTokens()) { String l = tokens.nextToken().trim().toLowerCase(); document = availableFormat.getProperty(documentName + "." + l); @@ -544,7 +545,7 @@ } if (document != null) { break; - } + } } } if (document == null) { @@ -558,11 +559,11 @@ return document; } } - + private final static String getURLProperty(String name) { return availablePropertiesURL.getProperty(name); } - + static { URL url; availableFormat = new Utf8Properties(); @@ -576,7 +577,7 @@ + "couldn't load format properties "); System.err.println(" " + e.toString()); } - + availablePropertiesURL = new Utf8Properties(); try { url = StyleSheetGenerator.class.getResource("urls.properties"); Index: StyleReportFactory.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleReportFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- StyleReportFactory.java 8 Aug 2005 13:18:04 -0000 1.4 +++ StyleReportFactory.java 14 Sep 2005 15:14:17 -0000 1.5 @@ -8,13 +8,13 @@ import org.w3c.css.util.ApplContext; public class StyleReportFactory { - + /** * Give back a "StyleReport" object based on various * parameters, but mainly output" */ - public static StyleReport getStyleReport(ApplContext ac, - String title, + public static StyleReport getStyleReport(ApplContext ac, + String title, StyleSheet style, String document, int warningLevel) { @@ -34,4 +34,4 @@ warningLevel); } } - + Index: StyleReportSOAP12.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleReportSOAP12.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- StyleReportSOAP12.java 23 Aug 2005 16:22:54 -0000 1.9 +++ StyleReportSOAP12.java 14 Sep 2005 15:14:17 -0000 1.10 @@ -36,7 +36,7 @@ /** * @version $Revision$ */ -public final class StyleReportSOAP12 extends StyleReport +public final class StyleReportSOAP12 extends StyleReport implements CssPrinterStyle { StyleSheet style; @@ -48,7 +48,7 @@ Errors errors; ApplContext ac; - + private CssSelectors selector; private CssProperty property; @@ -56,7 +56,7 @@ private PrintWriter out; private int warningLevel; - + private Utf8Properties general; private static Utf8Properties availableFormat; @@ -99,7 +99,7 @@ items = style.newGetRules(); this.warningLevel = warningLevel; - + general.put("cssversion", ac.getCssVersion()); general.put("errors-count", Integer.toString(errors.getErrorCount())); general.put("warnings-count", Integer.toString(warnings @@ -107,7 +107,7 @@ general.put("rules-count", Integer.toString(items.size())); general.put("isvalid", (errors.getErrorCount() == 0) ? "true" : "false"); - + if (ac.getContentEncoding() != null) { general.put("encoding", " encoding=\"" + ac.getContentEncoding() + "\" "); @@ -134,10 +134,10 @@ } else { general.put("no-rules", ""); // remove no-rules } - + if (errors.getErrorCount() != 0 || warnings.getWarningCount() != 0) { // remove no-error-or-warning - general.put("no-error-or-warning", ""); + general.put("no-error-or-warning", ""); } if (Util.onDebug) @@ -151,7 +151,7 @@ DateFormat.FULL, new Locale(ac.getLang() .substring(0, 2), "US")); } catch (Exception e) { - df = DateFormat.getDateTimeInstance(DateFormat.FULL, + df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US); } } @@ -165,12 +165,12 @@ formatter.setTimeZone(TimeZone.getTimeZone("UTC")); general.put("currentdate", formatter.format(new Date())); } - + public void desactivateError() { general.put("go-errors", ""); // remove go-errors general.put("errors", ""); // remove errors } - + /** * Returns a string representation of the object. */ @@ -182,26 +182,26 @@ } else { out.println(ac.getMsg().getGeneratorString("request")); } - + out.flush(); } - + // prints the stylesheet at the screen public void produceStyleSheet() { } - + public void print(CssProperty property) { Utf8Properties prop = new Utf8Properties(general); prop.put("property-name", property.getPropertyName().toString()); prop.put("property-value", property.toString()); - + if (!property.getImportant()) { prop.put("important-style", ""); } out.print(processStyle(prop.getProperty("declaration"), prop)); } - + public void produceParseException(CssParseException error) { if (error.getContexts() != null && error.getContexts().size() != 0) { StringBuffer buf = new StringBuffer(); @@ -266,7 +266,7 @@ /** * Produce SOAP elements for all the errors found - * in the StyleSheet <i>style</i> + * in the StyleSheet <i>style</i> */ public void produceError() { String oldSourceFile = null; @@ -284,16 +284,17 @@ out.print(" </m:errorlist>\n"); } out.print(" <m:errorlist>\n"); + out.print(" <m:uri>" + file + "</m:uri>\n"); open = true; } out.print(" <m:error>\n <m:line>"); out.print(error[i].getLine()); - out.print("</m:line>\n <m:errortype>"); + out.print("</m:line>\n <m:errortype>"); if (ex instanceof FileNotFoundException) { out.print("not-found"); out.print("</m:errortype>\n <m:message>"); out.print(ex.getMessage()); - out.print("</m:message>\n"); + out.print("</m:message>\n"); } else if (ex instanceof CssParseException) { produceParseException((CssParseException) ex); } else if (ex instanceof InvalidParamException) { @@ -339,10 +340,10 @@ out.print("</m:processingerror>\n"); } } - + /** * Produce SOAP elements for all the warnings found - * in the StyleSheet <i>style</i> + * in the StyleSheet <i>style</i> */ public void produceWarning() { boolean open = false; @@ -354,7 +355,7 @@ int i = 0; warnings.sort(); for (Warning[] warning = warnings.getWarnings(); i < warning.length; i++) { - + Warning warn = warning[i]; if (warn.getLevel() <= warningLevel) { if (!warn.getSourceFile().equals(oldSourceFile)) { @@ -363,16 +364,17 @@ } oldSourceFile = warn.getSourceFile(); out.print(" <m:warninglist>\n"); + out.print(" <m:uri>" + oldSourceFile + "</m:uri>\n"); open = true; } - if (warn.getLine() != oldLine - || !warn.getWarningMessage().equals(oldMessage)) { +// if (warn.getLine() != oldLine +// || !warn.getWarningMessage().equals(oldMessage)) { oldLine = warn.getLine(); oldMessage = warn.getWarningMessage(); out.print(" <m:warning>\n <m:line>"); out.print(oldLine); out.print("</m:line>\n"); - + // if (warn.getLevel() != 0) { // ret.append(" Level : "); // ret.append(warn.getLevel()); @@ -389,7 +391,7 @@ out.print("</m:context>\n"); } out.print(" </m:warning>\n"); - } +// } } } out.print(" </m:warninglist>"); @@ -401,7 +403,7 @@ out.print("</m:processingerror>\n"); } } - + /* * Replace all occurences of <, >, &, ' and " in a String with * their html values: <, >, &, &aps; and " @@ -411,8 +413,8 @@ private String queryReplace(String s) { if (s != null) { int len = s.length(); - StringBuffer ret = new StringBuffer(len); - + StringBuffer ret = new StringBuffer(len); + for (int i = 0; i < len; i++) { char c = s.charAt(i); if (c == '<') { @@ -434,11 +436,11 @@ return "[empty string]"; } } - + private final String processSimple(String s) { return processStyle(general.getProperty(s), general); } - + private String processStyle(String str, Utf8Properties prop) { try { int i = 0; @@ -491,7 +493,7 @@ out.print(str.substring(0, i)); str = str.substring(lastIndexOfEntity + 3); i = 0; - if (style.getType().equals("text/html")) { + if (style.getType().equals("text/html")) { out.println(ac.getMsg().getGeneratorString("doc-html", general.get("file-title").toString())); } else { @@ -507,14 +509,14 @@ } } } - + return str; } catch (Exception e) { e.printStackTrace(); return str; } } - + /** * List the available output formats on a PrintWriter * @param out the PrintWriter used to write the listing @@ -529,7 +531,7 @@ } out.flush(); } - + private Utf8Properties setDocumentBase(String document) { Utf8Properties properties = (Utf8Properties) formats.get(document); if (properties == null) { @@ -553,14 +555,14 @@ return new Utf8Properties(properties); } - - private final static String getDocumentName(ApplContext ac, + + private final static String getDocumentName(ApplContext ac, String documentName) { documentName = documentName.toLowerCase(); String document = null; if (ac != null && ac.getLang() != null) { StringTokenizer tokens = new StringTokenizer(ac.getLang(), ","); - + while (tokens.hasMoreTokens()) { String l = tokens.nextToken().trim().toLowerCase(); document = availableFormat.getProperty(documentName + "." + l); @@ -576,7 +578,7 @@ } if (document != null) { break; - } + } } } if (document == null) { @@ -590,11 +592,11 @@ return document; } } - + private final static String getURLProperty(String name) { return availablePropertiesURL.getProperty(name); } - + static { URL url; // the different available output formats Index: CssParser.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/CssParser.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CssParser.java 8 Sep 2005 12:23:33 -0000 1.5 +++ CssParser.java 14 Sep 2005 15:14:17 -0000 1.6 @@ -16,7 +16,7 @@ /** * This class describes how to implements your cascading * style sheet parser. - * + * * You must implements this interfaces if you want to have * a backward compatibilitie with other CSS parser. * <p> @@ -28,7 +28,7 @@ * StyleSheet style = parser.getStyleSheet();<br> * // here, i want an HTML document to output<br> * StyleSheetGenerator.setDocumentBase("html.properties");<br> - * StyleSheetGenerator generator = new StyleSheetGenerator("foo", + * StyleSheetGenerator generator = new StyleSheetGenerator("foo", * style, * "foo.css", * 2);<br> @@ -42,25 +42,25 @@ /** * Reinitialize this parser - */ + */ public abstract void reInit(); /** * Get the style sheet after a parse. * * @return The resulted style sheet - */ + */ public abstract StyleSheet getStyleSheet(); /** * @param url the URL containing the style sheet * @param title the title of the stylesheet * @param kind may be a stylesheet or an alternate stylesheet - * @param media the media to apply this + * @param media the media to apply this * @param origin the origin of the style sheet * @exception IOException an IO error */ - public void parseURL(ApplContext ac, URL url, String title, String kind, + public void parseURL(ApplContext ac, URL url, String title, String kind, String media, int origin); /** @@ -75,12 +75,12 @@ * * @param input the input string. * @param url the URL where the input stream comes from. - * @param lineno The number line in the source document. + * @param lineno The number line in the source document. * It is used for error message * @deprecated Replaced by parseStyleElement * @see #parseStyleElement(InputStream, URL, int) - */ - public abstract void parseStyleElement(ApplContext ac, String input, + */ + public abstract void parseStyleElement(ApplContext ac, String input, URL url, int lineno); /** @@ -95,8 +95,8 @@ * @param media the media of the style element * @param url the URL where the input stream comes from. * @param lineno The number line in the source document. It is used for error message - */ - public abstract void parseStyleElement(ApplContext ac, InputStream input, + */ + public abstract void parseStyleElement(ApplContext ac, InputStream input, String title, String media, URL url, int lineno); @@ -116,7 +116,7 @@ * @param lineno The number line in the source document. It is used for error message. * @deprecated Replaced by parseStyleAttribute * @see #parseStyleAttribute(InputStream, String, URL, int) - */ + */ public abstract void parseStyleAttribute(ApplContext ac, String input, String id, URL url, int lineno); /** @@ -130,8 +130,8 @@ * @param id your uniq id to reference this style attribute. * @param url the URL where the input stream comes from. * @param lineno The number line in the source document. It is used for error message. - */ - public abstract void parseStyleAttribute(ApplContext ac, InputStream input, + */ + public abstract void parseStyleAttribute(ApplContext ac, InputStream input, String id, URL url, int lineno); } Index: StyleSheetOrigin.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetOrigin.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- StyleSheetOrigin.java 8 Sep 2005 12:23:33 -0000 1.3 +++ StyleSheetOrigin.java 14 Sep 2005 15:14:18 -0000 1.4 @@ -15,17 +15,17 @@ /** * This property comes from the UA's default values. - */ + */ public static final int BROWSER = 1; - + /** * This property comes from the reader's style sheet. - */ + */ public static final int READER = 2; - + /** * This property comes from the author's style sheet. - */ + */ public static final int AUTHOR = 3; - + } Index: CssCascadingOrder.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/CssCascadingOrder.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CssCascadingOrder.java 8 Sep 2005 12:23:33 -0000 1.5 +++ CssCascadingOrder.java 14 Sep 2005 15:14:17 -0000 1.6 @@ -26,7 +26,7 @@ * for an element/property combination, the following algorithm must be * followed: * - * <OL> + * <OL> * <LI> Find all declarations that apply to the element/property in question. * Declarations apply if the selector matches the element in question. If no * declarations apply, the inherited value is used. If there is no inherited @@ -52,8 +52,8 @@ * UL LI {...} /* a=0 b=0 c=2 -> specificity = 2 * / * UL OL LI {...} /* a=0 b=0 c=3 -> specificity = 3 * / * LI.red {...} /* a=0 b=1 c=1 -> specificity = 11 * / - * UL OL LI.red {...} /* a=0 b=1 c=3 -> specificity = 13 * / - * #x34y {...} /* a=1 b=0 c=0 -> specificity = 100 * / + * UL OL LI.red {...} /* a=0 b=1 c=3 -> specificity = 13 * / + * #x34y {...} /* a=1 b=0 c=0 -> specificity = 100 * / * </PRE> * * <P> Pseudo-elements and pseudo-classes are counted as normal elements and @@ -96,10 +96,10 @@ * rules. In a transition phase, this policy will make it easier for stylistic * attributes to coexist with style sheets. * - * @version $Revision$ + * @version $Revision$ */ public final class CssCascadingOrder { - + CssProperty[] propertyData; int propertyCount; final int capacityIncrement = 10; @@ -112,7 +112,7 @@ * @param selector The current context. * @return the property with the right value. */ - public CssProperty order(CssProperty property, + public CssProperty order(CssProperty property, StyleSheet style, CssSelectors selector) { //int i = 0; propertyData = new CssProperty[10]; @@ -124,13 +124,13 @@ // question. (step 1) for (Enumeration e = style.getRules().elements(); e.hasMoreElements();) { CssSelectors context = (CssSelectors) e.nextElement(); - + Util.verbose("######## test with " + context + " and " + selector); - // if (!selector.equals(context) && context.canApply(selector)) { + // if (!selector.equals(context) && context.canApply(selector)) { if (context.canApply(selector)) { // here, don't try to resolve - CssProperty prop = + CssProperty prop = property.getPropertyInStyle(context.getStyle(), false); Util.verbose("%%%%%%%%%%%%%%%%% Found " + context); if (prop != null) { @@ -138,18 +138,18 @@ } } } - + if (propertyCount == 0) { // if I found nothing if (selector.getNext() != null && property.Inherited()) { // here, I can try to resolve - Util.verbose("Found nothing ... try the next " + Util.verbose("Found nothing ... try the next " + selector.getNext()); CssStyle s = style.getStyle(selector.getNext()); property = property.getPropertyInStyle(s, true); } // else use the default value } else { - Util.verbose("@@@@@@@@@@@@@@ FOUND " + Util.verbose("@@@@@@@@@@@@@@ FOUND " + propertyCount + " properties"); // runs the cascading order property = getProperty(selector); @@ -159,26 +159,26 @@ // the value of the property is inherited, // recompute again .... CssStyle s = style.getStyle(selector.getNext()); - property = property.getPropertyInStyle(s, true); + property = property.getPropertyInStyle(s, true); } } // duplicate the property because I change the context ... property = property.duplicate(); property.setSelectors(selector); - + return property; - } - + } + // here you can find the algorithm for the cascading order private CssProperty getProperty(CssSelectors selector) { SortAlgorithm sort = new QuickSortAlgorithm(); // sort by explicit weight and origin (step 2 and 3) - sort.sort(propertyData, 0, propertyCount - 1, + sort.sort(propertyData, 0, propertyCount - 1, new CompareExplicitWeight()); int old = propertyData[0].getExplicitWeight(); int end = 0; - while (end < propertyCount && + while (end < propertyCount && propertyData[end].getExplicitWeight() == old) { end++; } @@ -187,17 +187,17 @@ sort.sort(propertyData, 0, end-1, new CompareSpecificity()); old = propertyData[0].getSelectors().getSpecificity(); end = 0; - while (end < propertyCount && + while (end < propertyCount && propertyData[end].getSelectors().getSpecificity() == old) { end++; } // sort by order specified (step 5) sort.sort(propertyData, 0, end - 1, new CompareOrderSpecified()); - + return propertyData[0]; } - + private final void addProperty(CssProperty property) { int oldCapacity = propertyData.length; if (propertyCount + 1 > oldCapacity) { @@ -207,7 +207,7 @@ } propertyData[propertyCount++] = property; } - + } // all compare functions used in the cascading order Index: StyleSheetGeneratorHTML.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetGeneratorHTML.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- StyleSheetGeneratorHTML.java 8 Sep 2005 12:23:33 -0000 1.5 +++ StyleSheetGeneratorHTML.java 14 Sep 2005 15:14:17 -0000 1.6 @@ -47,7 +47,7 @@ Errors errors; ApplContext ac; - + private CssSelectors selector; private CssProperty property; @@ -55,7 +55,7 @@ private PrintWriter out; private int warningLevel; - + private Utf8Properties general; private static Utf8Properties availableFormat; @@ -63,7 +63,7 @@ private static Utf8Properties availablePropertiesURL; private static Hashtable formats = new Hashtable(); - + /** * Create a new StyleSheetGenerator * @@ -86,12 +86,12 @@ errors = style.getErrors(); items = (SortedHashtable) style.getRules(); this.warningLevel = warningLevel; - + general.put("errors-count", Integer.toString(errors.getErrorCount())); general.put("warnings-count", Integer.toString(warnings .getWarningCount())); general.put("rules-count", Integer.toString(items.size())); - + if (errors.getErrorCount() == 0) { desactivateError(); } @@ -110,10 +110,10 @@ } else { general.put("no-rules", ""); // remove no-rules } - + if (errors.getErrorCount() != 0 || warnings.getWarningCount() != 0) { // remove no-error-or-warning - general.put("no-error-or-warning", ""); + general.put("no-error-or-warning", ""); } if (Util.onDebug) @@ -127,7 +127,7 @@ DateFormat.FULL, new Locale(ac.getLang() .substring(0, 2), "US")); } catch (Exception e) { - df = DateFormat.getDateTimeInstance(DateFormat.FULL, + df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, Locale.US); } } @@ -137,12 +137,12 @@ general.put("today", new Date().toString()); } } - + public void desactivateError() { general.put("go-errors", ""); // remove go-errors general.put("errors", ""); // remove errors } - + /** * Returns a string representation of the object. */ @@ -154,10 +154,10 @@ } else { out.println(ac.getMsg().getGeneratorString("request")); } - + out.flush(); } - + public void produceRule() { Object[] array = items.getSortedArray(); for (int i = 0; i < array.length; i++) { @@ -167,26 +167,26 @@ } } } - + public void produceSelector(CssSelectors selectorLocal) { out.print(selectorLocal); } - + public void produceDeclaration() { selector.getStyle().print(this); - } - + } + public void print(CssProperty property) { Utf8Properties prop = new Utf8Properties(general); prop.put("property-name", property.getPropertyName().toString()); prop.put("property-value", property.toString()); - + if (!property.getImportant()) { prop.put("important-style", ""); } out.print(processStyle(prop.getProperty("declaration"), prop)); } - + public void produceParseException(CssParseException error, StringBuffer ret) { if (error.getContexts() != null && error.getContexts().size() != 0) { StringBuffer buf = new StringBuffer(); @@ -236,7 +236,7 @@ ret.append(queryReplace(error.getExp().toStringFromStart())); ret.append("<STRONG>"); ret.append(queryReplace(error.getExp().toString())); - ret.append("</STRONG>\n"); + ret.append("</STRONG>\n"); } } else { ret.append("\n<DD>"); @@ -245,7 +245,7 @@ ret.append(queryReplace(error.getSkippedString())); ret.append("</STRONG>\n"); } - + } public void produceError() { @@ -278,7 +278,7 @@ ret.append(ac.getMsg().getGeneratorString("not-found")); ret.append("<STRONG>"); ret.append(ex.getMessage()); - ret.append("</STRONG>\n"); + ret.append("</STRONG>\n"); } else if (ex instanceof CssParseException) { produceParseException((CssParseException) ex, ret); } else if (ex instanceof InvalidParamException) { @@ -295,12 +295,12 @@ CssErrorToken terror = (CssErrorToken) error[i]; ret.append("\n<DD>").append(" "); ret.append(terror.getErrorDescription()).append(" : "); - ret.append(terror.getSkippedString()).append('\n'); + ret.append(terror.getSkippedString()).append('\n'); } else { ret.append("\n<DD>"); ret.append("<STRONG>Uncaught error</STRONG>"); ret.append(ex).append('\n'); - + if (ex instanceof NullPointerException) { // ohoh, a bug ex.printStackTrace(); @@ -316,7 +316,7 @@ e.printStackTrace(); } } - + public void produceWarning() { StringBuffer ret = new StringBuffer(1024); @@ -329,7 +329,7 @@ warnings.sort(); ret.append("\n<UL>"); for (Warning[] warning = warnings.getWarnings(); i < warning.length; i++) { - + Warning warn = warning[i]; if (warn.getLevel() <= warningLevel) { if (!warn.getSourceFile().equals(oldSourceFile)) { @@ -348,14 +348,14 @@ oldMessage = warn.getWarningMessage(); ret.append("\n<DD><STRONG> Line : "); ret.append(oldLine); - + if (warn.getLevel() != 0) { ret.append(" Level : "); ret.append(warn.getLevel()); } ret.append(" </STRONG> "); ret.append(oldMessage); - + if (warn.getContext() != null) { ret.append(" : ").append(warn.getContext()); } @@ -370,12 +370,12 @@ e.printStackTrace(); } } - + private String queryReplace(String s) { if (s != null) { int len = s.length(); - StringBuffer ret = new StringBuffer(len); - + StringBuffer ret = new StringBuffer(len); + for (int i = 0; i < len; i++) { char c = s.charAt(i); if (c == '<') { @@ -391,11 +391,11 @@ return "[empty string]"; } } - + private final String processSimple(String s) { return processStyle(general.getProperty(s), general); } - + private String processStyle(String str, Utf8Properties prop) { try { int i = 0; @@ -448,7 +448,7 @@ out.print(str.substring(0, i)); str = str.substring(lastIndexOfEntity + 3); i = 0; - if (style.getType().equals("text/html")) { + if (style.getType().equals("text/html")) { out.println(ac.getMsg().getGeneratorString("doc-html", general.get("file-title").toString())); } else { @@ -464,14 +464,14 @@ } } } - + return str; } catch (Exception e) { e.printStackTrace(); return str; } } - + public final static void printAvailableFormat(PrintWriter out) { Enumeration e = availableFormat.propertyNames(); out.println(" -- listing available output format --"); @@ -482,7 +482,7 @@ } out.flush(); } - + private Utf8Properties setDocumentBase(String document) { Utf8Properties properties = (Utf8Properties) formats.get(document); if (properties == null) { @@ -506,14 +506,14 @@ return new Utf8Properties(properties); } - - private final static String getDocumentName(ApplContext ac, + + private final static String getDocumentName(ApplContext ac, String documentName) { documentName = documentName.toLowerCase(); String document = null; if (ac != null && ac.getLang() != null) { StringTokenizer tokens = new StringTokenizer(ac.getLang(), ","); - + while (tokens.hasMoreTokens()) { String l = tokens.nextToken().trim().toLowerCase(); document = availableFormat.getProperty(documentName + "." + l); @@ -529,7 +529,7 @@ } if (document != null) { break; - } + } } } if (document == null) { @@ -543,11 +543,11 @@ return document; } } - + private final static String getURLProperty(String name) { return availablePropertiesURL.getProperty(name); } - + static { URL url; availableFormat = new Utf8Properties(); Index: CssRuleList.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/CssRuleList.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- CssRuleList.java 26 Aug 2005 14:09:49 -0000 1.10 +++ CssRuleList.java 14 Sep 2005 15:14:17 -0000 1.11 @@ -12,13 +12,13 @@ import org.w3c.css.util.Util; public class CssRuleList { - + AtRule atRule; String atRuleString; Vector rulelist; public String pseudopage; String indent; - + public CssRuleList() { atRule = null; atRuleString = new String(); @@ -26,27 +26,27 @@ String pseudopage = new String(); indent = new String(); } - + public void addStyleRule(CssStyleRule stylerule) { rulelist.addElement(stylerule); } - + public Vector getStyleRules() { return rulelist; } - + public void addAtRule(AtRule atRule) { this.atRule = atRule; atRuleString = atRule.toString(); } - + public String getAtRule() { return atRuleString; } - + public String toString() { StringBuffer ret = new StringBuffer(); - + if (atRule.isEmpty()) { if (null != atRule && !atRuleString.equals("")) { ret.append(atRuleString); @@ -65,7 +65,7 @@ ret.append(indent); ret.append(((CssStyleRule)rulelist.elementAt(i)).toString()); } - + if (!atRuleString.equals("")) { ret.append('}'); ret.append('\n'); @@ -73,10 +73,10 @@ } return ret.toString(); } - + /* public String toHTML() { StringBuffer ret = new StringBuffer(); - + if (null != atRule && atRule.isEmpty()) { if (!atRuleString.equals("")) { ret.append("<li><span class='atSelector'>"); @@ -92,7 +92,7 @@ for (int i = 0; i < rulelist.size() ; i++ ) { ret.append(((CssStyleRule)rulelist.elementAt(i)).toHTML()); } - + if (!atRuleString.equals("")) { ret.append("</ul>}</li>\n"); } @@ -104,25 +104,25 @@ if (null != atRule && atRule.isEmpty()) { if (!atRuleString.equals("")) { out.print("<li><span class='atSelector'>"); - out.print(Util.escapeHTML(atRuleString)); + out.print(Util.escapeHTML(atRuleString)); out.print("</span></li> \n\n"); } } else { if (!atRuleString.equals("")) { out.print("<li><span class='atSelector'>"); - out.print(Util.escapeHTML(atRuleString)); + out.print(Util.escapeHTML(atRuleString)); out.print("</span> {\n<ul>\n"); } for (int i = 0; i < rulelist.size() ; i++ ) { - ((CssStyleRule)rulelist.elementAt(i)).toHTML(out); + ((CssStyleRule)rulelist.elementAt(i)).toHTML(out); } - + if (!atRuleString.equals("")) { out.print("</ul>}</li>\n"); } } } - + public void clear() { atRuleString = ""; rulelist.removeAllElements(); Index: StyleReport.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleReport.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- StyleReport.java 8 Aug 2005 13:18:04 -0000 1.2 +++ StyleReport.java 14 Sep 2005 15:14:17 -0000 1.3 @@ -8,10 +8,10 @@ import java.io.PrintWriter; public abstract class StyleReport { - + abstract public void print(PrintWriter out); - + abstract public void desactivateError(); } - + Index: StyleSheet.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- StyleSheet.java 26 Aug 2005 14:09:49 -0000 1.9 +++ StyleSheet.java 14 Sep 2005 15:14:17 -0000 1.10 @@ -61,7 +61,6 @@ if (debug) { Util.verbose("StyleSheet.getStyle("+context+")"); } - if (getContext(context) != null) { CssSelectors realContext = (CssSelectors) getContext(context); CssStyle style = realContext.getStyle(); @@ -242,7 +241,7 @@ public void endOfRule() { CssRuleList rulelist; boolean useless; - if (!doNotAddRule) { + if (!doNotAddRule) { CssStyleRule stylerule = new CssStyleRule(indent, selectortext, properties, important); if (!atRuleList.isEmpty()) { Index: CssStyleRule.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/CssStyleRule.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- CssStyleRule.java 26 Aug 2005 14:09:49 -0000 1.9 +++ CssStyleRule.java 14 Sep 2005 15:14:17 -0000 1.10 @@ -13,15 +13,15 @@ public class CssStyleRule { - - public CssStyleRule(String indent, String selectors, + + public CssStyleRule(String indent, String selectors, Vector properties, boolean important) { this.selectors = selectors; this.properties = properties; this.important = important; this.indent = indent; } - + public String toString() { StringBuffer ret = new StringBuffer(); if (selectors != null) { @@ -30,7 +30,7 @@ ret.append('{'); ret.append('\n'); } - + for (int i = 0; i < properties.size() ; i++) { CssProperty property = (CssProperty)properties.elementAt(i); ret.append(indent); @@ -54,12 +54,12 @@ } /* public String toHTML() { - StringBuffer ret = new StringBuffer("<li><span class='selector'>"); + StringBuffer ret = new StringBuffer("<li><span class='selector'>"); if (selectors != null) { ret.append(selectors); ret.append("</span> {<ul class='vRule'>\n"); } - + for (int i = 0; i < properties.size() ; i++) { CssProperty property = (CssProperty)properties.elementAt(i); ret.append("<li>"); @@ -78,12 +78,12 @@ */ public void toHTML(PrintWriter out) { if(properties != null) { - out.print("<li><span class='selector'>"); - if (selectors != null) { + out.print("<li><span class='selector'>"); + if (selectors != null) { out.print(selectors); out.print("</span> {<ul class='vRule'>\n"); } - + for (int i = 0; i < properties.size() ; i++) { CssProperty property = (CssProperty)properties.elementAt(i); out.print("<li>"); @@ -99,10 +99,10 @@ out.print("</ul>}</li>\n\n"); } } - + private String indent; private String selectors; private Vector properties; private boolean important; - + } Index: HTMLStyleSheetParser.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/HTMLStyleSheetParser.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- HTMLStyleSheetParser.java 29 Aug 2005 12:06:38 -0000 1.16 +++ HTMLStyleSheetParser.java 14 Sep 2005 15:14:17 -0000 1.17 @@ -28,7 +28,7 @@ * @version $Revision$ */ public final class HTMLStyleSheetParser implements HtmlParserListener { - + private StyleSheet style; private URL htmlURL; private Exception exception; @@ -50,7 +50,7 @@ if (!"http".equals(htmlURL.getProtocol())) { if (urlLower.endsWith(".css")) { StyleSheetParser parser = new StyleSheetParser(); - parser.parseURL(ac, htmlURL, null, null, media, + parser.parseURL(ac, htmlURL, null, null, media, StyleSheetOrigin.AUTHOR); style = parser.getStyleSheet(); } else if (urlLower.endsWith(".html") @@ -82,7 +82,7 @@ throw new Exception("Unknown file"); } else { URLConnection connection = null; - + try { boolean isXML = false; String cType; @@ -107,13 +107,13 @@ contentType = new MimeType(cType); } catch (MimeTypeFormatException ex) { } - + if (Util.onDebug) { - System.err.println( "[DEBUG] content type is [" + + System.err.println( "[DEBUG] content type is [" + contentType + ']'); } - if (contentType.match(MimeType.TEXT_HTML) == + if (contentType.match(MimeType.TEXT_HTML) == MimeType.MATCH_SPECIFIC_SUBTYPE) { HtmlParser htmlParser; htmlParser = new HtmlParser(ac, "html4", urlString, @@ -126,7 +126,7 @@ Util.fromHTMLFile = true; htmlParser.addParserListener(this); htmlParser.run(); - + if (exception != null) { throw (Exception) exception.fillInStackTrace(); } @@ -153,20 +153,20 @@ } else if (contentType.match(MimeType.TEXT_CSS) == MimeType.MATCH_SPECIFIC_SUBTYPE ) { StyleSheetParser parser = new StyleSheetParser(); - parser.parseURL(ac, htmlURL, null, null, media, + parser.parseURL(ac, htmlURL, null, null, media, StyleSheetOrigin.AUTHOR); style = parser.getStyleSheet(); - } else if ((contentType.match(MimeType.TEXT_XML) != + } else if ((contentType.match(MimeType.TEXT_XML) != MimeType.MATCH_SPECIFIC_SUBTYPE) && - (contentType.match(MimeType.APPLICATION_XHTML_XML) != + (contentType.match(MimeType.APPLICATION_XHTML_XML) != MimeType.MATCH_SPECIFIC_SUBTYPE)) { throw new IOException("Unknown mime type : "+ contentType); } - + if (isXML || - (contentType.match(MimeType.TEXT_XML) == + (contentType.match(MimeType.TEXT_XML) == MimeType.MATCH_SPECIFIC_SUBTYPE) || - (contentType.match(MimeType.APPLICATION_XHTML_XML) == + (contentType.match(MimeType.APPLICATION_XHTML_XML) == MimeType.MATCH_SPECIFIC_SUBTYPE)) { XMLStyleSheetHandler handler; handler = new XMLStyleSheetHandler(htmlURL, ac); @@ -174,16 +174,16 @@ style = handler.getStyleSheet(); if (style != null) { style.setType("text/xml"); - } - } + } + } } finally { try { connection.getInputStream().close(); } catch (Exception e) {} } } - } - + } + /** * Notifies root creation. @@ -192,21 +192,21 @@ * * @param url the URL being parsed. * @param root the new root Tag for this parser. - */ + */ public void notifyCreateRoot(URL url, HtmlTag root) { } - + public void notifyActivity(int lines, long bytes) { } - + public void notifyConnection(URLConnection cnx) { } - + /** * Notifies successful termination. * * @param root the root of the current Tree. - */ + */ public void notifyEnd(HtmlTag root, String contentType) { if (root != null) { style = ((HtmlTree) root).getStyleSheet(); @@ -216,7 +216,7 @@ } ac.setInput(contentType); } - + /** * Notifies a fatal error. * @@ -230,11 +230,11 @@ public void notifyFatalError(HtmlTag root, Exception x, String s) { exception = x; } - + /** * Returns the recognized style sheet. * @return A style sheet. - */ + */ public StyleSheet getStyleSheet() { return style; } Index: StyleSheetGenerator2.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetGenerator2.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- StyleSheetGenerator2.java 23 Aug 2005 16:22:54 -0000 1.4 +++ StyleSheetGenerator2.java 14 Sep 2005 15:14:17 -0000 1.5 @@ -27,14 +27,14 @@ * @version $Revision$ */ public final class StyleSheetGenerator2 { - + // SortedHashtable items; Hashtable items; Warnings warnings; Errors errors; - + private CssSelectors selector; private CssProperty property; @@ -42,7 +42,7 @@ private PrintWriter out; private int warningLevel; - + private Utf8Properties general; private static Utf8Properties availableFormat; @@ -63,7 +63,7 @@ */ public StyleSheetGenerator2(String title, StyleSheet style, String document, int warningLevel) { - + // this small part prints the stylesheet to the screen if (StyleSheetCom.showCSS == true) { @@ -80,17 +80,17 @@ general = new Utf8Properties(setDocumentBase(getDocumentName(document))); general.put("file-title", title); general.put("today", new Date().toString()); - + warnings = style.getWarnings(); errors = style.getErrors(); items = style.getRules(); this.warningLevel = warningLevel; - + general.put("errors-count", Integer.toString(errors.getErrorCount())); general.put("warnings-count", Integer.toString(warnings .getWarningCount())); general.put("rules-count", Integer.toString(items.size())); - + if (errors.getErrorCount() == 0) { desactivateError(); } @@ -104,17 +104,17 @@ } else { general.put("no-rules", ""); // remove no-rules } - + if (errors.getErrorCount() != 0 || warnings.getWarningCount() != 0) { // remove no-error-or-warning - general.put("no-error-or-warning", ""); + general.put("no-error-or-warning", ""); } - + if (Util.onDebug) general.list(System.err); } - + public void desactivateError() { general.put("go-errors", ""); // remove go-errors general.put("errors", ""); // remove errors @@ -134,7 +134,7 @@ out.println("Please correct your request "); out.println(" or send a mail to " + " www-validator-css@w3.org"); } - + out.flush(); } @@ -192,7 +192,7 @@ public void produceError() { StringBuffer ret = new StringBuffer(1024); String oldSourceFile = null; - + try { if (errors.getErrorCount() != 0) { int i = 0; @@ -205,12 +205,12 @@ } ret.append(" Line : ").append(error[i].getLine()); ret.append(" "); - + if (ex instanceof FileNotFoundException) { ret.append("File not found "); ret.append(ex.getMessage()); ret.append('\n'); - + } else if (ex instanceof CssParseException) { produceParseException((CssParseException) ex, ret); } else if (ex instanceof InvalidParamException) { @@ -222,16 +222,16 @@ ret.append(stringError.substring(0, index)); ret.append(" : "); ret.append(ex.getMessage()).append('\n'); - + } else if (error[i] instanceof CssErrorToken) { CssErrorToken terror = (CssErrorToken) error[i]; ret.append(" "); ret.append(terror.getErrorDescription()).append(" : "); ret.append(terror.getSkippedString()).append('\n'); - + } else { ret.append(ex).append(" \n"); - + if (ex instanceof NullPointerException) { // ohoh, a bug ex.printStackTrace(); @@ -245,7 +245,7 @@ e.printStackTrace(); } } - + public void produceWarning() { StringBuffer ret = new StringBuffer(1024); String oldSourceFile = ""; @@ -256,30 +256,30 @@ int i = 0; warnings.sort(); for (Warning[] warning = warnings.getWarnings(); i < warning.length; i++) { - + Warning warn = warning[i]; if (warn.getLevel() <= warningLevel) { if (!warn.getSourceFile().equals(oldSourceFile)) { oldSourceFile = warn.getSourceFile(); ret.append("\n URI : "); ret.append(oldSourceFile).append('\n'); - } + } if (warn.getLine() != oldLine || !warn.getWarningMessage().equals(oldMessage)) { oldLine = warn.getLine(); oldMessage = warn.getWarningMessage(); ret.append("Line : ").append(oldLine); - + if (warn.getLevel() != 0) { ret.append(" Level : "); ret.append(warn.getLevel()); } ret.append(" ").append(oldMessage); - + if (warn.getContext() != null) { ret.append(" : ").append(warn.getContext()); } - + ret.append(" \n"); } } @@ -291,7 +291,7 @@ e.printStackTrace(); } } - + private String queryReplace(String s) { if (s == null) { return "[empty string]"; @@ -303,19 +303,19 @@ private final String processSimple(String s) { return processStyle(general.getProperty(s), general); } - + private String processStyle(String str, Utf8Properties prop) { if (str == null) { return ""; } - + try { int i = 0; while ((i = str.indexOf("<!-- #", i)) >= 0) { int lastIndexOfEntity = str.indexOf("-->", i); String entity = str.substring(i + 6, lastIndexOfEntity - 1) .toLowerCase(); - + if (entity.equals("warning")) { out.print(str.substring(0, i)); str = str.substring(lastIndexOfEntity + 3); @@ -346,7 +346,7 @@ return str; } } - + public final static void printAvailableFormat(PrintWriter out) { Enumeration e = availableFormat.propertyNames(); out.println(" -- listing available output format --"); @@ -357,7 +357,7 @@ } out.flush(); } - + private Utf8Properties setDocumentBase(String document) { Utf8Properties properties = (Utf8Properties) formats.get(document); if (properties == null) { @@ -381,7 +381,7 @@ return new Utf8Properties(properties); } - + private final static String getDocumentName(String documentName) { String document = availableFormat.getProperty(documentName .toLowerCase()); @@ -393,7 +393,7 @@ return document; } } - + static { URL url; availableFormat = new Utf8Properties(); Index: StyleSheetGenerator.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetGenerator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- StyleSheetGenerator.java 8 Sep 2005 12:23:33 -0000 1.5 +++ StyleSheetGenerator.java 14 Sep 2005 15:14:17 -0000 1.6 @@ -32,14 +32,14 @@ * @version $Revision$ */ public final class StyleSheetGenerator implements CssPrinterStyle { - + // SortedHashtable items; Hashtable items; Warnings warnings; Errors errors; - + private CssSelectors selector; private CssProperty property; @@ -47,13 +47,13 @@ private PrintWriter out; private int warningLevel; - + private Utf8Properties general; private static Utf8Properties availableFormat; private static Hashtable formats = new Hashtable(); - + /** * Create a new StyleSheetGenerator * @@ -68,22 +68,22 @@ */ public StyleSheetGenerator(String title, StyleSheet style, String document, int warningLevel) { - + general = new Utf8Properties(setDocumentBase(getDocumentName(document))); general.put("file-title", title); general.put("today", new Date().toString()); - + warnings = style.getWarnings(); errors = style.getErrors(); // items = (SortedHashtable) style.getRules(); items = style.getRules(); this.warningLevel = warningLevel; - + general.put("errors-count", Integer.toString(errors.getErrorCount())); general.put("warnings-count", Integer.toString(warnings .getWarningCount())); general.put("rules-count", Integer.toString(items.size())); - + if (errors.getErrorCount() == 0) { desactivateError(); } @@ -97,21 +97,21 @@ } else { general.put("no-rules", ""); // remove no-rules } - + if (errors.getErrorCount() != 0 || warnings.getWarningCount() != 0) { // remove no-error-or-warning - general.put("no-error-or-warning", ""); + general.put("no-error-or-warning", ""); } - + if (Util.onDebug) general.list(System.err); } - + public void desactivateError() { general.put("go-errors", ""); // remove go-errors general.put("errors", ""); // remove errors } - + /** * Returns a string representation of the object. */ @@ -126,10 +126,10 @@ out.println("Please correct your request "); out.println(" or send a mail to " + " www-validator-css@w3.org"); } - + out.flush(); } - + public void produceRule() { // Object[] array = items.getSortedArray(); int i = 0; @@ -145,21 +145,21 @@ } } } - + public void produceSelector(CssSelectors selectorLocal) { // out.print(selectorLocal.getAtRule()); out.print(selectorLocal); } - + public void produceDeclaration() { selector.getStyle().print(this); - } - + } + public void print(CssProperty property) { Utf8Properties prop = new Utf8Properties(general); prop.put("property-name", property.getPropertyName().toString()); prop.put("property-value", property.toString()); - + if (!property.getImportant()) { prop.put("important-style", ""); } @@ -220,7 +220,7 @@ public void produceError() { StringBuffer ret = new StringBuffer(1024); String oldSourceFile = null; - + try { if (errors.getErrorCount() != 0) { int i = 0; @@ -233,12 +233,12 @@ } ret.append(" Line : ").append(error[i].getLine()); ret.append(" "); - + if (ex instanceof FileNotFoundException) { ret.append("File not found "); ret.append(ex.getMessage()); ret.append('\n'); - + } else if (ex instanceof CssParseException) { produceParseException((CssParseException) ex, ret); } else if (ex instanceof InvalidParamException) { @@ -250,16 +250,16 @@ ret.append(stringError.substring(0, index)); ret.append(" : "); ret.append(ex.getMessage()).append('\n'); - + } else if (error[i] instanceof CssErrorToken) { CssErrorToken terror = (CssErrorToken) error[i]; ret.append(" "); ret.append(terror.getErrorDescription()).append(" : "); ret.append(terror.getSkippedString()).append('\n'); - + } else { ret.append(ex).append(" \n"); - + if (ex instanceof NullPointerException) { // ohoh, a bug ex.printStackTrace(); @@ -273,7 +273,7 @@ e.printStackTrace(); } } - + public void produceWarning() { StringBuffer ret = new StringBuffer(1024); String oldSourceFile = ""; @@ -284,30 +284,30 @@ int i = 0; warnings.sort(); for (Warning[] warning = warnings.getWarnings(); i < warning.length; i++) { - + Warning warn = warning[i]; if (warn.getLevel() <= warningLevel) { if (!warn.getSourceFile().equals(oldSourceFile)) { oldSourceFile = warn.getSourceFile(); ret.append("\n URI : "); ret.append(oldSourceFile).append('\n'); - } + } if (warn.getLine() != oldLine || !warn.getWarningMessage().equals(oldMessage)) { oldLine = warn.getLine(); oldMessage = warn.getWarningMessage(); ret.append("Line : ").append(oldLine); - + if (warn.getLevel() != 0) { ret.append(" Level : "); ret.append(warn.getLevel()); } ret.append(" ").append(oldMessage); - + if (warn.getContext() != null) { ret.append(" : ").append(warn.getContext()); } - + ret.append(" \n"); } } @@ -319,7 +319,7 @@ e.printStackTrace(); } } - + private String queryReplace(String s) { if (s == null) { return "[empty string]"; @@ -327,16 +327,16 @@ return s; } } - + private final String processSimple(String s) { return processStyle(general.getProperty(s), general); } - + private String processStyle(String str, Utf8Properties prop) { if (str == null) { return ""; } - + try { int i = 0; while ((i = str.indexOf("<!-- #", i)) >= 0) { @@ -359,7 +359,7 @@ } else { i += 6; // skip this unknown entity } - + } else { out.print(str.substring(0, i)); str = str.substring(lastIndexOfEntity + 3); @@ -397,14 +397,14 @@ } } } - + return str; } catch (Exception e) { e.printStackTrace(); return str; } } - + public final static void printAvailableFormat(PrintWriter out) { Enumeration e = availableFormat.propertyNames(); out.println(" -- listing available output format --"); @@ -415,7 +415,7 @@ } out.flush(); } - + private Utf8Properties setDocumentBase(String document) { Utf8Properties properties = (Utf8Properties) formats.get(document); if (properties == null) { @@ -439,7 +439,7 @@ return new Utf8Properties(properties); } - + private final static String getDocumentName(String documentName) { String document = availableFormat.getProperty(documentName .toLowerCase()); @@ -451,7 +451,7 @@ return document; } } - + static { URL url; availableFormat = new Utf8Properties(); Index: StyleSheetParser.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetParser.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- StyleSheetParser.java 8 Sep 2005 16:37:44 -0000 1.8 +++ StyleSheetParser.java 14 Sep 2005 15:14:18 -0000 1.9 @@ -38,7 +38,7 @@ /** * @version $Revision$ */ -public final class StyleSheetParser +public final class StyleSheetParser implements CssValidatorListener, CssParser { private static Constructor co = null; @@ -59,27 +59,27 @@ public void reInit() { style = new StyleSheet(); } - + public StyleSheet getStyleSheet() { return style; } - + public void notifyErrors(Errors errors) { style.addErrors(errors); } - + public void notifyWarnings(Warnings warnings) { style.addWarnings(warnings); } - + /** * Adds a vector of properties to a selector. * * @param selector the selector * @param declarations Properties to associate with contexts - */ - public void handleRule(ApplContext ac, CssSelectors selector, - Vector properties) + */ + public void handleRule(ApplContext ac, CssSelectors selector, + Vector properties) { if (selector.getAtRule() instanceof AtRulePage) { style.remove(selector); @@ -102,7 +102,7 @@ } public void endOfAtRule() { - style.endOfAtRule(); + style.endOfAtRule(); } public void setImportant(boolean important) { @@ -147,7 +147,7 @@ * * @param ident The ident for this at-rule (for example: 'font-face') * @param string The string representation if this at-rule - */ + */ public void handleAtRule(ApplContext ac, String ident, String string) { style.getWarnings().addWarning(new Warning(cssFouffa.getSourceFile(), cssFouffa.getLine(), @@ -157,20 +157,20 @@ string, ac)); //stylesheet.addAtRule(atRule); } - + /** * @param url the URL containing the style sheet * @param title the title of the stylesheet * @param kind may be a stylesheet or an alternate stylesheet - * @param media the media to apply this + * @param media the media to apply this * @param origin the origin of the style sheet * @exception IOException an IO error */ - public void parseURL(ApplContext ac, URL url, String title, - String kind, String media, + public void parseURL(ApplContext ac, URL url, String title, + String kind, String media, int origin) { if (Util.onDebug) { - System.err.println( "StyleSheet.parseURL(" + url + ", " + System.err.println( "StyleSheet.parseURL(" + url + ", " + title + ", " + kind + ", " + media + ", " + origin + ")" ); @@ -181,7 +181,7 @@ return; } } - + try { ac.setOrigin(origin); // if (cssFouffa == null) { @@ -213,7 +213,7 @@ cssFouffa.setAtRule(m); } catch (org.w3c.css.util.InvalidParamException e) { Errors er = new Errors(); - er.addError(new org.w3c.css.parser.CssError(url.toString(), + er.addError(new org.w3c.css.parser.CssError(url.toString(), -1, e)); notifyErrors(er); return; @@ -221,12 +221,12 @@ cssFouffa.parseStyle(); } catch (Exception e) { Errors er = new Errors(); - er.addError(new org.w3c.css.parser.CssError(url.toString(), + er.addError(new org.w3c.css.parser.CssError(url.toString(), -1, e)); notifyErrors(er); } } - + /** * Parse a style element. The Style element always comes from the user * @@ -235,11 +235,11 @@ * @exception IOException an IO error */ public void parseStyleElement(ApplContext ac, InputStream input, - String title, String media, + String title, String media, URL url, int lineno) { if (Util.onDebug) { - System.err.println("StyleSheet.parseStyleElement(" + title + ", " - + media + ", " + url + System.err.println("StyleSheet.parseStyleElement(" + title + ", " + + media + ", " + url + "," + lineno + ")" ); } try { @@ -249,8 +249,8 @@ cssFouffa.addListener(this); // } else { // cssFouffa.ReInit(ac, input, url, lineno); -// } - +// } + // cssFouffa.setResponse(res); // cssFouffa.setDefaultMedium(defaultmedium); // cssFouffa.doConfig(); @@ -265,7 +265,7 @@ cssFouffa.setAtRule(m); } catch (org.w3c.css.util.InvalidParamException e) { Errors er = new Errors(); - er.addError(new org.w3c.css.parser.CssError(url.toString(), + er.addError(new org.w3c.css.parser.CssError(url.toString(), -1, e)); notifyErrors(er); return; @@ -273,11 +273,11 @@ cssFouffa.parseStyle(); } catch (IOException e) { Errors er = new Errors(); - er.addError(new org.w3c.css.parser.CssError(url.toString(), + er.addError(new org.w3c.css.parser.CssError(url.toString(), -1, e)); notifyErrors(er); } catch(TokenMgrError e) { - Errors er = new Errors(); + Errors er = new Errors(); CssParseException cpe = null; if (co != null) { try { @@ -292,19 +292,19 @@ if (cpe == null) { cpe = new CssParseException(new Exception(e.getMessage())); } - er.addError(new org.w3c.css.parser.CssError(url.toString(), + er.addError(new org.w3c.css.parser.CssError(url.toString(), e.getErrorLine(), cpe)); notifyErrors(er); } catch(RuntimeException e) { - Errors er = new Errors(); - er.addError(new org.w3c.css.parser.CssError(url.toString(), + Errors er = new Errors(); + er.addError(new org.w3c.css.parser.CssError(url.toString(), cssFouffa.getLine(), new CssParseException(e))); notifyErrors(er); } } - + /** * @param input the inputStream containing the style data * @param url the name of the file the style element was read in. @@ -313,10 +313,10 @@ * @see #parseStyleElement(InputStream, URL, int) */ public void parseStyleElement(ApplContext ac, String input, URL url, int lineno) { - parseStyleElement(ac, new ByteArrayInputStream(input.getBytes()), + parseStyleElement(ac, new ByteArrayInputStream(input.getBytes()), null, null, url, lineno); } - + /** * Parse some declarations. All declarations always comes from the user * @@ -325,14 +325,14 @@ * @param filename the name of the file the style element was read in. * @exception IOException an IO error */ - public void parseStyleAttribute(ApplContext ac, InputStream input, String id, + public void parseStyleAttribute(ApplContext ac, InputStream input, String id, URL url, int lineno) { lineno--; // why ?!?! if (Util.onDebug) { - System.err.println("StyleSheet.parseStyleAttribute(" + id + "," + System.err.println("StyleSheet.parseStyleAttribute(" + id + "," + url + "," + lineno + ")" ); } - + try { // if (cssFouffa == null) { cssFouffa = new CssFouffa(ac, input, url, lineno); @@ -348,7 +348,7 @@ } catch (InvalidParamException e) {} //ignore try { - selector.addId(new IdSelector(id.substring(1)));; + selector.addId(new IdSelector(id.substring(1)));; } catch (InvalidParamException e) { style.removeThisRule(); ac.getFrame().addError(new CssError(e)); @@ -356,12 +356,12 @@ cssFouffa.parseDeclarations(selector); } catch (IOException e) { Errors er = new Errors(); - er.addError(new org.w3c.css.parser.CssError(url.toString(), + er.addError(new org.w3c.css.parser.CssError(url.toString(), -1, e)); notifyErrors(er); } } - + /** * @param input the inputStream containing the style data * @param id the uniq id @@ -370,14 +370,14 @@ * @deprecated Replaced by parseStyleAttribute * @see #parseStyleAttribute(InputStream, URL, int) */ - public void parseStyleAttribute(ApplContext ac, String input, String id, + public void parseStyleAttribute(ApplContext ac, String input, String id, URL url, int lineno) { - parseStyleAttribute(ac, new ByteArrayInputStream(input.getBytes()), + parseStyleAttribute(ac, new ByteArrayInputStream(input.getBytes()), id, url, lineno); } - + public void setStyle(Class style) { cssFouffa.setStyle(style); } - + }
Received on Wednesday, 14 September 2005 15:16:31 UTC