Forum Moderators: open

Message Too Old, No Replies

<o:p> tags

hhmmm very strange

         

dannibecher

7:11 pm on Feb 16, 2009 (gmt 0)

10+ Year Member



Using a free webdesigning programme as dreamweaver is currently too expensive and i am getting some stange code such as <o:p></o:p> tags all over the place. What does this code stand for?

swa66

7:46 pm on Feb 16, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



MSFT office is the culprit in all cases where I've seen that.

choster

11:17 pm on Feb 16, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The "o" prefix indicates the Microsoft Office namespace; you'll see it if you copy and paste in content generated from an Office application (e.g. Outlook, Word), or use an Office application to export HTML. The namespace prefix is part of XML and in theory should be harmless in XHTML, but might produce unexpected effects in HTML.

Many applications, including Javascript WYSIWYG packages, offer an option called "Paste from Word" or "Clean up Office HTML" or something similar which can reduce some of the strange code. The problem is with Microsoft's output; Dreamweaver is no better than Notepad++ or Bluefish for cleaning it up.

D_Blackwell

1:58 am on Feb 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Dreamweaver is no better than Notepad++ or Bluefish for cleaning it up.

Wouldn't a global search and replace clean it up just fine; by the page or throughout the site? The main problem would be how many garbage cleanups will be necessary. You can only search and replace one problem at a time and there could be a lot of problems.

willybfriendly

3:15 am on Feb 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was dealing with this stuff over here:

[webmasterworld.com...]

These were archived emails generated by outlook that needed to be displayed on a webpage. The finished script looks like this:

function cleanUpHTML($text)
{
//discard unwanted tags
$text = strip_tags($text, '<p><b><i><ol><ul><li>');
//strip header stuff
$text = stristr($text, '<P');
//strip all attributes (Word garbage)
$text = preg_replace("/<(\w)[^>]*?>/s", "<$1>", $text);
//get rid of useless non breaking spaces
$text = preg_replace("/&nbsp;/", "", $text);
//get rid of empty p's
$text = preg_replace("/<p><\/p>/i", "", $text);
$text = mb_convert_encoding($text, "EUCJP-WIN", "UTF-8");
return $text;
}

So far it is working like a champ, although some special MS Characters (em-dash, curly quotes, etc.) are stripped completely.

Be advised, this script takes it all down to the most basic of markup, and no attributes are left untouched!

choster

6:07 pm on Feb 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The main problem would be how many garbage cleanups will be necessary.
That's exactly the problem. The o: is the simplest bit to clean up; the document, however, will probably be riddled with a zillion <span>s for inline declarations of fonts and margins.

When someone sends me a Word document to mark up, I actually forward it to my GMail account and use the "View as HTML" option. Google strips most of the Office markup and replaces it with simple tags which are easier to find and edit as needed.

pageoneresults

6:26 pm on Feb 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Bring it into FrontPage, Select All, Remove Formatting and be done with it!

Well, it may not be that simple but it gets you very close. No matter what you do, you will need to inspect each and every byte of code in the process. I've always found the sure fire way is to just cut and paste into Notepad++, paste back into FrontPage and then do my structuring and styling from there. I've seen pasted Word documents generate upwards of 2000% more HTML code depending on the structure of the Word doc. If you get a Word Author who knows their stuff and used all the nifty little features in Word, oh boy, watch out!

Not only will you get the HTML code bloat, you'll also have some accompanying CSS embedded in your <head></head> along with being dispersed throughout the document. What a mess that stuff creates.

That's why we like plain <textarea>s for editing. Teach the authors to use basic HTML and minimize all the code bloat that the WYSIWYG Editors are going to create from this whole cut and paste routine. Either that, or strip away all the bells and whistles and tell them they CANNOT perform any cut and paste routines without first going through a program like Notepad or something similar. All that embedded HTML needs to get stripped and there really is only one sure fire way to do it.

Notepad

The default system Notepad is just fine, I use Notepad++. All these bells and whistles get people into trouble, don't they? :)

 


 


 


 

Status: 403 Forbidden