Package com.sun.org.apache.xerces.internal.parsers

Examples of com.sun.org.apache.xerces.internal.parsers.SAXParser


    {
      // Fallback if this fails (implemented in createIncrementalSAXSource) is
      // to attempt Xerces-1 incremental setup. Can't do tail-call in
      // constructor, so create new, copy Xerces-1 initialization,
      // then throw it away... Ugh.
      IncrementalSAXSource_Xerces dummy=new IncrementalSAXSource_Xerces(new SAXParser());
      this.fParseSomeSetup=dummy.fParseSomeSetup;
      this.fParseSome=dummy.fParseSome;
      this.fIncrementalParser=dummy.fIncrementalParser;
    }
  }
View Full Code Here


    catch(NoSuchMethodException e)
    {
      // Xerces version mismatch; neither Xerces1 nor Xerces2 succeeded.
      // Fall back on filtering solution.
      IncrementalSAXSource_Filter iss=new IncrementalSAXSource_Filter();
      iss.setXMLReader(new SAXParser());
      return iss;
    }
  }
View Full Code Here

    try {
      // Create a new handler for the parser
      SOSXMLValidator valXML = new SOSXMLValidator();

      // Get an instance of the parser
      SAXParser parser = new SAXParser();

      // set validation mode
      parser.setFeature("http://xml.org/sax/features/validation", true);
      parser.setFeature("http://apache.org/xml/features/validation/schema", true);

      parser.setContentHandler(valXML);
      parser.setEntityResolver(valXML);
      parser.setDTDHandler(valXML);
      parser.setErrorHandler(valXML);

      // Convert file to URL and parse
      try {
        parser.parse(createURL(fileName).toString());
      }
      catch (SAXParseException e) {
          throw new Exception(e.getMessage());
      }
      catch (SAXException e) {
View Full Code Here

    try {
      // Create a new handler for the parser
      SOSXMLValidator valXML = new SOSXMLValidator();

      // Get an instance of the parser
      SAXParser parser = new SAXParser();

      // set validation mode
      parser.setFeature("http://xml.org/sax/features/validation", true);
      parser.setFeature("http://apache.org/xml/features/validation/schema", true);
      parser.setContentHandler(valXML);
      parser.setEntityResolver(valXML);
      parser.setDTDHandler(valXML);
      parser.setErrorHandler(valXML);

      // Convert file to URL and parse
      try {
        parser.parse(is);
      }
      catch (SAXParseException e) {
          throw new Exception("Error validating xml: " + e);
      }
      catch (SAXException e) {
View Full Code Here

      // Create a new handler for the parser
      SOSXMLValidator valXML = new SOSXMLValidator();

      // Get an instance of the parser
      SAXParser parser = new SAXParser();

      // set validation mode
      parser.setFeature("http://xml.org/sax/features/validation", true);
      parser.setFeature("http://apache.org/xml/features/validation/schema", true);
      if( schemaFile != null && schemaFile.length() > 0 ){
        if (schemaFile.trim().indexOf(" ")!=-1){
          parser.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation", schemaFile);
        } else {
          parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", schemaFile);
        }
      }       

      parser.setContentHandler(valXML);
      parser.setEntityResolver(valXML);
      parser.setDTDHandler(valXML);
      parser.setErrorHandler(valXML);

      // Convert file to URL and parse
      try {
          parser.parse(createURL(fileName).toString());
      }
      catch (SAXParseException e) {
          throw new Exception(e.getMessage());
      }
      catch (SAXException e) {
View Full Code Here

    try {
      // Create a new handler for the parser
      SOSXMLValidator valXML = new SOSXMLValidator();

      // Get an instance of the parser
      SAXParser parser = new SAXParser();

      // set validation mode
      parser.setFeature("http://xml.org/sax/features/validation", true);
      parser.setFeature("http://apache.org/xml/features/validation/schema", true);
      parser.setContentHandler(valXML);
      parser.setEntityResolver(valXML);
      parser.setDTDHandler(valXML);
      parser.setErrorHandler(valXML);
      if( schemaFile != null && schemaFile.length() > 0 ){
        if (schemaFile.trim().indexOf(" ")!=-1){
          parser.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation", schemaFile);
        } else {
          parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", schemaFile);
        }
      }       

    
      // Convert file to URL and parse
      try {
        parser.parse(is);
      }
      catch (SAXParseException e) {
          throw new Exception("Error validating xml: " + e);
      }
      catch (SAXException e) {
View Full Code Here

    try {     
      if (xmlFileName.length() == 1) {
        throw (new Exception("xml Filename not exist!!"));
      }
     
      SAXParser parser;
      SOSSAXParserXML sample;
      try {
        // Create a new handler for the parser
        sample = new SOSSAXParserXML();
        // Get an instance of the parser
        parser = new SAXParser();
      }
      catch (Exception e) {
          sosLogger.warn("SAXParser Not found " + e);
        throw (new Exception("SAXParser Not found " + e));
      }
      // set validation mode
      if (isCheckValidate()) {
          parser.setFeature("http://xml.org/sax/features/validation", true);
      }
      // Set Handlers in the parser
      parser.setContentHandler(sample);
      parser.setEntityResolver(sample);
      parser.setDTDHandler(sample);
      parser.setErrorHandler(sample);
      // Convert file to URL and parse
      try {
        //spooler_log.info("createURL(xmlFileName): " + createURL(xmlFileName));
        parser.parse(createURL(xmlFileName).toString());
        //parser.parse(new org.xml.sax.InputSource(inputStream));
      }
      catch (SAXParseException e) {
          sosLogger.debug5(
            "Exception by Parsing/Validation - SAXParseXML.parseXMLFile() " + e);
View Full Code Here

            } catch (IOException e) {
                System.out.println("Error by creating insert script " + e);
            }


            SAXParser parser = new SAXParser();
            // set validation mode
            //( (SAXParser)
            // parser).setValidationMode(SAXParser.DTD_VALIDATION);
            // Set Handlers in the parser
            //parser.setDocumentHandler(sample);
            parser.setContentHandler(sample);
            parser.setEntityResolver(sample);
            parser.setDTDHandler(sample);
            parser.setErrorHandler(sample);
            // Convert file to URL and parse
            try {
                parser.parse(createURL(fileName).toString());
            } catch (SAXParseException e) {
                //Der Parser meckert weil kein xml-Datei, sondern xsd-Datei
                // genommen wurde.
                //Daher fange ich diese Fehler hier ab.
                if (!(e.getMessage()
View Full Code Here

      }
      content = stripNonValidXMLCharacters(content);
      inputStream = new ByteArrayInputStream(content.getBytes());
     
      // Parse the xml
      XMLReader reader = new SAXParser();
      reader.setContentHandler(this);
      InputSource source = new InputSource(inputStream);
      source.setEncoding(EncodingUtils.UTF8);
      reader.parse(source);
     
      return getResponse();
    } catch (IOException e) {
      throw new ConnectionException(e);
    } catch (SAXException e) {
View Full Code Here

                {
            // Fallback if this fails (implemented in createIncrementalSAXSource) is
                        // to attempt Xerces-1 incremental setup. Can't do tail-call in
                        // constructor, so create new, copy Xerces-1 initialization,
                        // then throw it away... Ugh.
                        IncrementalSAXSource_Xerces dummy=new IncrementalSAXSource_Xerces(new SAXParser());
                        this.fParseSomeSetup=dummy.fParseSomeSetup;
                        this.fParseSome=dummy.fParseSome;
                        this.fIncrementalParser=dummy.fIncrementalParser;
                }
  }
View Full Code Here

TOP

Related Classes of com.sun.org.apache.xerces.internal.parsers.SAXParser

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.