Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-5927

Content lost when using the streaming parser and renderer APIs to convert from HTML to wiki syntax

    Details

    • Tests:
      Unit
    • Difficulty:
      Unknown
    • Similar issues:

      Description

      I'm using this code to convert xhtml/1.0 to xwiki/2.0:

      StreamParser xhtmlStreamParser = componentManager.lookup(StreamParser.class, "xhtml/1.0");
      WikiPrinter printer = new DefaultWikiPrinter();
      PrintRendererFactory printRendererFactory = componentManager.lookup(PrintRendererFactory.class, "xwiki/2.0");
      xhtmlStreamParser.parse(new StringReader(xhtml), printRendererFactory.createRenderer(printer));
      

      Some of the content, mostly from the end, is lost during the conversion. For instance this:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html><head></head><body><p>one <strong>two</strong> <em>three</em></p></body></html>
      

      is converted to:

      one **two** //
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tmortagne Thomas Mortagne
                Reporter:
                mflorea Marius Dumitru Florea
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: