Package org.xml.sax

Examples of org.xml.sax.InputSource


      oParserWrapper.setFeature("http://apache.org/xml/features/validation/schema", bValidation);
      oParserWrapper.setFeature("http://apache.org/xml/features/validation/schema-full-checking", bValidation);

      if (DebugFile.trace) DebugFile.writeln("DOMParserWrapper.parse([InputSource])");

      oDocument = oParserWrapper.parse(new InputSource(oStrm));

      if (DebugFile.trace) {
        DebugFile.decIdent();
        DebugFile.writeln("End DOMDocument.parseStream()");
      }
View Full Code Here


    }

    private void addBinding(String bindingFile) throws XMLStreamException {
        String bindingLocation = ProcessorUtil.absolutize(ProcessorUtil.getFileOrURLName(bindingFile));
       
        InputSource is = new InputSource(bindingLocation);
        XMLStreamReader reader = StAXUtil.createFreshXMLStreamReader(is);

        StAXUtil.toStartTag(reader);

        if (isValidJaxwsBindingFile(bindingFile, reader)) {
View Full Code Here

   
            if (DOMSource.class.isAssignableFrom(callback.getSupportedFormats()[0])) {
                obj = new DOMSource();
                ((DOMSource)obj).setNode(doc);         
            } else if (SAXSource.class.isAssignableFrom(callback.getSupportedFormats()[0])) {    
                InputSource inputSource = new InputSource(getSOAPBodyStream(doc));
                obj = new SAXSource(inputSource);
            } else if (StreamSource.class.isAssignableFrom(callback.getSupportedFormats()[0])) {    
                obj = new StreamSource(getSOAPBodyStream(doc));
            } else if (Object.class.isAssignableFrom(callback.getSupportedFormats()[0])) {          
                JAXBContext context = callback.getJAXBContext();
View Full Code Here

            InputStream is = ResourceManagerImpl.instance().getResourceAsStream(getDtdFile());
            if (is == null) {
                throw new ConfigurationException(new Message("COULD_NOT_RESOLVE_BEANS_DTD_EXC", LOG,
                                                             DTD_SYSTEM_ID));
            }
            InputSource source = new InputSource(is);
            source.setPublicId(publicId);
            source.setSystemId(systemId);
            return source;
        }
        // Use the default behavior -> download from website or wherever.
        return null;
    }
View Full Code Here

    *
    */
   private Document getDocument(String xml) throws XmlBlasterException {
      try {  
         java.io.StringReader reader = new java.io.StringReader(xml);
         InputSource input = new InputSource(reader);
         DocumentBuilderFactory factory = glob.getDocumentBuilderFactory();
         DocumentBuilder builder = factory.newDocumentBuilder ();
         return builder.parse(input)
      } catch (org.xml.sax.SAXException ex) {
         String reason = ex.getMessage();
View Full Code Here

         }
         catch (IOException ex) {
            throw new XmlBlasterException(this.glob, ErrorCode.INTERNAL_UNKNOWN, ME + ".parse: could not flush the output stream: original message: '" + ex.toString() + "'");
         }
      }
      super.init(new InputSource(in)); // parse with SAX
   }
View Full Code Here

      }

      if (log.isLoggable(Level.FINE)) log.fine("readConfigFile: the file is '" + url.getFile() + "'");
      try {
         InputStream fis = url.openStream();
         InputSource inSource = new InputSource(fis);
         reset();
         init(url.toString(), inSource);
         PluginHolder ret = getObject();
         PluginConfig[] arr = ret.getAllPluginConfig(this.glob.getNodeId().getId());
         for (int i=0; i<arr.length; i++)
View Full Code Here

      if (schemavalidate) {
        parser.setFeature("http://apache.org/xml/features/validation/schema", true);
      }

      // Parsea el documento
      parser.parse(new InputSource(xml));

    } catch (SAXParseException e) {
      System.err.println(e.getMessage());
    } catch (SAXException e) {
      System.err.println(e.getMessage());
View Full Code Here

        // local variables
        XMLReader parser;
        Parser sax1Parser;
        StringBufferInputStream oStrBuff;
        InputSource ioSrc;

        if (DebugFile.trace) {
          DebugFile.writeln ("Begin ShoppingBasket.parse(String)");
          DebugFile.incIdent();
        }

        try {
          if (DebugFile.trace) DebugFile.writeln ("XMLReaderFactory.createXMLReader(" + DEFAULT_PARSER_NAME + ")");

          parser = XMLReaderFactory.createXMLReader(DEFAULT_PARSER_NAME);
        }
        catch (Exception e) {
            if (DebugFile.trace) DebugFile.writeln ("ParserFactory.makeParser(" + DEFAULT_PARSER_NAME + ")");

            sax1Parser = ParserFactory.makeParser(DEFAULT_PARSER_NAME);

            parser = new ParserAdapter(sax1Parser);
            if (DebugFile.trace)
              DebugFile.writeln("warning: Features and properties not supported on SAX1 parsers.");
        }
        try {
          parser.setFeature(NAMESPACES_FEATURE_ID, DEFAULT_NAMESPACES);
          parser.setFeature(VALIDATION_FEATURE_ID, DEFAULT_VALIDATION);
        }
        catch (SAXException e) {
        }

      // parse file
      parser.setContentHandler(this);
      parser.setErrorHandler(this);

      oStrBuff = new StringBufferInputStream(sXMLData);
      ioSrc = new InputSource(oStrBuff);
      parser.parse(ioSrc);
      oStrBuff.close();

      if (DebugFile.trace) {
        DebugFile.decIdent();
View Full Code Here

        public InputSource resolveEntity(
            final String publicId,
            final String systemId)
            throws SAXException, IOException
        {
            InputSource source = null;
            if (this.xmlResource != null)
            {
                String path = systemId;
                if (path != null && path.startsWith(SYSTEM_ID_FILE))
                {
                    final String xmlResource = this.xmlResource.toString();
                    path = path.replaceFirst(
                            SYSTEM_ID_FILE,
                            "");

                    // - remove any extra starting slashes
                    path = ResourceUtils.normalizePath(path);

                    // - if we still have one starting slash, remove it
                    if (path.startsWith("/"))
                    {
                        path = path.substring(
                                1,
                                path.length());
                    }
                    final String xmlResourceName = xmlResource.replaceAll(
                            ".*(\\+|/)",
                            "");
                    URL uri = null;
                    InputStream inputStream = null;
                    try
                    {
                        uri = ResourceUtils.toURL(StringUtils.replace(
                                    xmlResource,
                                    xmlResourceName,
                                    path));
                        if (uri != null)
                        {
                            inputStream = uri.openStream();
                        }
                    }
                    catch (final IOException exception)
                    {
                        // - ignore
                    }
                    if (inputStream == null)
                    {
                        try
                        {
                            uri = ResourceUtils.getResource(path);
                            if (uri != null)
                            {
                                inputStream = uri.openStream();
                            }
                        }
                        catch (final IOException exception)
                        {
                            // - ignore
                        }
                    }
                    if (inputStream != null)
                    {
                        source = new InputSource(inputStream);
                        source.setPublicId(publicId);
                        source.setSystemId(uri.toString());
                    }
                }
            }
            return source;
        }
View Full Code Here

TOP

Related Classes of org.xml.sax.InputSource

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.