2002/css-validator/org/w3c/css/css TagSoupStyleSheetHandler.java,1.2,1.3

Update of /sources/public/2002/css-validator/org/w3c/css/css
In directory hutz:/tmp/cvs-serv13694/org/w3c/css/css

Modified Files:
	TagSoupStyleSheetHandler.java 
Log Message:
Adding a new method to parse HTML giving the text instead of the URL.
Testing if it is a CSS or an HTML file when file upload (using the extension) or direct input (looking for <style>)

Index: TagSoupStyleSheetHandler.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/TagSoupStyleSheetHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- TagSoupStyleSheetHandler.java	24 Apr 2007 11:57:39 -0000	1.2
+++ TagSoupStyleSheetHandler.java	10 Aug 2007 14:52:37 -0000	1.3
@@ -495,6 +495,28 @@
 	    return new InputSource(new URL(baseURI, systemId).toString());
 	}
     }
+    
+    public void parse(InputStream in, String fileName) throws IOException, SAXException {
+    	InputSource source = new InputSource(in);
+    	org.xml.sax.XMLReader xmlParser = new org.ccil.cowan.tagsoup.Parser();
+    	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/validation", false);
+    	} catch (Exception ex) {
+    	    ex.printStackTrace();
+    	}
+    	xmlParser.setContentHandler(this);
+    	baseURI = new URL(fileName);
+    	documentURI = new URL(fileName);
+    	source.setSystemId(fileName);
+    	try {
+			xmlParser.parse(source);
+    	} finally {
+			in.close();
+    	}
+    }
 
     void parse(URL url) throws Exception {
 	InputSource source = new InputSource();

Received on Friday, 10 August 2007 14:52:46 UTC