Package org.cyberneko.html.parsers

Examples of org.cyberneko.html.parsers.DOMParser


    @Override
    protected Document fileToDoc(File f)
    throws ParserConfigurationException, SAXException, IOException
    {
        DOMParser parser = new DOMParser();
        FileInputStream fis = new FileInputStream(f);
        try
        {
            InputSource is = new InputSource(fis);
            parser.parse(is);
            Document doc = parser.getDocument();
            //XmlToolkit.dump(doc);
            return doc;
        }
        finally
        {
View Full Code Here


   *             if an IO failure occurs.
   * @throws SAXException
   *             if an exception occurs while parsing the HTML string.
   */
  public static Document getDocument(String html) throws SAXException, IOException {
    DOMParser domParser = new DOMParser();
    domParser.setProperty("http://cyberneko.org/html/properties/names/elems", "match");
    domParser.setFeature("http://xml.org/sax/features/namespaces", false);
    domParser.parse(new InputSource(new StringReader(html)));
    return domParser.getDocument();
  }
View Full Code Here

   *             if an exception occurs while parsing the HTML string.
   * @throws IOException
   *             if an IO failure occurs.
   */
  public static Document getDocumentNoBalance(String html) throws SAXException, IOException {
    DOMParser domParser = new DOMParser();
    domParser.setProperty("http://cyberneko.org/html/properties/names/elems", "match");
    domParser.setFeature("http://cyberneko.org/html/features/balance-tags", false);
    domParser.parse(new InputSource(new StringReader(html)));
    return domParser.getDocument();
  }
View Full Code Here

    // MAIN
    //

    /** Main. */
    public static void main(String[] argv) throws Exception {
        DOMParser parser = new DOMParser();
        for (int i = 0; i < argv.length; i++) {
            parser.parse(argv[i]);
            print(parser.getDocument(), "");
        }
    } // main(String[])
View Full Code Here

   *             if an IO failure occurs.
   * @throws SAXException
   *             if an exception occurs while parsing the HTML string.
   */
  public static Document getDocument(String html) throws SAXException, IOException {
    DOMParser domParser = new DOMParser();
    domParser.setProperty("http://cyberneko.org/html/properties/names/elems", "match");
    domParser.setFeature("http://xml.org/sax/features/namespaces", false);
    domParser.parse(new InputSource(new StringReader(html)));
    return domParser.getDocument();
  }
View Full Code Here

   *             if an exception occurs while parsing the HTML string.
   * @throws IOException
   *             if an IO failure occurs.
   */
  public static Document getDocumentNoBalance(String html) throws SAXException, IOException {
    DOMParser domParser = new DOMParser();
    domParser.setProperty("http://cyberneko.org/html/properties/names/elems", "match");
    domParser.setFeature("http://cyberneko.org/html/features/balance-tags", false);
    domParser.parse(new InputSource(new StringReader(html)));
    return domParser.getDocument();
  }
View Full Code Here

TOP

Related Classes of org.cyberneko.html.parsers.DOMParser

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.