WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] Problems with some HTML files, but not others (10 posts)

  1. HorrorUK
    Member
    Posted 1 year ago #

    Hi,

    This has really improved the look of what I'm trying to do, thank you.

    I seem to be having some problems with some files, though not others. These are HTML files which have just the table code in them.

    At this time, I have two different errors:

    1) A list of errors shows up, similar to the one below:

    Error 68: htmlParseEntityRef: no name in line 5, column 17

    In that table, there are 9 rows, but only 3 columns.

    2) Error: The data for the import is invalid.

    This one is also strange, as the table is set out exactly the same as the others. I don't know if maybe it is because the tables which give this error have a large number of rows, hundreds of them.

    Where this has worked, it looks great:

    http://klist.org/artist/1

    EDIT:
    I thought it might be useful to see the files I'm using. I've created a zip file with folders of the errors, and also some that are working without a problem.

    http://klist.org/tablePresserror.zip

    http://wordpress.org/extend/plugins/tablepress/

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks for your post, and sorry for the trouble.

    From what I can see, the reason for these errors are the attributes that some of the HTML tags in the files have. For example, the <table> tag has a border=1 attribute, or some <font> tags have color=#FF000 attributes, where the attribute value is not wrapped in quotation marks ". Unfortunately, the PHP library that TablePress uses for the HTML import is rather picky about these :-(
    When checking the HTML files that are working, you'll see that they have all attributes values wrapped in quotation marks.
    It does not matter that the files just have the table HTML in them (without the rest of the page around them), and the number of rows also does not matter.

    Workarounds that I could imagine here:
    - Can the program were you got the HTML files from maybe export to CSV format? Then, please use that.
    - If not, please try opening the HTML files in Excel or similar and then export them to CSV there.
    Importing CSV files into TablePress is more robust.

    Regards,
    Tobias

  3. HorrorUK
    Member
    Posted 1 year ago #

    Thanks Tobias,

    I'll give that a go.

    No worries on the troubles, this is beta so I expected something to not quite work correctly.

    Joe

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Joe,

    ok, thanks.

    Yeah, but this behavior likely won't change in the final version, as that would mean that I would need a totally different HTML import library - which I don't have :-(
    So, most likely, the HTML import will continue to work only with "valid" HTML files.

    Best wishes,
    Tobias

  5. HorrorUK
    Member
    Posted 1 year ago #

    I removed all te attributes from the table, but still no luck with it.

    However, copying/pasting then saving within Excel as a CSV file does the job perfectly, with both errors.

    Thank you.

  6. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    ah, it turns out that my initial assumption was wrong. It's not about the attributes not being wrapped in quotation marks in your tables!
    It's the & characters in the cells (I found this when checking the given line numbers in the import error messages.)
    In HTML, & characters need to be written as an "entity", i.e. as &amp;. So, just open your HTML files in a text editor, do a search and replace, and replace all & with &amp;. The HTML tables should then be imported as expected.

    Regards,
    Tobias

  7. HorrorUK
    Member
    Posted 1 year ago #

    Thanks, I'll check that out, as it may be quicker on some of the files that have over 1000 rows :)

  8. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    oh yes, most definitely! :-)

    Best wishes,
    Tobias

  9. HorrorUK
    Member
    Posted 1 year ago #

    I just gave that a go on a file that had the following error message before editing:

    Error: The data for the import is invalid.

    But that still gives the error after changing it.

    It isn't a major problem though, as I can use the CSV method.

  10. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    ok :-( Then there's probably something else going on in that file. It's probably the best to just the CSV method then, indeed.

    Best wishes,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.