Package org.cyberneko.html.parsers

Examples of org.cyberneko.html.parsers.DOMFragmentParser


  };

  private URL[][] currURLsAndAnswers;

  public void testRobotsMetaProcessor() {
    DOMFragmentParser parser= new DOMFragmentParser();;

    try {
      currURLsAndAnswers= new URL[][] {
        {new URL("http://www.nutch.org"), null},
        {new URL("http://www.nutch.org"), null},
        {new URL("http://www.nutch.org"), null},
        {new URL("http://www.nutch.org"), null},
        {new URL("http://www.nutch.org"), null},
        {new URL("http://www.nutch.org"), null},
        {new URL("http://www.nutch.org"), null},
        {new URL("http://www.nutch.org/foo/"),
         new URL("http://www.nutch.org/")},
        {new URL("http://www.nutch.org"),
         new URL("http://www.nutch.org/base/")}
      };
    } catch (Exception e) {
      assertTrue("couldn't make test URLs!", false);
    }

    for (int i= 0; i < tests.length; i++) {
      byte[] bytes= tests[i].getBytes();

      DocumentFragment node = new HTMLDocumentImpl().createDocumentFragment();

      try {
        parser.parse(new InputSource(new ByteArrayInputStream(bytes)), node);
      } catch (Exception e) {
        e.printStackTrace();
      }

      HTMLMetaTags robotsMeta= new HTMLMetaTags();
View Full Code Here


    properties = OutputPropertiesFactory.getDefaultMethodProperties(Method.HTML);
    _HTMLserialiser = SerializerFactory.getSerializer(properties);
    _serializer = _HTMLserialiser;
    // serializer.setOutputStream(output);
    // _parser.setContentHandler(serializer.asContentHandler());
    viewStateParser = new DOMFragmentParser();
    // Set parser features
    try {
      viewStateParser
          .setProperty(
              "http://cyberneko.org/html/properties/names/elems",
View Full Code Here

    // MAIN
    //

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

    if(commentText.startsWith("<p>")==false) {
      commentText="<p>"+commentText;
    }
   
    commentText=replaceLinks(commentText);
    DOMFragmentParser parser = new DOMFragmentParser();
   
   
    Document doc=builder.newDocument();
    DocumentFragment fragment = doc.createDocumentFragment();
   
        try {
          parser.parse(new InputSource(new StringReader(commentText)), fragment);
     
    } catch (SAXException e) {
      IOException ioe = new IOException();
      ioe.initCause(e);
      throw ioe;
View Full Code Here

TOP

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

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.