W3C home > Mailing lists > Public > www-validator-cvs@w3.org > July 2007

2002/css-validator/org/w3c/css/util/xml XMLCatalog.java,1.4,1.5

From: Julien Grand-Mourcel via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 13 Jul 2007 13:32:23 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1I9LFv-0003Y3-Oc@lionel-hutz.w3.org>

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

Modified Files:
	XMLCatalog.java 
Log Message:
Adding patch to use Velocity template engine.
And some other changes...

Index: XMLCatalog.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/util/xml/XMLCatalog.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- XMLCatalog.java	14 Sep 2005 15:15:32 -0000	1.4
+++ XMLCatalog.java	13 Jul 2007 13:32:21 -0000	1.5
@@ -24,25 +24,25 @@
 
 /**
  * @version $Revision$
- * @author  Philippe Le Hegaret
+ * @author Philippe Le Hegaret
  */
 public class XMLCatalog extends Utf8Properties implements ContentHandler {
 
-    URL baseURI;
+	URL baseURI;
 
-    /**
-     * Creates a new XMLCatalog
-     */
-    public XMLCatalog() {
-	try {
-	    baseURI = XMLCatalog.class.getResource("catalog.xml");
-	    parse(baseURI.toString());
-	} catch (Exception e) {
-	    System.err.println("org.w3c.css.css.XMLStyleSheetHandler: "
-			       + "couldn't load catalog.xml");
-			System.err.println("  " + e.toString());
+	/**
+	 * Creates a new XMLCatalog
+	 */
+	public XMLCatalog() {
+		try {
+			baseURI = XMLCatalog.class.getResource("catalog.xml");
+			parse("\"" + baseURI.toString() + "\"");
+		} catch (Exception e) {
+			System.err.println("org.w3c.css.css.XMLStyleSheetHandler: "
+					+ "couldn't load catalog.xml");
+			System.err.println("  " + e.getMessage());
+		}
 	}
-    }
 
 	public void setDocumentLocator(Locator locator) {
 	}
@@ -54,7 +54,7 @@
 	}
 
 	public void startPrefixMapping(String prefix, String uri)
-        throws SAXException {
+			throws SAXException {
 	}
 
 	public void endPrefixMapping(String prefix) throws SAXException {
@@ -62,28 +62,28 @@
 
 	public void startElement(String namespaceURI, String localName,
 			String qName, Attributes atts) throws SAXException {
-	if ("system".equals(qName)) {
-	    String systemId = atts.getValue("systemId");
-	    String uri = atts.getValue("uri");
-	    if ((systemId != null) && (uri != null)) {
-		try {
-		    setProperty(systemId, (new URL(baseURI, uri)).toString());
-		} catch (Exception e) {
-		    e.printStackTrace();
-		}
-	    }
-	} else if ("public".equals(qName)) {
-	    String publicId = atts.getValue("publicId");
-	    String uri = atts.getValue("uri");
-	    if ((publicId != null) && (uri != null)) {
-		try {
-		    setProperty(publicId, (new URL(baseURI, uri)).toString());
-		} catch (Exception e) {
-		    e.printStackTrace();
+		if ("system".equals(qName)) {
+			String systemId = atts.getValue("systemId");
+			String uri = atts.getValue("uri");
+			if ((systemId != null) && (uri != null)) {
+				try {
+					setProperty(systemId, (new URL(baseURI, uri)).toString());
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+			}
+		} else if ("public".equals(qName)) {
+			String publicId = atts.getValue("publicId");
+			String uri = atts.getValue("uri");
+			if ((publicId != null) && (uri != null)) {
+				try {
+					setProperty(publicId, (new URL(baseURI, uri)).toString());
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+			}
 		}
-	    }
 	}
-    }
 
 	public void endElement(String namespaceURI, String localName, String qName)
 			throws SAXException {
@@ -104,21 +104,21 @@
 	public void skippedEntity(String name) throws SAXException {
 	}
 
-    void parse(String urlString) throws Exception {
-	org.xml.sax.XMLReader xmlParser = new org.apache.xerces.parsers.SAXParser();
+	void parse(String urlString) throws Exception {
+		org.xml.sax.XMLReader xmlParser = new org.apache.xerces.parsers.SAXParser();
 
-	try {
+		try {
 			xmlParser.setFeature(
 					"http://xml.org/sax/features/namespace-prefixes", true);
 
 			xmlParser.setFeature("http://xml.org/sax/features/validation",
 					false);
-	} catch (Exception ex) {
-	    ex.printStackTrace();
+		} catch (Exception ex) {
+			ex.printStackTrace();
+		}
+		xmlParser.setContentHandler(this);
+		InputSource source = new InputSource();
+		source.setSystemId(urlString);
+		xmlParser.parse(source);
 	}
-	xmlParser.setContentHandler(this);
-	InputSource source = new InputSource();
-	source.setSystemId(urlString);
-	xmlParser.parse(source);
-    }
 }
Received on Friday, 13 July 2007 13:32:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:54:58 GMT