trang

16:53:45.248 INFO  jd.cli.Main - Decompiling trang.jar
package com.thaiopensource.relaxng.translate;

import com.thaiopensource.relaxng.edit.SchemaCollection;
import com.thaiopensource.relaxng.input.InputFailedException;
import com.thaiopensource.relaxng.input.InputFormat;
import com.thaiopensource.relaxng.input.MultiInputFormat;
import com.thaiopensource.relaxng.output.LocalOutputDirectory;
import com.thaiopensource.relaxng.output.OutputDirectory;
import com.thaiopensource.relaxng.output.OutputFailedException;
import com.thaiopensource.relaxng.output.OutputFormat;
import com.thaiopensource.relaxng.translate.util.InvalidParamsException;
import com.thaiopensource.resolver.catalog.CatalogResolver;
import com.thaiopensource.util.Localizer;
import com.thaiopensource.util.OptionParser;
import com.thaiopensource.util.OptionParser.InvalidOptionException;
import com.thaiopensource.util.OptionParser.MissingArgumentException;
import com.thaiopensource.util.UriOrFile;
import com.thaiopensource.util.Version;
import com.thaiopensource.xml.sax.ErrorHandlerImpl;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.xml.sax.SAXException;

public class Driver
{
  private static final Localizer localizer = new Localizer(Driver.class);
  private String inputType;
  private String outputType;
  private final ErrorHandlerImpl eh;
  private static final String DEFAULT_OUTPUT_ENCODING = "UTF-8";
  private static final int DEFAULT_LINE_LENGTH = 72;
  private static final int DEFAULT_INDENT = 2;
  
  public Driver()
  {
    this(new ErrorHandlerImpl());
  }
  
  public Driver(ErrorHandlerImpl paramErrorHandlerImpl)
  {
    eh = paramErrorHandlerImpl;
  }
  
  public static void main(String[] paramArrayOfString)
  {
    System.exit(new Driver().run(paramArrayOfString));
  }
  
  public int run(String[] paramArrayOfString)
  {
    ArrayList localArrayList1 = new ArrayList();
    ArrayList localArrayList2 = new ArrayList();
    ArrayList localArrayList3 = new ArrayList();
    try
    {
      OptionParser localOptionParser = new OptionParser("C:I:O:i:o:", paramArrayOfString);
      try
      {
        while (localOptionParser.moveToNextOption()) {
          switch (localOptionParser.getOptionChar())
          {
          case 'C': 
            localArrayList3.add(UriOrFile.toUri(localOptionParser.getOptionArg()));
            break;
          case 'I': 
            inputType = localOptionParser.getOptionArg();
            break;
          case 'O': 
            outputType = localOptionParser.getOptionArg();
            break;
          case 'i': 
            localArrayList1.add(localOptionParser.getOptionArg());
            break;
          case 'o': 
            localArrayList2.add(localOptionParser.getOptionArg());
          }
        }
      }
      catch (OptionParser.InvalidOptionException localInvalidOptionException)
      {
        error(localizer.message("invalid_option", localOptionParser.getOptionCharString()));
        return 2;
      }
      catch (OptionParser.MissingArgumentException localMissingArgumentException)
      {
        error(localizer.message("option_missing_argument", localOptionParser.getOptionCharString()));
        return 2;
      }
      paramArrayOfString = localOptionParser.getRemainingArgs();
      if (paramArrayOfString.length < 2)
      {
        error(localizer.message("too_few_arguments"));
        eh.print(localizer.message("usage", Version.getVersion(Driver.class)));
        return 2;
      }
      if (inputType == null)
      {
        inputType = extension(paramArrayOfString[0]);
        if (inputType.length() > 0) {
          inputType = inputType.substring(1);
        }
      }
      InputFormat localInputFormat = Formats.createInputFormat(inputType);
      if (localInputFormat == null)
      {
        error(localizer.message("unrecognized_input_type", inputType));
        return 2;
      }
      String str = extension(paramArrayOfString[(paramArrayOfString.length - 1)]);
      if (outputType == null)
      {
        outputType = str;
        if (outputType.length() > 0) {
          outputType = outputType.substring(1);
        }
      }
      OutputFormat localOutputFormat = Formats.createOutputFormat(outputType);
      if (localOutputFormat == null)
      {
        error(localizer.message("unrecognized_output_type", outputType));
        return 2;
      }
      CatalogResolver localCatalogResolver;
      if (localArrayList3.isEmpty()) {
        localCatalogResolver = null;
      } else {
        try
        {
          localCatalogResolver = new CatalogResolver(localArrayList3);
        }
        catch (LinkageError localLinkageError)
        {
          eh.print(localizer.message("resolver_not_found"));
          return 2;
        }
      }
      String[] arrayOfString = (String[])localArrayList1.toArray(new String[localArrayList1.size()]);
      outputType = outputType.toLowerCase();
      SchemaCollection localSchemaCollection;
      if (paramArrayOfString.length > 2)
      {
        if (!(localInputFormat instanceof MultiInputFormat))
        {
          error(localizer.message("too_many_arguments"));
          return 2;
        }
        localObject = new String[paramArrayOfString.length - 1];
        for (int i = 0; i < localObject.length; i++) {
          localObject[i] = UriOrFile.toUri(paramArrayOfString[i]);
        }
        localSchemaCollection = ((MultiInputFormat)localInputFormat).load((String[])localObject, arrayOfString, outputType, eh, localCatalogResolver);
      }
      else
      {
        localSchemaCollection = localInputFormat.load(UriOrFile.toUri(paramArrayOfString[0]), arrayOfString, outputType, eh, localCatalogResolver);
      }
      if (str.length() == 0) {
        str = outputType;
      }
      Object localObject = new LocalOutputDirectory(localSchemaCollection.getMainUri(), new File(paramArrayOfString[(paramArrayOfString.length - 1)]), str, "UTF-8", 72, 2);
      
      localOutputFormat.output(localSchemaCollection, (OutputDirectory)localObject, (String[])localArrayList2.toArray(new String[localArrayList2.size()]), inputType.toLowerCase(), eh);
      return 0;
    }
    catch (OutputFailedException localOutputFailedException) {}catch (InputFailedException localInputFailedException) {}catch (InvalidParamsException localInvalidParamsException) {}catch (IOException localIOException)
    {
      eh.printException(localIOException);
    }
    catch (SAXException localSAXException)
    {
      eh.printException(localSAXException);
    }
    return 1;
  }
  
