homepage Welcome to WebmasterWorld Guest from 54.237.99.131
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
<o:p> tags
hhmmm very strange
dannibecher

5+ Year Member



 
Msg#: 3850841 posted 7:11 pm on Feb 16, 2009 (gmt 0)

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

WebmasterWorld Senior Member swa66 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3850841 posted 7:46 pm on Feb 16, 2009 (gmt 0)

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

choster

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3850841 posted 11:17 pm on Feb 16, 2009 (gmt 0)

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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3850841 posted 1:58 am on Feb 17, 2009 (gmt 0)

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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3850841 posted 3:15 am on Feb 17, 2009 (gmt 0)

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

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3850841 posted 6:07 pm on Feb 17, 2009 (gmt 0)

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

WebmasterWorld Senior Member pageoneresults us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3850841 posted 6:26 pm on Feb 17, 2009 (gmt 0)

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? :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved