tahirjadoon
asked on
ASP & XML Document
I have XML and XSL documents stored in SQL Server 2000 field. On the asp page i will be getting these documents from the database and then displaying the content of the XML document according to the XSL on the asp page.
How can i do this?
Also after getting the documents from the database do i need to store these on the server as .XML and .XSL and then read through these or i can directly read from these document without saving these physically.
How can i do this?
Also after getting the documents from the database do i need to store these on the server as .XML and .XSL and then read through these or i can directly read from these document without saving these physically.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
exactly like that ;)
ASKER
I have not tested this yet, as soon as i have tested it i'll post the result.
ASKER
Can i pass XML as string rather than storing the files physically. If yes, then can i do some thing like:
xmlContent = recordset.fields("XML").va lue
xslContent = recordset.fields("XSL").va lue
or i have to use here ado stream to read the files from the recordset
and then
set source = Server.CreateObject("Micro soft.XMLDO M")
source.async = false
source.loadXML(xmlContent)
set style = Server.CreateObject("Micro soft.XMLDO M")
style.async = false
style.load(xslContent)
Response.Write source.transformNode(style )
xmlContent = recordset.fields("XML").va
xslContent = recordset.fields("XSL").va
or i have to use here ado stream to read the files from the recordset
and then
set source = Server.CreateObject("Micro
source.async = false
source.loadXML(xmlContent)
set style = Server.CreateObject("Micro
style.async = false
style.load(xslContent)
Response.Write source.transformNode(style
I seem to remember reading that the XML can be passed as a string....I'll see if I can find the reference.
FtB
FtB
Have you tried just passing the strings from the database to these two lines?
sourceFile = Server.MapPath("DataConten t.xml")
styleFile = Server.MapPath("DataConten t.xsl")
i.e.,
sourceFile = objRS("strXML")
styleFile = objRS("strXSL")
FtiB
sourceFile = Server.MapPath("DataConten
styleFile = Server.MapPath("DataConten
i.e.,
sourceFile = objRS("strXML")
styleFile = objRS("strXSL")
FtiB
ASKER
I have checked it with the physical file and it works.
Have not checked it yet with passing the string directly from the recordset field.
Have not checked it yet with passing the string directly from the recordset field.
You can use strings stored in a database instead of files.
All you need to change is how you load the XML DOM.
Instead of using
source.load "<file name>"
use:
source.loadXML <string value from database>
All you need to change is how you load the XML DOM.
Instead of using
source.load "<file name>"
use:
source.loadXML <string value from database>
@deighc--
So what I said above will work, then?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
sourceFile = objRS("strXML")
styleFile = objRS("strXSL")
set source = Server.CreateObject("Micro soft.XMLDO M")
source.async = false
source.load(sourceFile)
set style = Server.CreateObject("Micro soft.XMLDO M")
style.async = false
style.load(styleFile)
Response.Write source.transformNode(style )
%>
or is it necessary to change:
source.load(sourceFile)
to:
source.loadXML(sourceFile)
So what I said above will work, then?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
sourceFile = objRS("strXML")
styleFile = objRS("strXSL")
set source = Server.CreateObject("Micro
source.async = false
source.load(sourceFile)
set style = Server.CreateObject("Micro
style.async = false
style.load(styleFile)
Response.Write source.transformNode(style
%>
or is it necessary to change:
source.load(sourceFile)
to:
source.loadXML(sourceFile)
ASKER
source.loadXML works
xmlContent = recordset.fields("XML").va lue
xslContent = recordset.fields("XSL").va lue
Thanks guys
xmlContent = recordset.fields("XML").va
xslContent = recordset.fields("XSL").va
Thanks guys
Glad to have helped,
FtB
FtB