473,473 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

html in database

hello,

i'd like to store text in an database and generate html files with the text
stored in the database. i use dom to generate an xml file and render it
using xsl. i use the following code to render the xsl file.

XmlTextWriter output = new XmlTextWriter("myHtmlFile.html",
System.Text.Encoding.Default);

XmlUrlResolver resolver = new XmlUrlResolver();

XMLGenerator gen = new XMLGenerator();

XmlDocument doc = gen.getObjectAsXML();

XslTransform transformer = new XslTransform();

transformer.Load("myStylesheet.xsl");

transformer.Transform(doc.CreateNavigator(), null, output, resolver);

output.Close();

My Problem is that when i have an text like <b>jochen</b> in the database
its rendered like it is and not like i want.

i've read a lot in the newsgroups about this, but nothing works.

Thanks for your help.

greets jochen
Nov 12 '05 #1
8 1811
Jochen Stuempfig wrote:
My Problem is that when i have an text like <b>jochen</b> in the database
its rendered like it is and not like i want.


Most likely your XMLGenerator generates this as text not as XML markup.
So it's rendered as text onviously. I don't see nothing wrong with it.
If you do want it to be markup, make it markup in XMLGenerator.
Alternatively use disable-output-escaping feature in your XSLT
stylesheet, but beware it doesn't always work.

--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #2
Sorry for the stupid question, but how can i markup the xml in my generator?

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> schrieb im
Newsbeitrag news:ui**************@TK2MSFTNGP09.phx.gbl...
Jochen Stuempfig wrote:
My Problem is that when i have an text like <b>jochen</b> in the database its rendered like it is and not like i want.


Most likely your XMLGenerator generates this as text not as XML markup.
So it's rendered as text onviously. I don't see nothing wrong with it.
If you do want it to be markup, make it markup in XMLGenerator.
Alternatively use disable-output-escaping feature in your XSLT
stylesheet, but beware it doesn't always work.

--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com

Nov 12 '05 #3
Jochen Stuempfig wrote:
Sorry for the stupid question, but how can i markup the xml in my generator?


Well, I didn't see your XML generator. How do you generate XML?
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #4
Oleg is asking how you generated the text in the database? From an XML DOM
based method or just created the string yourself? Either way, if the stuff
in the database *is* XML then the <b> might be stored as escaped text as
opposed to an actual XML element in which case it *will* appear in your
resultant transform as just text.

Chris.

"Jochen Stuempfig" <jo**************@skillworks.de> wrote in message
news:c1*************@ID-120572.news.uni-berlin.de...
Sorry for the stupid question, but how can i markup the xml in my generator?

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> schrieb im
Newsbeitrag news:ui**************@TK2MSFTNGP09.phx.gbl...
Jochen Stuempfig wrote:
My Problem is that when i have an text like <b>jochen</b> in the database its rendered like it is and not like i want.


Most likely your XMLGenerator generates this as text not as XML markup.
So it's rendered as text onviously. I don't see nothing wrong with it.
If you do want it to be markup, make it markup in XMLGenerator.
Alternatively use disable-output-escaping feature in your XSLT
stylesheet, but beware it doesn't always work.

--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com


Nov 12 '05 #5
Ok here my code where i generate my xml data from an object.

XmlDocument doc = new XmlDocument();

XmlElement rootElement = doc.CreateElement("rootElement");

XmlAttribute attribNumber = doc.CreateAttribute("number");

attribNumber.Value = rootNumber;

rootElement.Attributes.Append(attribNumber);

foreach(ChildNode child in obj.ChildNodes)

{

XmlElement subElem = doc.CreateElement("child");

//this text contains some html tags eq. <b>jochen</b>

string text = sub._subsectionText;

subElem.AppendChild(doc.CreateTextNode(text));

rootElement.AppendChild(subElem);

}

doc.AppendChild(rootElement);

Thanks for your help,

jochen

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> schrieb im
Newsbeitrag news:%2****************@TK2MSFTNGP10.phx.gbl...
Jochen Stuempfig wrote:
Sorry for the stupid question, but how can i markup the xml in my
generator?
Well, I didn't see your XML generator. How do you generate XML?
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com

