473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How/where to store my encoded HTML? In DB? In XML?

We have a parent-child table set up to maintain content.

When this table is updated, I do a recursive call through the data and spit
out an XML file.

Then, when we want to display this content, I load up the XML file, attach
the XSL file to it, and do the transformation via VB.net and send it off to
the browser.

The problem is that much of this content is HTML. As such, I'm storing it in
the database as encoded HTML. I'm confused as to when/where I should decode
it.

For starters, I just grabbed the raw data from the DB, spit out the XML, and
then in my XSL file, added a few wrapper HTML tags and dumped it to screen.

This does not work, as I'm combining encoded HTML in the XML file with
regular HTML in my XSL. This is messy, to say the least.

My second thought is to unencode the HTML before putting it into the XML
file, but I have no idea how to do that without invalidating the XML file.

Third thought was to write encoded HTML in my XSL file instead of regular
HTML and then, just prior to rendering it to screen, then unencode the
entire thing. But that makes for a less readable XSL file and doesn't seem
quite right either.

I'm stumped. Any thoughts/suggestions?

-Darrel
Nov 1 '06 #1
3 1826
I've been creating my XSLT files to do all the heavy lifting - they
contain the encoded HTML and perform the necessary parsing of the XML to
produce the final product. Howewver I must say that this code does not
drive a website so the size of the XSLT isn't an issue - I use it for
fancy exporting from a normal PC database system.

Yeah, the more complex a web page you want to produce, the more complex
the XSLT file - but this isn't the fault of the XSL process - just that
you needed something complex. In this case I recommend you just use lots
of comments <g>.

You can make a great difference by optimising your HTML first - make
sure you are using predefined CSS styles for all style/formatting, a
separate CSS file, and perhaps only encode the exact part of a page you
need - using framesets and other techniques to minimise repetition.

Finally - a good XML/XSL editor does help a lot. You could also try
investigating one of the products like XML SPY to see if they asist in
generating the code inthe first place.
We have a parent-child table set up to maintain content.

When this table is updated, I do a recursive call through the data and spit
out an XML file.

Then, when we want to display this content, I load up the XML file, attach
the XSL file to it, and do the transformation via VB.net and send it off to
the browser.

The problem is that much of this content is HTML. As such, I'm storing it in
the database as encoded HTML. I'm confused as to when/where I should decode
it.

For starters, I just grabbed the raw data from the DB, spit out the XML, and
then in my XSL file, added a few wrapper HTML tags and dumped it to screen.

This does not work, as I'm combining encoded HTML in the XML file with
regular HTML in my XSL. This is messy, to say the least.

My second thought is to unencode the HTML before putting it into the XML
file, but I have no idea how to do that without invalidating the XML file.

Third thought was to write encoded HTML in my XSL file instead of regular
HTML and then, just prior to rendering it to screen, then unencode the
entire thing. But that makes for a less readable XSL file and doesn't seem
quite right either.

I'm stumped. Any thoughts/suggestions?

-Darrel
Nov 2 '06 #2
Finally - a good XML/XSL editor does help a lot. You could also try
investigating one of the products like XML SPY to see if they asist in
generating the code inthe first place.
I appreciate the reply, but it doesn't really answer my specific question.
If you need HTML, where should it live? Encoded in the DB only? Encoded in
the XML file? If encoded in the XML file, can I decode it coming out?

-Darrel
Nov 3 '06 #3
Darrel,

The HTML sits in the XSLT file - mixed in with the XSL instructions (or
rather, specified as the tags that are generated from the XML source).
The only trick is that you need to code proper XHTML so it doesn't cause
XML errors. Thus if you need different output, you simply swap XSL files
(for any given XML dataset)
Finally - a good XML/XSL editor does help a lot. You could also try
investigating one of the products like XML SPY to see if they asist in
generating the code inthe first place.

I appreciate the reply, but it doesn't really answer my specific question.
If you need HTML, where should it live? Encoded in the DB only? Encoded in
the XML file? If encoded in the XML file, can I decode it coming out?

-Darrel
Nov 9 '06 #4

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

Similar topics

0
by: Matthew Simoneau | last post by:
I'm trying to figure out how to HTML encode shift_jis text and put it into an attribute. Starting with this XML-file with characters encoded in shift_jis <?xml version="1.0"...
3
by: Supratim | last post by:
Hi, For past few weeks I am working on a function that would take encoded Unicode characters from query string of http requests and then decode them back to Unicode numbers. I have full success...
6
by: Chris Fink | last post by:
I have an xml document that contains some elements encoded as Base64. How do I dynamically scan the XML Document and pull out the sections that are Base64... My overall goal is to display the...
3
by: Darren Clark | last post by:
Basically i am curious as to where everyone stores there database details for ASP.NET apps? When developing controls i usually stored it in the web.config file. Then i move it to a internal...
7
by: kashaziz | last post by:
Hello, I am here after head-banging with this issue for several days. I am trying to parse a feed using JS and have stucked on the <content:encoded> tag. I have tried getElementsbyTagName but...
4
by: micahc | last post by:
I currently have a Python program that reads in emails from a POP3 server. As soon as the message is read in it is fed directly into a PostgreSQL database for storage. Later, it is broken down...
2
by: Taras_96 | last post by:
Hi everyone, I've been told that PHP strings are null terminated. If PHP strings are in fact null terminated, I'm a bit puzzled how the following code can work: $filename = 'ucs2_file.txt';...
3
by: Alfred | last post by:
I want to post text field data from these HTML TEXTAREA tags to a PostgreSQL database and have it reappear back on another page exactly as I had typed it. Over the years I have done this but only...
3
by: yeah1279 | last post by:
I recently changed our web pages to be utf-8 encoded (server response header content type is also set to utf-8). There are some links to external sites within the pages that pass parameters that can...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.