First of all, thanks for writing this module - it looks like it'll save me a lot of time transferring an unmanageable static site into Drupal. However in my attempts to import this site I've run into a problem. I can run a basic import, which successfully imports some pages. However for many I get the following errors (with debug logging turned to 7/full):

Results from the last import process - Fri, 12/23/2011 - 15:15 (Messages up to notice. more | less)
Message
Importing 'about-us/contact-us.php'
Import_HTML failed to initialize or parse XMLdoc input
Failed to process any node out of file 'about-us/contact-us.php'
Failed to get any results from the attempted analysis of about-us/contact-us.php. The source file path was probably unavailable or not HTML.
No results! Failed to extract any new nodes

Also, atop the results page I get this Drupal warning:

warning: mime_content_type() [function.mime-content-type]: File or path not found 'file:///Users/tomash/Sites/drupal6/a-gwwc-src/about-us/contact-us.php' in /Users/tomash/Sites/drupal6/sites/all/modules/import_html/import_html.module on line 441.

What's going on? For reference, here is the complete source of the file:///Users/tomash/Sites/drupal6/a-gwwc-src/about-us/contact-us.php file/page I was trying to import - as you can see it's very simple, and I can't see why it'd cause import_html to choke when other pages import fine on my computer.

<h1>Contact Us</h1>

<p>If you would like any more information regarding <em>Giving 
What We Can</em>, then please contact us and we will do our 
best to help. </p>

<table class=layout>
  <tr>
    <td class=txtlt><p>General Enquiries:</p></td>
    <td class=txtlt><p><a href="&#x6d;&#x61;&#105;&#108;&#116;&#x6f;&#58;&#105;&#x6e;&#102;&#x6f;&#114;&#x6d;&#x61;&#116;&#x69;&#111;&#x6e;&#64;&#x67;&#105;&#x76;&#x69;&#110;&#x67;&#x77;&#104;&#x61;&#116;&#119;&#101;&#99;&#97;&#110;&#46;&#111;&#114;&#x67;">&#105;&#x6e;&#102;&#x6f;&#114;&#x6d;&#x61;&#116;&#x69;&#111;&#x6e;&#64;&#x67;&#105;&#x76;&#x69;&#110;&#x67;&#x77;&#104;&#x61;&#116;&#119;&#101;&#99;&#97;&#110;&#46;&#111;&#114;&#x67;</a></p></td>
  </tr>
  <tr>
    <td class=txtlt><p>Press Enquiries:</p></td>
    <td class=txtlt><p><a href="&#x6d;&#97;&#105;&#x6c;&#116;&#x6f;&#58;&#112;&#x72;&#101;&#115;&#x73;&#64;&#x67;&#105;&#x76;&#105;&#110;&#x67;&#x77;&#104;&#x61;&#x74;&#x77;&#101;&#99;&#97;&#x6e;&#x2e;&#x6f;&#x72;&#x67;">&#112;&#x72;&#101;&#115;&#x73;&#64;&#x67;&#105;&#x76;&#105;&#110;&#x67;&#x77;&#104;&#x61;&#x74;&#x77;&#101;&#99;&#97;&#x6e;&#x2e;&#x6f;&#x72;&#x67;</a>
        <br>
              (or view our <a href="press-kit.php">press kit</a>)</p></td>
  </tr>
  <tr>
    <td class=txtlt><p>Postal Address:</p></td>
    <td class=txtlt><p>Giving What We Can<br>
        Oxford Uehiro Centre for Practical Ethics<br>
        Littlegate House<br>
        St Ebbes Street<br>
        Oxford OX1 1PT<br>
        UK</p></td>
  </tr>
</table>

Comments

dman’s picture

Status: Active » Closed (cannot reproduce)

If what you pasted is indeed the "complete" html file, then there is a lot wrong with it.
An HTML file would be expected to have <html> and <body> wrappers at a minimum.

Even so, I've seen htmltidy sort things out even with input like that.
Process under the hood is:
It tries a simple parse - if that fails, it runs tidy and then parses again. Normally that would get though.

In your case, I can't say, but if you go into the 'advanced settings' you can turn up the debugging volumw. If you set it loud enough you'll begin to see all the complaints that were triggered by the "tidy" process.
In the short term though, sometimes it's better to just call a couple of pages a loss and re-create them by hand - in order to get things done.

liquidcms’s picture

Version: 6.x-1.1 » 7.x-1.x-dev
Status: Closed (cannot reproduce) » Active

i guess it would be safe to assume that Tidy is not the same between Windows and Linux? I was getting this same issue: 0 items imported, Failed to process any node out of file.. when i was testing on Win7 dev system; but then realized i had loaded db from server which had reset path to tidy. After fixing path to ALL (very messy) HTML files imported correctly.

When i went back to linux server; with correct path to tidy and trying either the commandline or extension option; i can not get anything to import. As the module's Setup page seems to suggest both extension and commandline for tidy are in place; i can only assume that these versions of Tiny don't work too well.

I think my only option is to process on Win dev system and then move new db over to server.