|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
||||
|
||||
|
XML and ASP.NET
Does anyone have a snipet of how they are calling the xml parser in ASP.NET?
In classic asp i would have a sub something like: Code:
Sub processXML(s, st)
Const strMETHOD_NAME = "processXML()"
Dim source, stylesheet, xslt, xslDoc, strResult, xslProc, xmlDoc, xslTemplate
source = s
stylesheet = st
'create two instances of the Microsoft XML parser for header
On Error Resume Next
Set xmlDoc = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
Set xslDoc = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
Set xslTemplate = Server.CreateObject("Msxml2.XSLTemplate.3.0")
Set xslProc = Server.CreateObject("IXSLProcessor")
'load the XML document into one parser
xmlDoc.async = False
xmlDoc.resolveExternals = False
xmlDoc.Load source
'and check for a load error
If xmlDoc.parseError.errorCode <> 0 Then
Response.Write "<B>ERROR:</B> Cannot load and " _
& "parse the " & source & " XML Document.<br />" _
& xmlDoc.parseError.reason
Response.End
End If
'load the XSL stylesheet into the other parser
xslDoc.async = False
xslDoc.resolveExternals = False
xslDoc.Load stylesheet
If xslDoc.parseError.errorCode <> 0 Then
Response.Write "<B>ERROR:</B> Cannot load and " _
& "parse the XSL " & stylesheet & " Stylesheet.<br />" _
& xslDoc.parseError.reason
Response.End
End If
'loaded and parsed OK, so transform XML and output
Set xslTemplate.stylesheet = xslDoc
Set xslProc = xslTemplate.createProcessor()
xslProc.input = xmlDoc
xslProc.addParameter "discipline", Session("Discipline")
xslProc.addParameter "pagefile", strContentXML
xslProc.addParameter "resourceentryid", mstrResourceEntryId
xslProc.Transform
strResult = xslProc.output
Response.Write(strResult)
End Sub
__________________
mr... mike.rusaw@realpage.com RalPage, Inc. "I have made this letter longer than usual, only because I have not had the time to make it shorter." - Blaise Paschal |
|
#2
|
||||
|
||||
|
Well i fugured it out... here's my solution so far.
.vb: Code:
Imports System.Web.UI.WebControls
Public Class _default
Inherits System.Web.UI.Page
Protected WithEvents XmlHeader As Xml
Protected WithEvents XmlLeftNav As Xml
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
'Load header based on discipline
XmlHeader.DocumentSource = "xml/header.xml"
XmlHeader.TransformSource = "xslt/webheader.xsl"
End Sub
End Class
.aspx: Code:
<asp:Xml ID="XmlHeader" Runat="server"></asp:Xml> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XML and ASP.NET |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|