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 


0
11/1/2006 7:41:20 PM
dotnet.xml 7266 articles. 0 followers. Follow

3 Replies
316 Views

Similar Articles

[PageSpeed] 2

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 
> 
> 
> 
0
pfalcon64 (2)
11/2/2006 3:00:50 PM
> 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 


0
11/3/2006 2:24:45 PM
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 
> 
> 
> 

0
pfalcon64 (2)
11/9/2006 3:01:47 PM
Reply:

Similar Artilces:

Recovering Private information store
I had a problem with the Private information store and restored an earlier version from a hard drive backup. I did all the procedures necessary to restore and enable the information store and all my Exchange 5.5 services are started without any error. The problem however is that I am not getting any mail to my users. I run a POP3 connector and I use the viewer to check the POP3 activities. I see the the connection to the mail server and the acknowledgements that it is retrieving E-Mail messages. I cannot figure out where the messages are going on aour server and why are they not bei...

How to open RecordSet with Stored Procedures (ODBC, VC++)
Hi I'm using ODBC and VC++. My stored procedure has parameters like @pstr VarChar(100), @pVal1 numeric(9), @pVal2 numeric(9) and it returns a recordset. In my code CString strSP; strSP.Format("{call MySp('%s','%d','%d')}", str1, (long)Val1, (long)Val2); CMyRecorSet rs(m_db); try { rs.Open(CRecordset::snapshot,strSP); } catch(CDBException * pDB) { } I'm getting exception. Cannot covert datatype varchar to numeric. Why is this happening? Do i need to call SQLBindParameters? If yes, how to call it. Any sample code? Thanks in advance. Remove the apos...

Form design to add data to 3 tables in "Order Entry" style db
Sorry if this is a duplicate. I thought I posted it yesterday but couldn't find it today... I need help figuring out the best way to design a form for data entry in the "Order Entry" style, adding data to three related tables. For clarity I have eliminated several fields. Here are the three tables, plus the fourth that is a reference table: tblCustomers: CustID (pk), CustName tblOrders: OrderID (pk), OrderDate, CustID (fk) tblOrderProd: OrderProdID (pk), OrderID (fk), ProdID (fk) tblProducts: ProdID (pk), ProdName Each Customer is associated with one or mo...

Extracting Calendar appointments from Exchange DB
Where do I start?! vb script? odbc? SQL Server Query Analyzer? Thanks Jimbo wrote: > Where do I start?! > > vb script? odbc? SQL Server Query Analyzer? > > Thanks Exchange SDK, CDO Once you understand the different methods for getting to what you are looking for, then you can decide what method (vbscript, C++, etc.) "Douglas Buchanan [MVP]" <dbuchanan@d2removethisltd.com> wrote in news:uANXB5z6DHA.2712@tk2msftngp13.phx.gbl: > Jimbo wrote: > >> Where do I start?! >> >> vb script? odbc? SQL Server Query Analyzer? >> &g...

Receipt
Does anyone know whether it's possible to use a string as part of the conditional expression ? The code I'm trying to use is : <IF> <CONDITION> Entry.Item.ItemLookupCode = "GV" </CONDITION> <THEN>"XYZ"</THEN> <ELSE>"123"</ELSE> </IF> It's working fine if I replace the "GV" with a number, but always hits the ELSE expression when it's a string. I've also tried using a string variable here, which also fails. tnx TJ Nope, no string comparisons. -- -- Glenn Adams Tiber Creek Cons...

Saving/Loading Xml to/from an Xml file
Hi I have a function called GetXml that returns Xml as expected. I then use: Dim saveFile As New SaveFileDialog and the configure saveFile. Having got the file and the Xml, how can I then write the Xml to the file? Also, how could I load the Xml back in to a string using an OpenFileDialog (openFile) or similar? Regards, Carl Gilbert "Carl Gilbert" <cnl@newsgroup.nospam> wrote in message news:OHk4WC5qEHA.628@TK2MSFTNGP09.phx.gbl... > Having got the file and the Xml, how can I then write the Xml to the file? Dim writer As System.IO.StreamWriter writer = ...

XML Security
I have posted this on ASP security to no avail. I have a web app written in c#. This app dynamically creates an Xsl doc from user defined info in the database. It also creates an instance of another c# class. This object gets passed into the Xsl doc as a parameter, and it is called from within the stylesheet to perform various functions during transformation. This object also uses some gdi32 and other unmanaged code. The I am seeing is that various exceptions (SecurityException, namely) are thrown from the component any time these methods are called. I have tried granting FullTru...

Identifying all Namespace / Prefixes when reading an XML
How do I identify all of the namespace / prefix pairs associated with an XML document I am reading? Thanks for any help. Paul PaulF wrote: > How do I identify all of the namespace / prefix pairs associated with an XML > document I am reading? XPath has a namespace axis you could have your code walk. It depends on how you read your XML document, with Xml(Text)Reader you do not have XPath support. With XPathDocument or XmlDocument you do. XPath expression is //namespace::* or (with duplicates removed) //namespace::*[not(. = ../../namespace::*] Note that the prefix xml is a...

Retrieving default values specified from XML Schema file
Hi All, I have an VS.NET 2003 app which will be processing XML files, some of which will have empty elements (for example, <Item />). I have an XSD file which should supply default values, but I am not able to read these plugged in value using an XMLDocument object. The validation is working fine--it's just not providing any default values. Has anybody tried this? Am I must be missing something? This is one of those that "should be simple..." Here's a simplifed version of the code and XML files: XmlDocument xmldoc = new XmlDocument(); XmlSchemaCollection my...

html mail in crm 3.0 workflow manager
In CRM 1.2 it possible to create nice mail templates with html code simple in frontpage with the usage of field values. Does anybody have a idea how to build html mail templates with flied values, so that i can copy the html in the workflow "create mail" like in crm 1.2??? when i use the same field values like in the workflow manager in my html code, the field ist not displayed in the html mail. Give this a try. </pre> Your html code .... <pre> ...

XML
I can not locate XML on my Data menu for Excel. I checked to see if it was an add-on but it's not. You don't say which version and edition of Excel you are running. From Excel 2003 help. Note XML features, except for saving files in the XML Spreadsheet format, are available only in Microsoft Office Professional Edition 2003 and Microsoft Office Excel 2003. Excel 2007 has XML support also. Gord Dibben MS Excel MVP On Tue, 24 Jul 2007 10:08:03 -0700, emi <emi@discussions.microsoft.com> wrote: >I can not locate XML on my Data menu for Excel. I checked to see if it wa...

ASP.NET Caching XML
In the world of MSXML 4.0 - one of the techniques used was caching the DomDocument in the application cache with ASP. Updates made to individual nodes could occur concurrently. Is this still possible in .NET? Or is the a better design to use. Paul Jansz wrote: > In the world of MSXML 4.0 - one of the techniques used was caching the > DomDocument in the application cache with ASP. > Updates made to individual nodes could occur concurrently. > > Is this still possible in .NET? Or is the a better design to use. I believe the same goes for System.Xml.XmlDocument class of .NE...

How to use relative file:// protocol in html resource used by CDHTMLDialog?
Howdy, I'm writing a C++ CDHTMLDialog based application in VS .net. Of course I have an HTML resource that contains the html code for display by CDHTMLDialog (which wraps the Webrowser control). I understand how to reference program resources in my HTML using the res: protocol, but I'm having trouble getting the file: protocol to work with relative references. For example, if my embedded HTML resource includes this absolute path in my htmlcode it works fine: < IMG src="file:///C:\Documents and Settings\jim\My Documents\temp\CHtmlApp\Debug\ugly2.bmp" > But if I pu...

Suggestions On Storing External Data
Hello, I was wondering what the best way to store, Word, Excel, pdf,and dwg documents against a Record in my database. My Database is a Enquiry Management Database, and when projects come in they are logged, which when an enquiry is received they have associated documents with them. So what the plan is that the User who inputs projects can select the assign the associated to the record, and then when some else looks up the project that can see all related documents and also open them from my database. 1. Do i Store External Documents in the database or 2, Do I Link to the documents, I w...

html in Contact \ Notes possible?
I copied html information from a web page and pasted it into the Notes field of a Contact. It looked exactly the same until I saved it and returned to have a look, the html formatting reverted to tich text (or simple plain text?). Is it possible for me to paste html material into Notes and have it stick? Thanks, DH It's supported in Outlook 2007. -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downloads, Add-Ins and more http://www.msoutlook.info/ Real World Questions, Real World Answers ----- &...

Modify Store ID
I want to change the Store Id. I have changed it throurg database (Store Table) in HQ and Store both side but after changing it stops communicating with HQ. Some having any idea? Thanks Check Configuration Table at Store. Ivan "NAVEED" <NAVEED@discussions.microsoft.com> wrote in message news:C81FDAAE-25CD-49DB-A945-17FDC8D9F906@microsoft.com... >I want to change the Store Id. > I have changed it throurg database (Store Table) in HQ and Store both side > but after changing it stops communicating with HQ. > > Some having any idea? > > Thanks If yo...

