Package org.apache.ws.jaxme.xs.parser

Examples of org.apache.ws.jaxme.xs.parser.XsSAXParser


      throws SAXException, IOException, ParserConfigurationException {
    XSContext data = getData();
    try {
      XsObjectFactory factory = data.getXsObjectFactory();
      XsESchema mySchema = factory.newXsESchema();
      XsSAXParser xsSAXParser = factory.newXsSAXParser(mySchema);
      addSyntaxSchema(mySchema);
      try {
        data.setCurrentContentHandler(xsSAXParser);
        XMLReader xr = factory.newXMLReader(isValidating());
        xr.setContentHandler(xsSAXParser);
        EntityResolver entityResolver = xr.getEntityResolver();
        if (entityResolver != null) {
          InputSource iSource = entityResolver.resolveEntity(pSource.getPublicId(), pSource.getSystemId());
          if (iSource != null) {
            pSource = iSource;
          }
        }
        xr.parse(pSource);
        return (XsESchema) xsSAXParser.getBean();
      } finally {
        removeSyntaxSchema();
      }
    } finally {
      data.setCurrentContentHandler(null);
View Full Code Here


  public XsESchema parseSyntax(InputSource pSource) throws ParserConfigurationException, SAXException, IOException {
    XSContext context = getContext();
    parser.set(this);
    try {
      XsObjectFactory factory = context.getXsObjectFactory();
      XsSAXParser xsSAXParser = factory.newXsSAXParser();
      context.setCurrentContentHandler(xsSAXParser);
      XMLReader xr = factory.newXMLReader(isValidating());
      xr.setContentHandler(xsSAXParser);
      xr.parse(pSource);
      return (XsESchema) xsSAXParser.getBean();
    } finally {
      context.setCurrentContentHandler(null);
      parser.set(null);
    }
  }
View Full Code Here

    XSContext context = getContext();
    parser.set(this);
    FileOutputStream fos = null;
    try {
      XsObjectFactory factory = context.getXsObjectFactory();
      XsSAXParser xsSAXParser = factory.newXsSAXParser();
      context.setCurrentContentHandler(xsSAXParser);
      XMLReader xr = factory.newXMLReader(isValidating());
      String logDir = System.getProperty("org.apache.ws.jaxme.xs.logDir");
      if (logDir != null) {
        File tmpFile = File.createTempFile("jaxmexs", ".xsd", new File(logDir));
        fos = new FileOutputStream(tmpFile);
        LoggingContentHandler lch = new LoggingContentHandler(fos);
        lch.setParent(xr);
        xr = lch;
        String msg = "Read from " + pSource.getPublicId() + ", " + pSource.getSystemId() + " at " + new Date();
        lch.comment(msg.toCharArray(), 0, msg.length());
      }
      xr.setContentHandler(xsSAXParser);
      xr.parse(pSource);
      if (fos != null) {
        fos.close();
        fos = null;
      }
      return (XsESchema) xsSAXParser.getBean();
  } finally {
    if (fos != null) {
      try { fos.close(); } catch (Throwable ignore) {}
    }
      context.setCurrentContentHandler(null);
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.parser.XsSAXParser

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.