Package org.xml.sax

Examples of org.xml.sax.InputSource


                   "</xmlBlaster>\n";

      // assertXpathExists("/qos/securityService[@type='htpasswd']", qos);
     
      StringReader reader = new StringReader(txt);
      InputSource input = new InputSource(reader);
      //input.setEncoding("UTF-8");
      //input.setEncoding("ISO-8859-2");
      //input.setSystemId("9999999999");

      try {
         DocumentBuilderFactory dbf = glob.getDocumentBuilderFactory();
         DocumentBuilder db = dbf.newDocumentBuilder();
         Document xmlDoc = db.parse(input);
        
         ByteArrayOutputStream out = XmlNotPortable.writeNode(xmlDoc.getDocumentElement());
         String response = new String(out.toByteArray());
         log.info(response);
         reader = new StringReader(response);
         input = new InputSource(reader);
         Document xmlDoc1 = db.parse(input);
         this.assertXMLEqual("", xmlDoc, xmlDoc1);
      }
      catch (ParserConfigurationException e) {
         log.severe("Problems when building DOM parser: " + e.toString() + "\n" + txt);
View Full Code Here


  }

  public static ServiceResponse parse(String xmlString)
    throws IOException, CasParseException, ParserConfigurationException, SAXException
  {
    Document document = createBuilder().parse(new InputSource(new StringReader(xmlString)));
    return parse(document);
  }
View Full Code Here

        throws Exception
    {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        builder.setEntityResolver(new XslTransformerEntityResolver(url));
        return builder.parse(new InputSource(url));
    }
View Full Code Here

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

                // - remove any extra starting slashes
                path = path.replaceAll(
                        "\\+",
                        "/").replaceAll(
                        "/+",
                        "/");

                // - 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;
                uri = new File(StringUtils.replace(
                            xmlResource,
                            xmlResourceName,
                            path)).toURL();
                if (uri != null)
                {
                    inputStream = uri.openStream();
                }
                if (inputStream != null)
                {
                    source = new InputSource(inputStream);
                    source.setPublicId(publicId);
                    source.setSystemId(uri.toString());
                }
            }
            return source;
        }
View Full Code Here

    }
    if (baseURI == null) {
      throw new IllegalArgumentException("Base URI cannot be 'null'");
    }

    InputSource inputSource = new InputSource(in);
    inputSource.setSystemId(baseURI);

    parse(inputSource);
  }
View Full Code Here

    }
    if (baseURI == null) {
      throw new IllegalArgumentException("Base URI cannot be 'null'");
    }

    InputSource inputSource = new InputSource(reader);
    inputSource.setSystemId(baseURI);

    parse(inputSource);
  }
View Full Code Here

            int status = client.executeMethod(get);
            if (status == 404)
            {
                throw new WebServiceClientException("WSDL could not be found at: '" + address + "'");
            }
            InputSource inputSource = null;
            boolean authenticated = status > 0 && status < 400;
            if (authenticated)
            {
                inputSource = new InputSource(get.getResponseBodyAsStream());
            }
            else
            {
                throw new WebServiceClientException("Could not authenticate user: '" + username + "' to WSDL: '" +
                    address + "'");
View Full Code Here

      }
      InputStream inBytes = new ByteArrayInputStream(xmlRaw);
      InputSource inputSource = new InputSource(inBytes);
      parse(inputSource);
      */
      parse(new InputSource(new StringReader(xmlData)));
   }
View Full Code Here


   public static org.w3c.dom.Document parseToDomTree(Global glob, String xmlKey_literal) throws XmlBlasterException
   {
      java.io.StringReader reader = new java.io.StringReader(xmlKey_literal);
      InputSource input = new InputSource(reader);
      //input.setEncoding("UTF-8");
      //input.setEncoding("ISO-8859-2");
      //input.setSystemId("9999999999");
      final String ME = "DOMParser";
      if (glob == null) glob = Global.instance();
View Full Code Here

    {
      try
      {
        ByteArrayInputStream xmlStream = new ByteArrayInputStream(xml
            .getBytes(Constants.getXMLEncoding()));
        InputSource inputSource = new InputSource(xmlStream);
        String systemString = new StringBuffer().append(
            Constants.XBUS_ETC).append("dtd").append(
            Constants.FILE_SEPERATOR).toString();

        String systemId = new File(systemString).toURL().toString();
        inputSource.setSystemId(systemId);

        DOMParser parser = new DOMParser();

        parser.setFeature("http://xml.org/sax/features/validation",
            getValidating(messageName, system));
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.