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

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


  /** <p>Parses the given XML schema. and returns a syntactical
   * representation.</p>
   * @see #parse(InputSource)
   */
  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


  }

  /** <p>Parses the given XML schema and returns a logical representation.</p>
   */
  public XSSchema parse(InputSource pSource) throws ParserConfigurationException, SAXException, IOException {
    XSContext myData = getContext();
    parser.set(this);
    try {
      return newXSLogicalParser().parse(pSource);
    } finally {
      myData.setCurrentContentHandler(null);
      parser.set(null);
    }
  }
View Full Code Here

   *   {@link org.w3c.dom.Element}, or an instance of
   *   {@link org.w3c.dom.DocumentFragment}. In the latter case, make
   *   sure, that the fragment contains a single root element.
   */
  public XSSchema parse(Node pNode) throws SAXException {
    XSContext myData = getContext();
    parser.set(this);
    try {
      return newXSLogicalParser().parse(pNode);
    } finally {
      myData.setCurrentContentHandler(null);
      parser.set(null);
    }
  }
View Full Code Here

  /** <p>Parses the given XML schema. and returns a syntactical
   * representation.</p>
   * @see #parse(InputSource)
   */
  public XsESchema parseSyntax(final InputSource pSource) throws ParserConfigurationException, SAXException, IOException {
    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);
      parser.set(null);
    }
  }
View Full Code Here

  }

  /** <p>Parses the given XML schema and returns a logical representation.</p>
   */
  public XSSchema parse(InputSource pSource) throws ParserConfigurationException, SAXException, IOException {
    XSContext myData = getContext();
    parser.set(this);
    try {
      return newXSLogicalParser().parse(pSource);
    } finally {
      myData.setCurrentContentHandler(null);
      parser.set(null);
    }
  }
View Full Code Here

   *   {@link org.w3c.dom.Element}, or an instance of
   *   {@link org.w3c.dom.DocumentFragment}. In the latter case, make
   *   sure, that the fragment contains a single root element.
   */
  public XSSchema parse(Node pNode) throws SAXException {
    XSContext myData = getContext();
    parser.set(this);
    try {
      return newXSLogicalParser().parse(pNode);
    } finally {
      myData.setCurrentContentHandler(null);
      parser.set(null);
    }
  }
View Full Code Here

TOP

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

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.