Package org.xml.sax

Examples of org.xml.sax.InputSource


        load(fis);
    }

    public static void load(InputStream is) throws ChaiDBException {
        try {
            InputSource inputSource = new InputSource(is);
            DOMParser parser = new DOMParser();
            parser.parse(inputSource);
            Document document = parser.getDocument();
            if (document == null) {
                throw new ChaiDBException(ErrorCode.PARSE_ERROR, "Config File is not well-formed!");
View Full Code Here


            return null;
        }

        Document doc;
        try {
            InputSource input = new InputSource(new FileInputStream(controlFilePath));
            doc = SafeUpdateUtils.parse(input);
        } catch (Exception e) {
            logger.error(e);
            doc = null;
        }
View Full Code Here

   * @param nms
   */
  private void testXerces(String nm, String[] nms) {
     SAXParser sax = new SAXParser();
     try {
      InputSource in = new InputSource(new URL(nm).openStream());
      sax.parse(in);
      for (int i=0;i<nms.length;i++) {
        in = new InputSource(new URL(nms[i]).openStream());
        sax.parse(in);
      }
      currentMem();
      sax.equals("");
     
View Full Code Here

  public static Document parseInputStream(final InputStream instream)
      throws ParserConfigurationException, SAXException, IOException
  {
    final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    final DocumentBuilder db = dbf.newDocumentBuilder();
    return db.parse(new InputSource(instream));
  }
View Full Code Here

            }
        };

        MockHttpServletResponse response = new MockHttpServletResponse();
        exporter.handleRequest(request, response);
        InputSource source = new InputSource(new ByteArrayInputStream(response.getContentAsByteArray()));
        WSDLFactory factory = WSDLFactory.newInstance();
        WSDLReader reader = factory.newWSDLReader();
        reader.readWSDL("", source);
    }
View Full Code Here

                return "wsdl";
            }
        };
        MockHttpServletResponse response = new MockHttpServletResponse();
        exporter.handleRequest(request, response);
        InputSource source = new InputSource(new ByteArrayInputStream(response.getContentAsByteArray()));
        WSDLFactory factory = WSDLFactory.newInstance();
        WSDLReader reader = factory.newWSDLReader();
        Definition definition = reader.readWSDL("", source);
        Service service = definition.getService(new QName(namespace, name));
        assertNotNull(service);
View Full Code Here

        public Element asElement() {
            if (element == null) {
                Document document;
                try {
                    document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(toString())));
                } catch (Exception e) {
                    throw UncheckedException.asUncheckedException(e);
                }
                element = document.getDocumentElement();
                builder = null;
View Full Code Here

  static final InputSource createInputSource(Context context, Any source)
      throws SAXException, IOException
  {
    if (source.isString()) {
      return new InputSource(new StringReader(source.toString()));
     
    } else if (source instanceof AnyFile) {
      File file = (File)source.toObject();
      context.checkRead(file.getPath());
      return new InputSource(new FileInputStream(file));
     
    } else if (source instanceof AnyURL) {
      URL url = (URL)source.toObject();
      return new InputSource(url.openStream());
     
    } else if (source instanceof AnyInputStream) {
      InputStream input = (InputStream)source.toObject();
      return new InputSource(input);
     
    }
    return null;
  }
View Full Code Here

  public static final Object[] p_parseDOM = { null, "source", "*features", null };
  public static final Any parseDOM(Context context, Any source, Any features)
  {
    try {

      InputSource inputSource = createInputSource(context, source);
      if (source == null) {
        throw context.BadParameter("File, InputStream, URL or string expected");
      }
     
      DOMParser parser = new DOMParser();
View Full Code Here

  {
    SAXHandler handler = null;
    ErrorListener listener = null;
    try {

      InputSource inputSource = createInputSource(context, source);
      if (source == null) {
        throw context.BadParameter("File, InputStream, URL or string expected");
      }

      SAXParser parser = new SAXParser();
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.