473,698 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ensuring html is valid before storing it

Hi guys,

Sorry for the cross-post but I got no response in the asp.net newsgroup.

I am trying to develop a mini e-learning application where the user provides
content for each page. Eventually, I'd like to shift to using templates but
at the moment the users is just entering content using html. Whats the best
way to allow the user to do this and whats the best way of ensuring the html
is valid before I store it in my database / xml document?

Cheers,

Peter Hardy
Nov 12 '05 #1
3 1552
The best way (and user-friendly too!) is to provide the user with an HTML
editor.

HTML is very lax and so everything goes. If you insist on users entering
markup, you may want to user XHTML 1.1 instead of HTML and validate the
input against
http://www.w3.org/TR/2001/PR-xhtml11...#a_xhtml11_dtd

Hope this helps,
Mujtaba.

"Peter Hardy" <pe**@nospam.co m> wrote in message
news:uS******** ******@TK2MSFTN GP15.phx.gbl...
Hi guys,

Sorry for the cross-post but I got no response in the asp.net newsgroup.

I am trying to develop a mini e-learning application where the user provides content for each page. Eventually, I'd like to shift to using templates but at the moment the users is just entering content using html. Whats the best way to allow the user to do this and whats the best way of ensuring the html is valid before I store it in my database / xml document?

Cheers,

Peter Hardy

Nov 12 '05 #2
If the HTML that's imput is simple enough then you can write code to
walk the HTML DOM with Chris Lovett's SgmlReader [0]. That class will
also perform HTML to XHTML conversion [1].

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko
[0]
http://www.gotdotnet.com/Community/U...x?SampleGuid=B
90FDDCE-E60D-43F8-A5C4-C3BD760564BC
[1] http://eggheadcafe.com/articles/20030317.asp
-----Original Message-----
From: Peter Hardy [mailto:pe**@nos pam.com]
Posted At: Thursday, December 30, 2004 12:28 PM
Posted To: microsoft.publi c.dotnet.xml
Conversation: ensuring html is valid before storing it
Subject: ensuring html is valid before storing it

Hi guys,

Sorry for the cross-post but I got no response in the asp.net newsgroup.
I am trying to develop a mini e-learning application where the user
provides
content for each page. Eventually, I'd like to shift to using templates but
at the moment the users is just entering content using html. Whats the
best
way to allow the user to do this and whats the best way of ensuring the html
is valid before I store it in my database / xml document?

Cheers,

Peter Hardy

Nov 12 '05 #3
Thanks for the advice guys. I bit the bullet in the end and bought the R.A.D
Editoe component whch allows users to create Xhtml. It's a very impressive
component and certainly worth a look.

Peter

"Christoph Schittko [MVP]" <IN**********@a ustin.rr.com> wrote in message
news:#3******** ******@TK2MSFTN GP09.phx.gbl...
If the HTML that's imput is simple enough then you can write code to
walk the HTML DOM with Chris Lovett's SgmlReader [0]. That class will
also perform HTML to XHTML conversion [1].

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko
[0]
http://www.gotdotnet.com/Community/U...x?SampleGuid=B
90FDDCE-E60D-43F8-A5C4-C3BD760564BC
[1] http://eggheadcafe.com/articles/20030317.asp
-----Original Message-----
From: Peter Hardy [mailto:pe**@nos pam.com]
Posted At: Thursday, December 30, 2004 12:28 PM
Posted To: microsoft.publi c.dotnet.xml
Conversation: ensuring html is valid before storing it
Subject: ensuring html is valid before storing it

Hi guys,

Sorry for the cross-post but I got no response in the asp.net

newsgroup.

I am trying to develop a mini e-learning application where the user
provides
content for each page. Eventually, I'd like to shift to using

templates
but
at the moment the users is just entering content using html. Whats the
best
way to allow the user to do this and whats the best way of ensuring

the
html
is valid before I store it in my database / xml document?

Cheers,

Peter Hardy


Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2928
by: Jayme Assuncao Casimiro | last post by:
I am witing a wrapper to extract data from werb sites. I am storing the data in xml format. But it doesn't produce valid xml because of html codes like the above - typical of latin languages. &aacute; &atilde; &oacute; &ouml; &eacute; What Would I do to overcome this problem?
3
1324
by: Lance | last post by:
I have quite an odd question. Usually I ask whenever javascript is not acting the way I'd expect. This time I'm trying to figure out why something works when I don't think it should be working! I'm working on a web page that has a <div> area for dynamic content display (id='content'). In between the </body> and </html> tags is where I'm storing the text to be displayed when needed. They are stored inside wrapper <div>s which are...
13
9627
by: Kieran | last post by:
I am designing a content management system and I want to make sure all pages entered into it's database by users are using valid HTML. I have designed the system to use HTML 4.01 Transitional throughout, however the php powered html checker I have only caters for HTML 4.01 Strict. If possible I need to know the complete differences between Strict and Transitional so I can go through the php script and correctly set it up to properly...
32
2145
by: Ed Jay | last post by:
A complete js newbie is asking this question: I have a form comprised of several questions, each answered with a radio button. I'd like to use onClick to bring up additional text at the end of the form (not in a text box). I've tried using document.write("yada"), but it clears the page before showing the text. How can I do it? BTW, I'm currently using js in conjunction with CSS to unhide the text. This works fine, except it requires...
0
836
by: Peter Hardy | last post by:
Hi guys, I am trying to develop a mini e-learning application where the user provides content for each page. Eventually, I'd like to shift to using templates but at the moment the users is just entering content using html. Whats the best way to allow the user to do this and whats the best way of ensuring the html is valid before I store it in my database / xml document? Cheers,
20
2570
by: Alan Silver | last post by:
Hello, I have read about the problems that IE has when using a doctype of HTML 4.01 Transitional. I was advised to use Strict wherever possible. My question is, does the same apply to XHTML 1.0 Transitional? I develop sites using ASP.NET, which emits valid XHTML 1.0 Transitional, but not XHTML 1.0 Strict (for example, it includes a hidden form field with the name of _VIEWSTATE, which isn't valid in Strict, but is in Transitional).
1
1701
by: Chris Curvey | last post by:
Hey all, I'm trying to write something that will "fail fast" if one of my users gives me non-latin-1 characters. So I tried this: u'\x80' I would have thought that that should have raised an error, because \x80 is not a valid character in latin-1 (according to what I can find). Is this the expected behavior, or am I missing something?
4
1439
by: Simon Harris | last post by:
Hi All, I am trying to store an HTML string within an XML node, using: Node.InnerText = strContent Problem is, the HTML ends up like this, when its in the XML: <TextArea1>&amp;lt;b&amp;gt;me&amp;lt;/b&amp;gt;</TextArea1> Any help will be much appreciated.
4
1224
by: =?Utf-8?B?Z3V5?= | last post by:
Is this a valid approach to State Management? What I do is define a class 'State' which holds all the objects etc. that I need to store in the Session. I can then get my state object and reference all the objects that I need . Later I can then save my state object back for use later. This makes coding much simpler than storing individual items in the session state but is there a performance hit for working this way?
0
8671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9152
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8856
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4613
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2321
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.