any23-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lewis John McGibbney (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ANY23-326) parsing unclosed meta and input tags fails
Date Tue, 23 Jan 2018 22:26:00 GMT

    [ https://issues.apache.org/jira/browse/ANY23-326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16336465#comment-16336465
] 

Lewis John McGibbney commented on ANY23-326:
--------------------------------------------

The error stems from passing sloppy HTML to the  [RDFa11Extractor|[https://github.com/apache/any23/blob/6620c1efa94489e99ab129d01926cd9b25937f64/core/src/main/java/org/apache/any23/extractor/rdfa/RDFa11Extractor.java]]
or [RDFParserFactory|https://github.com/apache/any23/blob/6620c1efa94489e99ab129d01926cd9b25937f64/core/src/main/java/org/apache/any23/extractor/rdf/RDFParserFactory.java#L105-L124]
when we create an RDFa1.1 parser instance.

Over in Nutch, we recently by-passed this error, by correcting the sloppy HTML stream as follows

{code}
      try {
        // Fix input to avoid extraction error (https://github.com/semarglproject/semargl/issues/37#issuecomment-69381281)
        XMLReader reader = SAXParserImpl.newInstance(null).getXMLReader();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        XMLWriter writer = new XMLWriter(new OutputStreamWriter(baos));
        reader.setContentHandler(writer);
        reader.parse(new InputSource(new StringReader(htmlContent)));
        String input = new String(baos.toByteArray(), Charset.forName("UTF-8"));

        baos = new ByteArrayOutputStream();
        TripleHandler tHandler = new NTriplesWriter(baos);
        BenchmarkTripleHandler bHandler = new BenchmarkTripleHandler(tHandler);
        try {
          any23.extract(input, url, contentType, "UTF-8", bHandler);
        ...
{code}

> parsing unclosed meta and input tags fails
> ------------------------------------------
>
>                 Key: ANY23-326
>                 URL: https://issues.apache.org/jira/browse/ANY23-326
>             Project: Apache Any23
>          Issue Type: Bug
>          Components: CLI
>    Affects Versions: 2.1
>         Environment: ubuntu 17.04
>            Reporter: Ben Roberts
>            Priority: Major
>             Fix For: 2.2
>
>
> parsing fails as soon as it hits an unclosed input or meta tag, as an example try
>  ./bin/any23 rover https://ben.thatmustbe.me/note/2017/12/28/1
> [Fatal Error] :170:3: The element type "input" must be terminated by the matching end-tag
"</input>".
>  
> It seems like the issue might be that this is using a very old version of jsoup.  at
least as best I could tell.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message