Nov 12 '05 #6
Jochen Stuempfig wrote:
//this text contains some html tags eq. <b>jochen</b>

string text = sub._subsectionText;

subElem.AppendChild(doc.CreateTextNode(text));


Well, you are storing it as text, so it's displayed as text.
You are sure it's wellformed html (all tags closed and properly nested,
no html entities etc), you can set it to subElem.InnerXml property.
But most likely it won't be wellformed, so use disable-output-escaping
in XSLT then.
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #7
ok, i used the innerxml attribute to set the text. But it doesn't work
either.
I checked out now, that when i use xmlspy to transform the xml file it
works.
when i remove the disable-output-escaping attribute i have the same result
as in my application.
it seems, that the transformation in my application ignores the
disable-output-escaping.

greets jochen
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> schrieb im
Newsbeitrag news:Oj**************@TK2MSFTNGP10.phx.gbl...
Jochen Stuempfig wrote:
//this text contains some html tags eq. <b>jochen</b>

string text = sub._subsectionText;

subElem.AppendChild(doc.CreateTextNode(text));


Well, you are storing it as text, so it's displayed as text.
You are sure it's wellformed html (all tags closed and properly nested,
no html entities etc), you can set it to subElem.InnerXml property.
But most likely it won't be wellformed, so use disable-output-escaping
in XSLT then.
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com

Nov 12 '05 #8
Hello,

i solved my last problem by reading other ng entries form you olek. from now
it works.
thank your very much for your guidance.

greets jochen
"Jochen Stuempfig" <jo**************@skillworks.de> schrieb im Newsbeitrag
news:c1*************@ID-120572.news.uni-berlin.de...
ok, i used the innerxml attribute to set the text. But it doesn't work
either.
I checked out now, that when i use xmlspy to transform the xml file it
works.
when i remove the disable-output-escaping attribute i have the same result
as in my application.
it seems, that the transformation in my application ignores the
disable-output-escaping.

greets jochen
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> schrieb im
Newsbeitrag news:Oj**************@TK2MSFTNGP10.phx.gbl...
Jochen Stuempfig wrote:
//this text contains some html tags eq. <b>jochen</b>

string text = sub._subsectionText;

subElem.AppendChild(doc.CreateTextNode(text));


Well, you are storing it as text, so it's displayed as text.
You are sure it's wellformed html (all tags closed and properly nested,
no html entities etc), you can set it to subElem.InnerXml property.
But most likely it won't be wellformed, so use disable-output-escaping
in XSLT then.
--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com


Nov 12 '05 #9

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

Similar topics

2
by: Squirrel | last post by:
Given the following piece of code, I was looking for suggestions on how to beautify the portion of the HTML where I jump out of php mode and back in again. The HTML does not have any indenting in...
4
by: jason | last post by:
I would appreciate some help on how to convert a database table into an html file via FSO and whether more seasoned asp programmers recommned this route. The main reason I am attempting to do this...
4
by: Fergus O'Shea | last post by:
I have some text that appears in a Database. This text includes HTML(e.g. <br> tags). I also have a Webpage that makes an XML call to that database. But when the text is displayed on the page,...
2
by: ViperDK | last post by:
What is the best way for that? I store all Data in the original form in the Database. To prevent output fields (especially the fields everyone can use) to do bad things like killing the...
20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
3
by: fjm67 | last post by:
I am new to PHP but not so new to Postgres. If someone can either direct me to some howto or even provide me with an example, I would be grateful. I would like to know if it is possible to...
2
by: Giedrius | last post by:
hi, i have an idea to make admin tool on home computer, that would generate html files using some kind of templates and database data and put these generated html files to public web server, witch...
14
by: jcage | last post by:
Is there any tutorials online for sending email through forms? I can send an email as well as write to my MySQL database from home with the following code but not at work. I think there might be...
18
by: agarwalsrushti | last post by:
Hi, Ive created a form in html and written code in hp tht takes data feom html and stores it in MySQL database. Bt wen i click on the submit button i get an error. Instead of storing it in database...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
0
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,...
1
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...
0
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.