Hi folks, I'm new to Drupal and am trying to import a 200+ page site, and I've run into 1 or 2 problems. First of all, htmltidy cannot be installed on my server. However the pages do import. The problems I'm facing are as follows:
Overwrite doesn't overwrite but merges which turned out to be a problem for junk code of my first attempt. Not really your problem.
But I have found that many pages imported with the Site name as the page title. So I have many many pages that are incoherent until they are edited.
Also, no matter what I do, I can't get the pages that are not primary links to show as sub pages of their parents. Something about the hierarchy seems to be broken. If there is an easy fix or instruction, I'd appreciate it.

CommentFileSizeAuthor
#8 samplestructure.png27.75 KBjefferis

Comments

dman’s picture

This weeks -dev had a small issue that may have been 'hiding' your sub-items. What does the menu mangment tree look like?

Regarding the overwrite/merge issue. Hm.

Yeah, the first time through, the menu is built. This creates menu items with the available title.
Second time through - over-write, any existing menu item is left alone (changing menu item ids on the fly makes everything fall apart).
... so yeah, you'd still get the old titles.

Sounds like it may be an OK idea to always update that title for later runs...

jefferis’s picture

I could see in the menu tree a hierarchical structure. Because I had extra layout in the original upload, I decided to delete all the files from the Import and start over. However that action produced MASSIVE database errors, and I had to reinstall Drupal from scratch. So, is the current dev ready with a fix, or should I wait till?

dman’s picture

Deleting *files* caused an error? hm.

jefferis’s picture

Yes, I selected all files in content, and deleted. About 9 pages worth. It started spewing an message about database error or corruption.

jefferis’s picture

Let me know please, when the next version is released. I'm not going to try the import till there's a fix for the submenu thing.

dman’s picture

I'm using dev daily on a huge site right now - doing CVS checkouts and checkins every few days. I've not seen the database corruption you mention, so without an error message, I can't begin to guess what your exact issue is.

jefferis’s picture

I am not using the current dev, but the last stable release. Here is the error when I delete files:

user warning: Something is seriously wrong, database may be out of sync. I found a reference to '202' when looking up existing aliases, but that is not loaded as a valid node. We'll proceed by making a new node, cannot merge with the allegedly pre-existing one. in /home/../public_html/sites/all/modules/import_html_process.inc on line 1300.
user warning: Something is seriously wrong, database may be out of sync. I found a reference to '279' when looking up existing aliases, but that is not loaded as a valid node. We'll proceed by making a new node, cannot merge with the allegedly pre-existing one. in /home/../public_html/sites/all/modules/import_html_process.inc on line 1300.

jefferis’s picture

StatusFileSize
new27.75 KB

NEVERMIND. Newbie mistake. I had to create add the primary links to a menu block in a custom site. The menu wasn't available in the default layout.

Okay I switched to the latest dev release and things seemed to go better. However, I still can't get submenus to show. I have a picture of the sample hierarchy. Not sure what to do about the lack of drop down menu functions.

They do appear expanded if I activate primary links in a sidebar, but they are not active with the main menu in the header of the default layout.

dman’s picture

So from the snapshot and your description "They do appear expanded if I activate primary links in a sidebar"
... the pages are imported and are in the right place in the menu tree and are not hidden.

And you are left with a theming question? Primary links normally just show the top slice - no deeper - unless you use alternate rendering.

jefferis’s picture

Just once question. Some of the directories with html pages did not import for some reason. Is there any problem with uploading just that folder of pages into the original folder and just importing those additional files? I'm using the latest dev and it works well. I'd delete the other files already imported. I just see that some of the deeper files did not list or import.

dman’s picture

If I understand the question ...
A huge part of import_html is to support re-importing of slightly wrongly-imported content over top of already imported stuff. You can (should) be able to re-import over top many times without fear of double ups.
I know that it takes a few times to get all the exceptions and tuning right, this process is safe to run again and again until we do.

The one key is the import page URL. Leave that in place and later imports will replace.

Dunno about deleting files, just overwrite them.

Can't say which options you selected in the UI, but if you tick a 'directory' checkbox, that should recursively get anything under it.
Not if you just tick 'documents' as that will import just the documents visible on the tree

jefferis’s picture

I appreciate the help, really!
I found that quite a few links are broken, with an import that listed either a root or relative link as
./myfolder/mypage.html
when it should have been /myfolder/mypage.html and it would have worked fine. But I'm not sure how drupal stores root vs. relative structure, since this is my first go at it.

I have "Use document path" for items with no title.

Source files will be scanned from
/home/user/public_html/scholarold/
Pages will be re-created underneath
http://scholarscorner.com/
as page type nodes.
Import template for semantic data extraction is html2simplehtml.xsl
Links found within the sources will be rewritten to try and allow for the new paths
Script tags in the source will be left as-is (likely to break)
Non-page files imported will be saved beneath http://scholarscorner.com/?q=sites/default/files/imported/
Default document index.htm, index.html will be used to represent folders.
New pages will be added to the menu underneath Primary links.
Imported pages will be published by default and will not be promoted to the front page.

