Author: ieb
Date: Tue Oct  7 08:00:27 2008
New Revision: 702504

URL: http://svn.apache.org/viewvc?rev=702504&view=rev
Log:
         SHINDIG-562
Cleaned up javadoc and imports on the xsd validator tests.

Modified:
    
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/XSDValidator.java
    
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/XSDValidatorTest.java

Modified: 
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/XSDValidator.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/XSDValidator.java?rev=702504&r1=702503&r2=702504&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/XSDValidator.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/XSDValidator.java
 Tue Oct  7 08:00:27 2008
@@ -17,36 +17,35 @@
  */
 package org.apache.shindig.social.opensocial.util;
 
-import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
 
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
 
 /**
- *
+ * Validator utility for testing.
  */
 public class XSDValidator {
-  private static final String JAXP_SCHEMA_LANGUAGE = 
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";;
-
+  /**
+   * The schema langiage being used.
+   */
   private static final String W3C_XML_SCHEMA = 
"http://www.w3.org/2001/XMLSchema";;
 
+  /**
+   * Validate a xml string against a supplied schema.
+   *
+   * @param xml the xml presented as a string
+   * @param schema an input stream containing the xsd
+   * @return a list of errors or a 0 lenght string if none.
+   */
   public static String validate(String xml, InputStream schema) {
     try {
       return validate(new ByteArrayInputStream(xml.getBytes("UTF-8")), schema);
@@ -54,17 +53,24 @@
       return e.getMessage();
     }
   }
+
+  /**
+   * Validate a xml input stream against a supplied schema.
+   * @param xml a stream containing the xml
+   * @param schema a stream containing the schema
+   * @return a list of errors or warnings, a 0 lenght string if none.
+   */
   public static String validate(InputStream xml, InputStream schema) {
-  
+
     SAXParserFactory factory = SAXParserFactory.newInstance();
     factory.setNamespaceAware(true);
     factory.setValidating(true);
     final StringBuilder errors = new StringBuilder();
     try {
-      
+
       SchemaFactory schemaFactory = SchemaFactory.newInstance(W3C_XML_SCHEMA);
       Schema s = schemaFactory.newSchema(new StreamSource(schema));
-      System.err.println("Schema is "+s);
+      System.err.println("Schema is " + s);
       Validator validator = s.newValidator();
       validator.validate(new StreamSource(xml));
     } catch (IOException e) {

Modified: 
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/XSDValidatorTest.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/XSDValidatorTest.java?rev=702504&r1=702503&r2=702504&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/XSDValidatorTest.java
 (original)
+++ 
incubator/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/XSDValidatorTest.java
 Tue Oct  7 08:00:27 2008
@@ -22,7 +22,7 @@
 import org.apache.shindig.common.xml.XmlException;
 
 /**
- *
+ * Tests the XSDValidator
  */
 public class XSDValidatorTest extends TestCase {
 


Reply via email to