I have been using the .NET WebBrowser control in edit mode as part of an interface for end users to create sections of HTML content for insertion into various websites. They have had a very cutdown list of tags available such as <p>, <br>, <a href>, <strong>, <ul> <li>...
they could not apply any formatting on top of the tags as that was determined by the particular web pages css. This system has been working well up until now.
Unfortunately I now have a need for xhtml to go into a larger xml document for aggregation purposes by various other websites. The WebBrowsers main problem seems to be lists where it produces:
<UL><LI>Item1
<LI>item2
<LI>item3</LI></UL>
Is there a good converter library to fix this or could I fo开发者_JAVA百科rce the WebBrowser control to create XHTML? I have tried the HTMLAgilityPack but it converted to XHTML by doing something like:
<UL><LI>Item1
<LI>item2
<LI>item3</LI></LI></LI></UL>
I don't think his is appropriately set as surely the tags should be at the end of each item although it would pass xhtml validation. If it is ok, will I end up with rendering issues on certain browsers when the XML is eventually put into whatever website?
Try this. http://tidy.sourceforge.net/
You must be using Internet Explorer, which is the only browser I can think of that doesn't close list-item tags in a content-editable section. Also, the tags ought to be lower case, which is the other give-away.
It is worth checking that you are sending the correct document-type to the browser as this may solve your problem (i.e. make sure the editable bit is definitely an XHTML page). Other than this, you could manage it by having a plain-text editable area with some custom(ish) mark-up and a preview area below. Erm... a bit like Stack Overflow. That way, you can create the exact mark-up you want, rather than relying on what a browser generates.
精彩评论