Displaying XHTML elements with namespaces in .NET WebBrowser control

odziezowka7BB7

New Member
I have an XML document that contains in one element XHTML fragments, specifically one or more p tags, which can contain further XHTML tags such as em, span etc. These are all in an "xhtml" namespace, and the XSD has imported the XHTML strict schema, so all is fine in that regard. My problem is this: My application needs to display these XHTML paragraphs as a document. My thought was to wrap these in an XHTML document with a namespace specified on the body tag, like this:\[code\]<!-- Stock XHTML pre-amble from application --><html><head> <meta http-equiv="content-type" content="application/xhtml+xml;charset=utf-16" /></head><body xmlns:xhtml="http://www.w3.org/1999/xhtml"> <!-- Elements from XML document --> <xhtml:p>Namespaced paragraph from XML</xhtml:p> <xhtml:p>A partly <xhtml:em>italicised</xhtml:em> paragraph from XML</xhtml:p><!-- Post-amble --></body> </html>\[/code\]This way, I wouldn't have to remove all namespaces from the XHTML elements when putting the document together.While this displays correctly in Firefox, if I save it as a file, in the System.Windows.Forms.WebBrowser control (.NET 3.0), the two paragraphs flow together and the em is ignored (the same thing occurs in IE8). In other words, the WebBrowser doesn't unserstand the namespace, and treats xhtml:p as an unknown element.I'm curious from a purely academic point of view whether Firefox or IE8 is in the right here, but am more interested in a pragmatic solution to this problem, if one exists.
 
Back
Top