Package mf.org.apache.xml.resolver.tools

Examples of mf.org.apache.xml.resolver.tools.ResolvingXMLReader


    if (xmlfile == null) {
      System.out.println("Usage: org.apache.xml.resolver.apps.xread [opts] xmlfile");
      System.exit(1);
    }

    ResolvingXMLReader reader = new ResolvingXMLReader();

    try {
      reader.setFeature("http://xml.org/sax/features/namespaces", nsAware);
      reader.setFeature("http://xml.org/sax/features/validation", validating);
      if (useSchema) {
  reader.setFeature("http://apache.org/xml/features/validation/schema", true);
      }
    } catch (SAXException e) {
      // nop;
    }

    Catalog catalog = reader.getCatalog();

    for (int count = 0; count < catalogFiles.size(); count++) {
      String file = (String) catalogFiles.elementAt(count);
      catalog.parseCatalog(file);
    }

    XParseError xpe = new XParseError(showErrors, showWarnings);
    xpe.setMaxMessages(maxErrs);
    reader.setErrorHandler(xpe);

    String parseType = validating ? "validating" : "well-formed";
    String nsType = nsAware ? "namespace-aware" : "namespace-ignorant";
    if (maxErrs > 0) {
      System.out.println("Attempting "
       + parseType
       + ", "
       + nsType
       + " parse");
    }

    Date startTime = new Date();

    try {
      reader.parse(xmlfile);
    } catch (SAXException sx) {
      System.out.println("SAX Exception: " + sx);
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of mf.org.apache.xml.resolver.tools.ResolvingXMLReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.