Jump to content

Validating XHTML


Guest

Recommended Posts

Hi

I have a book site with quite a detailed product description. I entered a product's details by copying and pasting and checked it's validity. Then I set about producing a csv.file that I could import products in bulk.

The only way I could get the import to work was to eliminate all the white space in my HTML as without doing this I had carriage returns in the code which seemed to prevent the import going through.

When I do this the code for the description comes through as one long single line of code. The page displays as expected but when vaildating the code there are about 40 errors.

If I go to edit the product details in the admin panel merely opening the editor and clicking the source button re-formats the code and after saving the page (without changing anything) the code validates with no errors again. (also the page source shows nicely formatted code again).

It is a bit of a pain to go into each product one by one to convert the code to make it valid.

Am I doing something wrong? Is it possible to automate the reformatting? Or has anyone else overcome this problem in a different way.

thanks in advance

Link to comment
Share on other sites

Why can't you use valid HTML in the code you are importing? what HTML did it not like?

Sorry I didn't explain very well.

The code is valid to begin with, then in order to be able to import it to my MySQL database I have to eliminate all the white space. I wouldn't have thought this would effect the vailidity but it seems it does.

an example of the product after importing is

My product

although checking the vailidity shows up 47 errors. They all vanish if I merely look at them in the admin editor.

I would like to use the code, exactly as it is validated, but I simply can't as the import function in my MySQL admin does not do it without the whitespace removal.

Link to comment
Share on other sites

That page looks fine, nothing in the description area to cause a problem with validation.

When you say white space, what exactly are you referring to? Because if you mean a single space between words, then you may not be doing it right. HTML treats all space as one character space, unless a space character is used, ie ' '.

Link to comment
Share on other sites

That page looks fine, nothing in the description area to cause a problem with validation.

When you say white space, what exactly are you referring to? Because if you mean a single space between words, then you may not be doing it right. HTML treats all space as one character space, unless a space character is used, ie ' '.

The page looks exactly as planned, but when I check it's validity I get 47 errors.

The problem is that I use MS access to store the details of my books. I want to export a table with the correctly formatted HTML to import into my MySQL Database. I think the problem lies with Access in that if I start with code like:

<table cellpadding="1" align="right" id="tblbookfacts" class="style1">

<tbody>

<tr>

<th scope="row">

I put this in a memo field in access and it adds it to the variables and more snippets of code to produce the entire description HTML.

however if I then export this to a csv file. I get the code as abovve but when looked at in excel or notepad. access has appended to the end of each line a charactor which, I believe represents a carriage return. it looks like a square.

I have to replace the code above with code that looks like:

<table align="right" cellpadding="1" class="style1" id="tblbookfacts"> <tr> <th scope="row" >

When I do this I end up with code that will let me import it into my MySQL inventory table.

I know the access problem is nothing to do with this forum, but I was curious when I saw thet the CubeCart editor reformatted the text as soon as it opens it. Is this something that can be replicated in a PHP code or something else to go through my inventory table rather than having to go into the editor for each item.

Link to comment
Share on other sites

Ahhh I see. It makes sense now.

The square is to do with the format of the access export file. If the export file is encoded differently by Access (I think that can be done), the carriage return will be encoded in a way the mySQL import will correctly interpret. If that makes sense.

I think that's pretty much it. I'm sure if I am incorrect about anything, someone will correct me.

Link to comment
Share on other sites

Ahhh I see. It makes sense now.

The square is to do with the format of the access export file. If the export file is encoded differently by Access (I think that can be done), the carriage return will be encoded in a way the mySQL import will correctly interpret. If that makes sense.

I think that's pretty much it. I'm sure if I am incorrect about anything, someone will correct me.

That's right there are almost an infinite number of ways that files can be exported, I found a lot of them lose the decimal numbers in my weights and prices and turns them into integers etc.

And almost as many ways that MySQL can be set up to receive files. I find that comma seperated seems not to work (is it because I have dozens of commas in my description?). I have to use semi colons.

My way now seems to work. I was surprised to see the number of errors thrown up and how easily they can be eliminated. I feel that I must be missing something obvious.

If anyone can help. I export to a csv/text. file. not excel as I couldn't import those into MySQL (if tab deliminated, comma deliminated didn't export at all), I then use Western European Windows encoding. (I tried UTF-8 which MySQL said it used but this didn't handle the decimals correctly).

Link to comment
Share on other sites

What about editing the export with, say Crimson Editor, and re-saving it perhaps to a different encode before importing it?

Thanks, I will give it a try, and any other ideas. I had to use excel before to import to other programs. I would like the code to be validated. But I wonder if it is really that wrong if it is corrected just by being opened in CubeCart's editor.

It has taken a couple of days to get the csv importing to work as it is so I will have a rest then see if any variations work better.

I had problems as everyone else with catagory counts and thumnail pictures needing updating and found instant fixes for those so thought I would see if anyone else had this problem as well!

Thanks again

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...