I have Try to Relink Files by discarding suffixes unchecked and Trim suffixes checked.
When you say leave the IMPORT URL the same, do yo mean I need to leave the path above the same? Which I would do normally. Or do you mean I need to leave the rest of the index.html files in place to maintain their relative relationship?
BTW, I had checked all folders using the top button and it selected all files...

jefferis’s picture

Error MEssages for the folders that didn't import

warning: DOMDocument::loadXML() [domdocument.loadxml]: StartTag: invalid element name in Entity, line: 1 in /home/username/public_html/sites/all/modules/import_html/coders_php_library/xml-transform.inc on line 117.
warning: DOMDocument::loadXML() [domdocument.loadxml]: Opening and ending tag mismatch: meta line 1 and head in Entity, line: 1 in /home/username/public_html/sites/all/modules/import_html/coders_php_library/xml-transform.inc on line 117.....

lots of these above...^

sample of page failures:

Importing 'otheo/2.1.lunsford.htm'
Unable to tidy file - htmltidy was unavailable "$message". Returning the original source.
Had XML trouble with the document 'sites/default/files/imported/otheo/2.1.lunsford.htm'
Unable to tidy file - htmltidy was unavailable "$message". Returning the original source.
Had XML trouble with the document 'sites/default/files/imported/otheo/2.1.lunsford.htm'
Import_HTML failed to initialize or parse XMLdoc input
Failed to process any node out of file 'otheo/2.1.lunsford.htm'
Failed to get any results from the attempted analysis of otheo/2.1.lunsford.htm. The source file path was probably unavailable or not HTML.

jefferis’s picture

I cleaned up those pages and converted them to xhtml in Dreamweaver. Is xhtml not recognized? Still got the errors above.

jefferis’s picture

I thought the problme might have been the unconventional naming of these old legacy pages: 2.1lundsford.htm, e.g.

So I edited page names and links in DW, but they still failed to import... with the same error.

dman’s picture

Pages will be re-created underneath http://scholarscorner.com/ as page type nodes.

That looks wrong. The 'path to create content under' is just the local path - usually blank for root. Not a full URL. That could be your relinking problems.

Non-page files imported will be saved beneath http://scholarscorner.com/?q=sites/default/files/imported/

This means you should turn on clean_urls.
import_html should probably work without clean_urls, but we normally expect it on.

Your HTML errors ... normally get smoothed out by htmltidy ... but

<html>
	<!--This file created 10/28/98 4:51 PM by Claris Home Page version 3.0-->
	<head>
		<title>O Theophilus: Interview With Judy Lunsford</title>
		<meta name="GENERATOR" content="Claris Home Page 3.0">
		<!DOCTYPE HTML PUBLIC "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//EN">
	</head>

Hm, a DOCTYPE inside the head. Not seen that before. Neither has the validator, I bet!
The only automated way to fix source content that is that screwy is with a special pre-process script. You have to do that custom, because ... each time some new bad HTML turns up, it is something that we didn't expect.
However, if you successfully fixed the validation problem manually anyway, then it should be XHTML all the way.

File names are not a problem at all - though it was worth considering.

The problem is the DOCTYPE in the content.
The only thing worse than tag-soup invalid HTML is tag-soup invalid HTML containing markers that specifically state that the document is actually valid.

I think you need a search&replace to get rid of all those screwy doctype tags - they are throwing off any chance of validation and XML/XHTML processing

jefferis’s picture

Okay, still having problems. First of all, I converted all the pages in this folder and their doctype xhtml and they all pass without errors in validation.


Secondly, I don't see any way to change this path under the settings. This is a Fantastico install of Drupal into my main website at the root folder

Pages will be re-created underneath http://scholarscorner.com/ as page type nodes.
That looks wrong. The 'path to create content under' is just the local path - usually blank for root. Not a full URL. That could be your relinking problems.

Finally I don't see the option for clean urls in this dev release. It is a bit different than the stable release in management, but I've checked all the additional settings and don't see a way to modify them.

Still getting errors with a clean import. Note my system has tidy but not HTMLTidy installed. Also other pages like these imported just fine. t:

warning: DOMDocument::loadXML() [domdocument.loadxml]: expected '>' in Entity, line: 1 in /home/jefferis/public_html/sites/all/modules/import_html/coders_php_library/xml-transform.inc on line 117.
user warning: Failed to parse in xml source. [sites/default/files/imported/otheo/Otheo.html] in /home/jefferis/public_html/sites/all/modules/import_html/coders_php_library/xml-transform.inc on line 120.

Importing 'otheo/Otheo.html'
Unable to tidy file - htmltidy was unavailable "$message". Returning the original source.
Had XML trouble with the document 'sites/default/files/imported/otheo/Otheo.html'
Unable to tidy file - htmltidy was unavailable "$message". Returning the original source.
Had XML trouble with the document 'sites/default/files/imported/otheo/Otheo.html'
Import_HTML failed to initialize or parse XMLdoc input
Failed to process any node out of file 'otheo/Otheo.html'
Failed to get any results from the attempted analysis of otheo/Otheo.html. The source file path was probably unavailable, invalid, or incorrect. Or it may have been a directory without an index. May also mean that an internal rule excluded the import.

dman’s picture

Sorry, I was thinking of the internals. The destination path is saved as blank if '/', but is displayed on the screen as the real full URL. My confusion there.

Clean Urls is a Drupal setting, not import_html.

Unable to tidy file - htmltidy was unavailable

Well, that message would seem to tell you that htmltidy is unavailable.

It is possible to run on pure XHTML input without requiring htmltidy, but it has to be real 100% W3C-validating pure XML for that to work. And not many input sources are that clean.

Normally the settings page would complain if you don't have a working copy of htmltidy available. Hm.
Anyway, you need to turn it on or install it.

jefferis’s picture

The host won't allow the html tidy to install on the shared server. They tried to get it to work for me but the path would not be recognized by Import HTML

I am just not sure this is going to work on our shared setup. I also installed the pecl extension and when I enable this in the php.ini in your home directory, it just loads a blank page when i goto the 'Import HTML Settings' link. But the other links all work, so maybe it will do what you want? I will leave it like this for now. If you want to undo what I did, edit the php.ini in your home directory, the very bottom of the file you will see extension=tidy.so just remove that or comment it out with a #
The executable version is /usr/bin/local/tidy
Your install does not like it though, even though the binary works fine. Im just not thinking any of this is going to work on our servers unfortunately.
Only the PECL module is available, not the executable.
-Mike B.
A Small Orange

jefferis’s picture

Okay, there is no rhyme or reason why some pages are importing and not others. I have taken the ones that were not working and stripped them down to the bare minimums. Made them html 4.1 transitional and/or XHTML 1 transitional, gotten rid of all validation errors, uploaded them to their existing folders and uploaded them to a top level to see if that could make a difference, but they just are not importing at all :

Importing 'book2.html'
Unable to tidy file - htmltidy was unavailable "$message". Returning the original source.
Had XML trouble with the document 'sites/default/files/imported/book2.html'
Unable to tidy file - htmltidy was unavailable "$message". Returning the original source.
Had XML trouble with the document 'sites/default/files/imported/book2.html'
Import_HTML failed to initialize or parse XMLdoc input
Failed to process any node out of file 'book2.html'
Failed to get any results from the attempted analysis of book2.html. The source file path was probably unavailable or not HTML.
No results! Failed to extract any new nodes

I'm sending the file itself. But it is bare bones.

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 

<title>Pardoned or Paroled Request Form</title>
</head>
<body>
 
 
    <div class="content">
      <h1>Request for &quot;Pardoned or Paroled?</h1>
      
		 
			<h1  >Request for &quot;Pardoned or Paroled?</h1>
		 
 
          <p>For a limited time, this book is available 
            on line. Get your copy now.</p>
          <p>This book is copyright 1993 by Jefferis 
            Kent Peterson. Distribution or resale of this material is strictly 
            prohibited. Permission is granted only for personal use and for the 
            printing of one copy for personal use. All other use without the express 
            written permission of the author is prohibited. These files may not 
            be uploaded elsewhere.</p>
          <p>&nbsp;</p>
          <p>If you agree to the conditions of use 
            and wish to download an electronic copy of the book, I will email 
            you access to the files. Simply place the words &quot;Book 
            Request&quot; in the subject field, 
            without the quotation marks, and a response will automatically be 
            mailed to you.</p>
          <p><i>[Important! If you use anonymous 
            mail or BCC, the auto-responder will not be able to reply to your 
            address! Be kind to me and get your authorization more quickly, use 
            your regular email. I have prevented the auto-responder from mailing 
            back to multiple recipients and mail-lists.]</i></p>
           
          <p> <a href="/pardoned.html">Return to Book Page </a></p>
          <p>&nbsp;</p>
        </center>
        <p>To use these files you will need either the <a href="http://www.adobe.com/prodindex/acrobat/readstep.html">Adobe 
          Acrobat Reader</a> available for free for both Macintosh or Windows.</p>
        <p>The Acrobat file requires no decompression. To unpack the smaller files, 
          you will need an unzipping program for Windows or Stuffit Expander for 
          Mac.      </p> 
	 end</div>
   

</body>
</html>
dman’s picture

I'd love to agree with you, but the validator doesn't.

... this whole pain (trivial errors) is what tidy is supposed to help you with :-} With that tool, it's all taken care of!

I know there are other alternatives (HTMLawed) but I've never tried them.

It's really a shame that entering /usr/bin/local/tidy in the import_html setup [ admin/build/import_html/setup ] like the admin suggested couldn't just work for you.