Blank text in HTML emails
We are getting a blank text in the body for HTML email on Outlook 2003 on XP Pro SP2 with Win2003 Server and Exchange Server 6.5. The Internet email server is hosted by our ISP and not our Exchange Server. This is occurring on only one client, other clients on the same network using Outlook 2003 have no problems. All my Outlook options were matched against another computer’s Outlook that works. The View > Encoding is set for Western European. If I use a web email program to read on the Internet HTML email and save it, my Outlook will retrieve the email ok. As an experiment, I setup ...

xml within xml?
Hi all, I wish to embed an xml document within an element of another xml document. If I enclose the child xml within a CDATA section will the DOM not parse the child xml? What is the best way to do this? Additionally what should the parent element be defined as in the xsd? I noticed xs:anytype throws an error when validating the final xml doc. TIA, RP RP wrote: > Hi all, I wish to embed an xml document within an element of another xml > document. If I enclose the child xml within a CDATA section will the DOM not > parse the child xml? What is the best way to do this? Additionally...

Please help!!! Information Store and System Attendant does not start
Hello Everyone, I have a couple of questions. Friday my exchange 2k box crashed on the windows side. I have put the exchange hard drives in a new pc. I repaired the drive by running the windows repair and bascially had to almost install windows again. However, it comes back up at win2k sp3. I reran the exchange sp3 patch on the server. All my drives look good. However, the information store and exchange system attendant will not start. I was wondering if anyone can give me advice on why this is happening? Also on a side note I can not remote desktop into this pc which is weird? I can ping...

Merge 2 xml file
Hi Here is my question : I need to merge 2 XML configuration file for a dotnet 1.1 application. for exemple : if file A is : <add key=k1 value=1111> <add key=k2 value=2222> and then file B is : <add key=k1 value="hello"> <add key=k3 value=3333> A & B merged is now : <add key=k1 value="hello"> <add key=k2 value=2222> <add key=k3 value=3333> It understand that it concerns appsettings section, of course. But I want to do the same with all the sections!!!!! so is there a way to do that? Any help will be greatly appreciate!...

XML Serializer Collection Example
I have been trying everything I can find to add a collection to a class that will be run through the XML Serializer, and am coming up with nothing THAT WORKS. Can anyone help point me in the right direction? I imagine it would go something like this, but I can't put all the pieces together to actually make it work.... See the code lines with XXXXX below.... What should the XXXXX's be? What else would be required to do to use XXXXX? VB.NET SAMPLE CODE: ========================== Public Class clsPerson Public FirstName As String Public LastName As String Public SSN As Stri...

Xml serialization and late binding (interfaces)
Trying to get business objects to work as return values for web= services=2E The primary problem is that the business objects are= late bound, requiring interfaces for property types=2E I try= using the XmlTypeAttribute to indicate the class to use in place= of the interface, but that doesn't seem to do any good=2E Here's the simplified objects in question: =09[System=2EXml=2ESerialization=2EXmlType(= "Hansen=2EWebServiceProxies=2EResources=2EAddress" )] =09public interface IAddress =09{ =09=09int AddressKey {get;set;} =09} =09public class Address : IAddress =09{ =0...

xml and xml schema
Hi! Here I have a method that serialize a DataSet to a file by using xml. private void SerializeDataSet(string filename) { XmlSerializer ser = new XmlSerializer(typeof(DataSet)); DataSet ds = new DataSet("myDataSet"); DataTable dt = new DataTable("myTable"); DataColumn dc = new DataColumn("thing"); dt.Columns.Add(dc); //add DataColumn to DataTable ds.Tables.Add(dt); DataRow row; for (int i = 0; i < 10; i++) { row = dt.NewRow(); row[0]...

Validate XML Schema
Can anyone point me to some code or tell me a simple way to validate a UK postcode (or email address or another simple example) ? I have the Schema set up already. Now I just want to write some validation (in VB.Net or C#)code to trap for this error. <xs:element name="PostCode"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="([A-Z]{1,2}[0-9]{1,2}|[A-Z]{3}|[A-Z]{1,2}[0-9][A-Z])( |-)[0-9][A-Z]{2}" /> </xs:restriction> </xs:simpleType> </xs:element> a...

OWA and XML Blocking: Looking for a technical rationale
XML attachments are blocked from even being downloaded on OWA with Exchange sp1 (no problem with the full Outlook client). I can't seem to find the technical rationale for the blocking of these files listed anywhere. Does anyone no where a document describing the rationale might be found ? Antigen or other virus scanners don't suggest blocking them either, so I'm curious as to why only in OWA. -- Duane Doucette This was identified as a known issue in SP1 so there probably isn't a technical reason. http://www.microsoft.com/technet/prodtechnol/exchange/2003/library/...