  private void error(String paramString)
  {
    eh.printException(new SAXException(paramString));
  }
  
  private static String extension(String paramString)
  {
    int i = paramString.lastIndexOf(".");
    if (i < 0) {
      return "";
    }
    return paramString.substring(i);
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.Driver
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate;

import com.thaiopensource.relaxng.input.InputFormat;
import com.thaiopensource.relaxng.input.dtd.DtdInputFormat;
import com.thaiopensource.relaxng.input.parse.compact.CompactParseInputFormat;
import com.thaiopensource.relaxng.input.parse.sax.SAXParseInputFormat;
import com.thaiopensource.relaxng.input.xml.XmlInputFormat;
import com.thaiopensource.relaxng.output.OutputFormat;
import com.thaiopensource.relaxng.output.dtd.DtdOutputFormat;
import com.thaiopensource.relaxng.output.rnc.RncOutputFormat;
import com.thaiopensource.relaxng.output.rng.RngOutputFormat;
import com.thaiopensource.relaxng.output.xsd.XsdOutputFormat;

public class Formats
{
  public static InputFormat createInputFormat(String paramString)
  {
    if (paramString.equalsIgnoreCase("rng")) {
      return new SAXParseInputFormat();
    }
    if (paramString.equalsIgnoreCase("rnc")) {
      return new CompactParseInputFormat();
    }
    if (paramString.equalsIgnoreCase("dtd")) {
      return new DtdInputFormat();
    }
    if (paramString.equalsIgnoreCase("xml")) {
      return new XmlInputFormat();
    }
    return null;
  }
  
  public static OutputFormat createOutputFormat(String paramString)
  {
    if (paramString.equalsIgnoreCase("dtd")) {
      return new DtdOutputFormat();
    }
    if (paramString.equalsIgnoreCase("rng")) {
      return new RngOutputFormat();
    }
    if (paramString.equalsIgnoreCase("xsd")) {
      return new XsdOutputFormat();
    }
    if (paramString.equalsIgnoreCase("rnc")) {
      return new RncOutputFormat();
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.Formats
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

import com.thaiopensource.relaxng.edit.SchemaCollection;
import com.thaiopensource.relaxng.input.InputFailedException;
import com.thaiopensource.relaxng.input.InputFormat;
import com.thaiopensource.relaxng.input.parse.compact.CompactParseInputFormat;
import com.thaiopensource.relaxng.output.LocalOutputDirectory;
import com.thaiopensource.relaxng.output.OutputDirectory;
import com.thaiopensource.relaxng.output.OutputFailedException;
import com.thaiopensource.relaxng.output.OutputFormat;
import com.thaiopensource.relaxng.output.rnc.RncOutputFormat;
import com.thaiopensource.relaxng.output.rng.RngOutputFormat;
import com.thaiopensource.relaxng.output.xsd.XsdOutputFormat;
import com.thaiopensource.relaxng.translate.util.InvalidParamsException;
import com.thaiopensource.resolver.xml.sax.SAXResolver;
import com.thaiopensource.util.UriOrFile;
import com.thaiopensource.xml.sax.ErrorHandlerImpl;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;

public class CompactTestDriver
{
  private final SAXResolver saxResolver = new SAXResolver();
  private ErrorHandler eh;
  private final InputFormat inputFormat = new CompactParseInputFormat();
  private OutputFormat outputFormat;
  private OutputFormat compactOutputFormat;
  private String toDir;
  private String toExt;
  private static final String XML_DIR = "xml";
  private static final String XSD_DIR = "xsd";
  private static final String COMPACT_DIR = "compact";
  private static final String OUT_DIR = "out";
  private static final String CORRECT_SCHEMA_NAME = "c";
  private static final String INCORRECT_SCHEMA_NAME = "i";
  private static final String COMPACT_EXTENSION = ".rnc";
  private static final String XML_EXTENSION = ".rng";
  private static final String XSD_EXTENSION = ".xsd";
  private static final String OUTPUT_ENCODING = "UTF-8";
  private static final int LINE_LENGTH = 72;
  private static final int INDENT = 2;
  
  public static void main(String[] paramArrayOfString)
    throws IOException
  {
    System.exit(new CompactTestDriver().doMain(paramArrayOfString));
  }
  
  private int doMain(String[] paramArrayOfString)
    throws IOException
  {
    eh = new ErrorHandlerImpl(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(paramArrayOfString[0]))));
    if (paramArrayOfString[2].equals("xsd"))
    {
      outputFormat = new XsdOutputFormat();
      toExt = ".xsd";
      toDir = "xsd";
    }
    else
    {
      outputFormat = new RngOutputFormat();
      compactOutputFormat = new RncOutputFormat();
      toExt = ".rng";
      toDir = "xml";
    }
    return runTestSuite(new File(paramArrayOfString[1])) ? 0 : 1;
  }
  
  private boolean runTestSuite(File paramFile)
    throws IOException
  {
    boolean bool = true;
    String[] arrayOfString = paramFile.list();
    for (int i = 0; i < arrayOfString.length; i++)
    {
      File localFile = new File(paramFile, arrayOfString[i]);
      if ((localFile.isDirectory()) && 
        (!runTestCase(localFile))) {
        bool = false;
      }
    }
    return bool;
  }
  
  private boolean runTestCase(File paramFile)
    throws IOException
  {
    File localFile1 = new File(paramFile, toDir);
    File localFile2 = new File(paramFile, "compact");
    File localFile3 = new File(paramFile, "out");
    File localFile4 = new File(localFile2, "c.rnc");
    File localFile5 = new File(localFile2, "i.rnc");
    boolean bool = true;
    File localFile6;
    if (localFile4.exists())
    {
      localFile6 = new File(localFile3, "c" + toExt);
      if ((!run(localFile4, localFile6, outputFormat, toExt)) || (!compareDir(localFile1, localFile3)))
      {
        bool = false;
        failed(localFile4);
      }
      else if (toExt.equals(".rng"))
      {
        cleanDir(localFile3);
        File localFile7 = new File(localFile3, "c.rnc");
        if ((!run(localFile4, localFile7, compactOutputFormat, ".rnc")) || (!run(localFile7, localFile6, outputFormat, toExt)) || (!compareDir(localFile1, localFile3)))
        {
          bool = false;
          failed(localFile4);
        }
      }
    }
    if (localFile5.exists())
    {
      localFile6 = new File(localFile3, "i" + toExt);
      if (run(localFile5, localFile6, outputFormat, toExt))
      {
        bool = false;
        failed(localFile5);
      }
    }
    return bool;
  }
  
  private boolean compareDir(File paramFile1, File paramFile2)
  {
    try
    {
      String[] arrayOfString = paramFile1.list();
      for (int i = 0; i < arrayOfString.length; i++)
      {
        File localFile = new File(paramFile1, arrayOfString[i]);
        if (localFile.isDirectory())
        {
          if (!compareDir(localFile, new File(paramFile2, arrayOfString[i]))) {
            return false;
          }
        }
        else if (!Compare.compare(localFile, new File(paramFile2, arrayOfString[i]), saxResolver)) {
          return false;
        }
      }
      return true;
    }
    catch (SAXException localSAXException) {}catch (IOException localIOException) {}
    return false;
  }
  
  private void cleanDir(File paramFile)
  {
    String[] arrayOfString = paramFile.list();
    for (int i = 0; i < arrayOfString.length; i++)
    {
      File localFile = new File(paramFile, arrayOfString[i]);
      if (localFile.isDirectory()) {
        cleanDir(localFile);
      }
      localFile.delete();
    }
  }
  
  private static void failed(File paramFile)
  {
    System.err.println(paramFile.toString() + " failed");
  }
  
  private boolean run(File paramFile1, File paramFile2, OutputFormat paramOutputFormat, String paramString)
    throws IOException
  {
    try
    {
      SchemaCollection localSchemaCollection = inputFormat.load(UriOrFile.fileToUri(paramFile1), new String[0], null, eh, saxResolver.getResolver());
      LocalOutputDirectory localLocalOutputDirectory = new LocalOutputDirectory(localSchemaCollection.getMainUri(), paramFile2, paramString, null, 72, 2);
      localLocalOutputDirectory.setEncoding("UTF-8");
      paramOutputFormat.output(localSchemaCollection, localLocalOutputDirectory, new String[0], null, eh);
      return true;
    }
    catch (SAXException localSAXException)
    {
      return false;
    }
    catch (InvalidParamsException localInvalidParamsException)
    {
      return false;
    }
    catch (InputFailedException localInputFailedException)
    {
      return false;
    }
    catch (OutputFailedException localOutputFailedException) {}
    return false;
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.CompactTestDriver
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

class Compare$1 {}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.Compare.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

class Compare$Attribute
  extends Compare.Event
{
  private final String qName;
  private final String value;
  
  Compare$Attribute(String paramString1, String paramString2)
  {
    qName = paramString1;
    value = paramString2;
  }
  
  String getQName()
  {
    return qName;
  }
  
  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof Attribute)) {
      return false;
    }
    Attribute localAttribute = (Attribute)paramObject;
    return (qName.equals(qName)) && (value.equals(value));
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.Compare.Attribute
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

class Compare$Comment
  extends Compare.Event
{
  private final String value;
  
  Compare$Comment(String paramString)
  {
    value = paramString;
  }
  
  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof Comment)) {
      return false;
    }
    return value.equals(value);
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.Compare.Comment
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

import com.thaiopensource.xml.sax.AbstractLexicalHandler;
import org.xml.sax.SAXException;

class Compare$CommentSaver
  extends AbstractLexicalHandler
{
  private final Compare.Saver saver;
  
  Compare$CommentSaver(Compare.Saver paramSaver)
  {
    saver = paramSaver;
  }
  
  public void comment(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    throws SAXException
  {
    saver.comment(new String(paramArrayOfChar, paramInt1, paramInt2));
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.Compare.CommentSaver
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

class Compare$EndElement
  extends Compare.Event
{
  public boolean equals(Object paramObject)
  {
    return paramObject instanceof EndElement;
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.Compare.EndElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

abstract class Compare$Event
{
  boolean merge(char[] paramArrayOfChar, int paramInt1, int paramInt2)
  {
    return false;
  }
  
  boolean isWhitespace()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.Compare.Event
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

import java.util.Comparator;

class Compare$Saver$1
  implements Comparator<Compare.Attribute>
{
  Compare$Saver$1(Compare.Saver paramSaver) {}
  
  public int compare(Compare.Attribute paramAttribute1, Compare.Attribute paramAttribute2)
  {
    return paramAttribute1.getQName().compareTo(paramAttribute2.getQName());
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.Compare.Saver.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Vector;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;

class Compare$Saver
  extends DefaultHandler
{
  private final List<Compare.Event> eventList = new Vector();
  private final List<Compare.Attribute> attributeList = new Vector();
  
  List<Compare.Event> getEventList()
  {
    return eventList;
  }
  
  void flushWhitespace(boolean paramBoolean)
  {
    int i = eventList.size();
    if (i == 0) {
      return;
    }
    if (!((Compare.Event)eventList.get(i - 1)).isWhitespace()) {
      return;
    }
    if ((paramBoolean) && (i > 1) && ((eventList.get(i - 2) instanceof Compare.StartElement))) {
      return;
    }
    eventList.remove(i - 1);
  }
  
  public void startElement(String paramString1, String paramString2, String paramString3, Attributes paramAttributes)
  {
    flushWhitespace(false);
    eventList.add(new Compare.StartElement(paramString3));
    int i = 0;
    for (int j = paramAttributes.getLength(); i < j; i++) {
      attributeList.add(new Compare.Attribute(paramAttributes.getQName(i), paramAttributes.getValue(i)));
    }
    Collections.sort(attributeList, new Comparator()
    {
      public int compare(Compare.Attribute paramAnonymousAttribute1, Compare.Attribute paramAnonymousAttribute2)
      {
        return paramAnonymousAttribute1.getQName().compareTo(paramAnonymousAttribute2.getQName());
      }
    });
    eventList.addAll(attributeList);
    attributeList.clear();
  }
  
  public void endElement(String paramString1, String paramString2, String paramString3)
  {
    flushWhitespace(true);
    eventList.add(new Compare.EndElement(null));
  }
  
  public void characters(char[] paramArrayOfChar, int paramInt1, int paramInt2)
  {
    int i = eventList.size();
    if ((i == 0) || (!((Compare.Event)eventList.get(i - 1)).merge(paramArrayOfChar, paramInt1, paramInt2))) {
      eventList.add(new Compare.Text(new String(paramArrayOfChar, paramInt1, paramInt2)));
    }
  }
  
  public void ignorableWhitespace(char[] paramArrayOfChar, int paramInt1, int paramInt2)
  {
    characters(paramArrayOfChar, paramInt1, paramInt2);
  }
  
  public void endDocument()
  {
    flushWhitespace(false);
  }
  
  void comment(String paramString)
  {
    flushWhitespace(false);
    eventList.add(new Compare.Comment(paramString));
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.Compare.Saver
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

class Compare$StartElement
  extends Compare.Event
{
  private final String qName;
  
  Compare$StartElement(String paramString)
  {
    qName = paramString;
  }
  
  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof StartElement)) {
      return false;
    }
    return qName.equals(qName);
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.Compare.StartElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

class Compare$Text
  extends Compare.Event
{
  private String value;
  
  Compare$Text(String paramString)
  {
    value = paramString;
  }
  
  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof Text)) {
      return false;
    }
    return value.equals(value);
  }
  
  boolean isWhitespace()
  {
    int i = 0;
    for (int j = value.length(); i < j; i++) {
      switch (value.charAt(i))
      {
      case '\t': 
      case '\n': 
      case '\r': 
      case ' ': 
        break;
      default: 
        return false;
      }
    }
    return true;
  }
  
  boolean merge(char[] paramArrayOfChar, int paramInt1, int paramInt2)
  {
    StringBuffer localStringBuffer = new StringBuffer(value);
    localStringBuffer.append(paramArrayOfChar, paramInt1, paramInt2);
    value = localStringBuffer.toString();
    return true;
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.Compare.Text
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.relaxng.translate.test;

import com.thaiopensource.resolver.xml.sax.SAXResolver;
import com.thaiopensource.util.UriOrFile;
import com.thaiopensource.xml.sax.AbstractLexicalHandler;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Vector;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;

public class Compare
{
  public static boolean compare(File paramFile1, File paramFile2, SAXResolver paramSAXResolver)
    throws SAXException, IOException
  {
    return load(paramSAXResolver, paramFile1).equals(load(paramSAXResolver, paramFile2));
  }
  
  private static List<Event> load(SAXResolver paramSAXResolver, File paramFile)
    throws SAXException, IOException
  {
    InputSource localInputSource = new InputSource(UriOrFile.fileToUri(paramFile));
    Saver localSaver = new Saver();
    XMLReader localXMLReader = paramSAXResolver.createXMLReader();
    try
    {
      localXMLReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
    }
    catch (SAXNotRecognizedException localSAXNotRecognizedException1)
    {
      throw new SAXException("support for namespaces-prefixes feature required");
    }
    catch (SAXNotSupportedException localSAXNotSupportedException1)
    {
      throw new SAXException("support for namespaces-prefixes feature required");
    }
    localXMLReader.setContentHandler(localSaver);
    try
    {
      localXMLReader.setProperty("http://xml.org/sax/properties/lexical-handler", new CommentSaver(localSaver));
    }
    catch (SAXNotRecognizedException localSAXNotRecognizedException2) {}catch (SAXNotSupportedException localSAXNotSupportedException2) {}
    localXMLReader.parse(localInputSource);
    return localSaver.getEventList();
  }
  
  static abstract class Event
  {
    boolean merge(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    {
      return false;
    }
    
    boolean isWhitespace()
    {
      return false;
    }
  }
  
  static class StartElement
    extends Compare.Event
  {
    private final String qName;
    
    StartElement(String paramString)
    {
      qName = paramString;
    }
    
    public boolean equals(Object paramObject)
    {
      if (!(paramObject instanceof StartElement)) {
        return false;
      }
      return qName.equals(qName);
    }
  }
  
  static class Attribute
    extends Compare.Event
  {
    private final String qName;
    private final String value;
    
    Attribute(String paramString1, String paramString2)
    {
      qName = paramString1;
      value = paramString2;
    }
    
    String getQName()
    {
      return qName;
    }
    
    public boolean equals(Object paramObject)
    {
      if (!(paramObject instanceof Attribute)) {
        return false;
      }
      Attribute localAttribute = (Attribute)paramObject;
      return (qName.equals(qName)) && (value.equals(value));
    }
  }
  
  private static class EndElement
    extends Compare.Event
  {
    public boolean equals(Object paramObject)
    {
      return paramObject instanceof EndElement;
    }
  }
  
  static class Comment
    extends Compare.Event
  {
    private final String value;
    
    Comment(String paramString)
    {
      value = paramString;
    }
    
    public boolean equals(Object paramObject)
    {
      if (!(paramObject instanceof Comment)) {
        return false;
      }
      return value.equals(value);
    }
  }
  
  static class Text
    extends Compare.Event
  {
    private String value;
    
    Text(String paramString)
    {
      value = paramString;
    }
    
    public boolean equals(Object paramObject)
    {
      if (!(paramObject instanceof Text)) {
        return false;
      }
      return value.equals(value);
    }
    
    boolean isWhitespace()
    {
      int i = 0;
      for (int j = value.length(); i < j; i++) {
        switch (value.charAt(i))
        {
        case '\t': 
        case '\n': 
        case '\r': 
        case ' ': 
          break;
        default: 
          return false;
        }
      }
      return true;
    }
    
    boolean merge(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    {
      StringBuffer localStringBuffer = new StringBuffer(value);
      localStringBuffer.append(paramArrayOfChar, paramInt1, paramInt2);
      value = localStringBuffer.toString();
      return true;
    }
  }
  
  static class Saver
    extends DefaultHandler
  {
    private final List<Compare.Event> eventList = new Vector();
    private final List<Compare.Attribute> attributeList = new Vector();
    
    List<Compare.Event> getEventList()
    {
      return eventList;
    }
    
    void flushWhitespace(boolean paramBoolean)
    {
      int i = eventList.size();
      if (i == 0) {
        return;
      }
      if (!((Compare.Event)eventList.get(i - 1)).isWhitespace()) {
        return;
      }
      if ((paramBoolean) && (i > 1) && ((eventList.get(i - 2) instanceof Compare.StartElement))) {
        return;
      }
      eventList.remove(i - 1);
    }
    
    public void startElement(String paramString1, String paramString2, String paramString3, Attributes paramAttributes)
    {
      flushWhitespace(false);
      eventList.add(new Compare.StartElement(paramString3));
      int i = 0;
      for (int j = paramAttributes.getLength(); i < j; i++) {
        attributeList.add(new Compare.Attribute(paramAttributes.getQName(i), paramAttributes.getValue(i)));
      }
      Collections.sort(attributeList, new Comparator()
      {
        public int compare(Compare.Attribute paramAnonymousAttribute1, Compare.Attribute paramAnonymousAttribute2)
        {
          return paramAnonymousAttribute1.getQName().compareTo(paramAnonymousAttribute2.getQName());
        }
      });
      eventList.addAll(attributeList);
      attributeList.clear();
    }
    
    public void endElement(String paramString1, String paramString2, String paramString3)
    {
      flushWhitespace(true);
      eventList.add(new Compare.EndElement(null));
    }
    
    public void characters(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    {
      int i = eventList.size();
      if ((i == 0) || (!((Compare.Event)eventList.get(i - 1)).merge(paramArrayOfChar, paramInt1, paramInt2))) {
        eventList.add(new Compare.Text(new String(paramArrayOfChar, paramInt1, paramInt2)));
      }
    }
    
    public void ignorableWhitespace(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    {
      characters(paramArrayOfChar, paramInt1, paramInt2);
    }
    
    public void endDocument()
    {
      flushWhitespace(false);
    }
    
    void comment(String paramString)
    {
      flushWhitespace(false);
      eventList.add(new Compare.Comment(paramString));
    }
  }
  
  static class CommentSaver
    extends AbstractLexicalHandler
  {
    private final Compare.Saver saver;
    
    CommentSaver(Compare.Saver paramSaver)
    {
      saver = paramSaver;
    }
    
    public void comment(char[] paramArrayOfChar, int paramInt1, int paramInt2)
      throws SAXException
    {
      saver.comment(new String(paramArrayOfChar, paramInt1, paramInt2));
    }
  }
  
  public static void main(String[] paramArrayOfString)
    throws SAXException, IOException
  {
    System.err.println(compare(new File(paramArrayOfString[0]), new File(paramArrayOfString[1]), new SAXResolver()));
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.relaxng.translate.test.Compare
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.util;

public class Equal
{
  public static boolean equal(Object paramObject1, Object paramObject2)
  {
    return paramObject1 == null ? false : paramObject2 == null ? true : paramObject1.equals(paramObject2);
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.util.Equal
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.util;

import java.text.MessageFormat;
import java.util.ResourceBundle;

public class Localizer
{
  private final Class<?> cls;
  private ResourceBundle bundle;
  
  public Localizer(Class<?> paramClass)
  {
    cls = paramClass;
  }
  
  public String message(String paramString)
  {
    return MessageFormat.format(getBundle().getString(paramString), new Object[0]);
  }
  
  public String message(String paramString, Object paramObject)
  {
    return MessageFormat.format(getBundle().getString(paramString), new Object[] { paramObject });
  }
  
  public String message(String paramString, Object paramObject1, Object paramObject2)
  {
    return MessageFormat.format(getBundle().getString(paramString), new Object[] { paramObject1, paramObject2 });
  }
  
  public String message(String paramString, Object[] paramArrayOfObject)
  {
    return MessageFormat.format(getBundle().getString(paramString), paramArrayOfObject);
  }
  
  private ResourceBundle getBundle()
  {
    if (bundle == null)
    {
      String str = cls.getName();
      int i = str.lastIndexOf('.');
      if (i > 0) {
        str = str.substring(0, i + 1);
      } else {
        str = "";
      }
      bundle = ResourceBundle.getBundle(str + "resources.Messages");
    }
    return bundle;
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.util.Localizer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.util;

public class OptionParser$InvalidOptionException
  extends Exception
{}

/* Location:
 * Qualified Name:     com.thaiopensource.util.OptionParser.InvalidOptionException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.util;

public class OptionParser$MissingArgumentException
  extends Exception
{}

/* Location:
 * Qualified Name:     com.thaiopensource.util.OptionParser.MissingArgumentException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.util;

import java.io.PrintStream;

public class OptionParser
{
  private final String optionSpec;
  private char optionChar = '\000';
  private String optionArg = null;
  private int argIndex = 0;
  private int currentOptionIndex = 0;
  private final String[] args;
  private static final char OPTION_CHAR = '-';
  
  public OptionParser(String paramString, String[] paramArrayOfString)
  {
    optionSpec = paramString;
    args = new String[paramArrayOfString.length];
    System.arraycopy(paramArrayOfString, 0, args, 0, paramArrayOfString.length);
  }
  
  public char getOptionChar()
  {
    return optionChar;
  }
  
  public String getOptionCharString()
  {
    return new String(new char[] { optionChar });
  }
  
  public String getOptionArg()
  {
    return optionArg;
  }
  
  public boolean moveToNextOption()
    throws OptionParser.InvalidOptionException, OptionParser.MissingArgumentException
  {
    if ((currentOptionIndex > 0) && (currentOptionIndex == args[argIndex].length()))
    {
      currentOptionIndex = 0;
      argIndex += 1;
    }
    if (currentOptionIndex == 0)
    {
      if (argIndex >= args.length) {
        return false;
      }
      String str = args[argIndex];
      if ((str.length() < 2) || (str.charAt(0) != '-')) {
        return false;
      }
      if ((str.length() == 2) && (str.charAt(1) == '-'))
      {
        argIndex += 1;
        return false;
      }
      currentOptionIndex = 1;
    }
    optionChar = args[argIndex].charAt(currentOptionIndex++);
    optionArg = null;
    int i = optionSpec.indexOf(optionChar);
    if ((i < 0) || ((optionChar == ':') && (i > 0))) {
      throw new InvalidOptionException();
    }
    if ((i + 1 < optionSpec.length()) && (optionSpec.charAt(i + 1) == ':')) {
      if (currentOptionIndex < args[argIndex].length())
      {
        optionArg = args[argIndex].substring(currentOptionIndex);
        currentOptionIndex = 0;
        argIndex += 1;
      }
      else if (argIndex + 1 < args.length)
      {
        optionArg = args[(++argIndex)];
        argIndex += 1;
        currentOptionIndex = 0;
      }
      else
      {
        throw new MissingArgumentException();
      }
    }
    return true;
  }
  
  public String[] getRemainingArgs()
  {
    String[] arrayOfString = new String[args.length - argIndex];
    System.arraycopy(args, argIndex, arrayOfString, 0, arrayOfString.length);
    return arrayOfString;
  }
  
  public static void main(String[] paramArrayOfString)
  {
    String str1 = paramArrayOfString[0];
    String[] arrayOfString = new String[paramArrayOfString.length - 1];
    System.arraycopy(paramArrayOfString, 1, arrayOfString, 0, arrayOfString.length);
    paramArrayOfString = arrayOfString;
    OptionParser localOptionParser = new OptionParser(str1, paramArrayOfString);
    try
    {
      while (localOptionParser.moveToNextOption())
      {
        System.err.print("option " + localOptionParser.getOptionChar());
        String str2 = localOptionParser.getOptionArg();
        if (str2 == null) {
          System.err.println(" (no argument)");
        } else {
          System.err.println(" arg=" + str2);
        }
      }
      paramArrayOfString = localOptionParser.getRemainingArgs();
      for (int i = 0; i < paramArrayOfString.length; i++) {
        System.err.println("arg=" + paramArrayOfString[i]);
      }
    }
    catch (MissingArgumentException localMissingArgumentException)
    {
      System.err.println("missing argument for option " + localOptionParser.getOptionChar());
    }
    catch (InvalidOptionException localInvalidOptionException)
    {
      System.err.println("invalid option " + localOptionParser.getOptionChar());
    }
  }
  
  public static class InvalidOptionException
    extends Exception
  {}
  
  public static class MissingArgumentException
    extends Exception
  {}
}

/* Location:
 * Qualified Name:     com.thaiopensource.util.OptionParser
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.util;

public class PropertyId<T>
{
  private final String name;
  private final Class<T> valueClass;
  
  public static <T> PropertyId<T> newInstance(String paramString, Class<T> paramClass)
  {
    return new PropertyId(paramString, paramClass);
  }
  
  protected PropertyId(String paramString, Class<T> paramClass)
  {
    if ((paramString == null) || (paramClass == null)) {
      throw new NullPointerException();
    }
    name = paramString;
    valueClass = paramClass;
  }
  
  public Class<T> getValueClass()
  {
    return valueClass;
  }
  
  public final int hashCode()
  {
    return super.hashCode();
  }
  
  public final boolean equals(Object paramObject)
  {
    return super.equals(paramObject);
  }
  
  public String toString()
  {
    return name;
  }
  
  /**
   * @deprecated
   */
  public T get(PropertyMap paramPropertyMap)
  {
    return (T)paramPropertyMap.get(this);
  }
  
  /**
   * @deprecated
   */
  public T put(PropertyMapBuilder paramPropertyMapBuilder, T paramT)
  {
    return (T)paramPropertyMapBuilder.put(this, paramT);
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.util.PropertyId
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.util;

class PropertyMap$1
  implements PropertyMap
{
  public <T> T get(PropertyId<T> paramPropertyId)
  {
    return null;
  }
  
  public boolean contains(PropertyId<?> paramPropertyId)
  {
    return false;
  }
  
  public int size()
  {
    return 0;
  }
  
  public PropertyId<?> getKey(int paramInt)
  {
    throw new IndexOutOfBoundsException();
  }
}

/* Location:
 * Qualified Name:     com.thaiopensource.util.PropertyMap.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package com.thaiopensource.util;

public abstract interface PropertyMap
{
  public static final PropertyMap EMPTY = new PropertyMap()
  {
    public <T> T get(PropertyId<T> paramAnonymousPropertyId)
    {
      return null;
    }
    
    public boolean contains(PropertyId<?> paramAnonymousPropertyId)
    {
      return false;
    }
    
    public int size()
    {
      return 0;
    }
    
    public PropertyId<?> getKey(int paramAnonymousInt)
    {
      throw new IndexOutOfBoundsException();
    }
  };
  
  public abstract <T> T get(PropertyId<T> paramPropertyId);
  
  public abstract boolean contains(PropertyId<?> paramPropertyId);
  
  public abstract int size();
  
  public abstract PropertyId<?> getKey(int paramInt);
}

/* L
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd