XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old July 29th, 2003, 09:26 AM
mrusaw's Avatar
mrusaw mrusaw is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Dallas, Texas
Posts: 138 mrusaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to mrusaw Send a message via Yahoo to mrusaw
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

Reply With Quote
  #2  
Old July 31st, 2003, 09:27 AM
mrusaw's Avatar
mrusaw mrusaw is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Dallas, Texas
Posts: 138 mrusaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to mrusaw Send a message via Yahoo to mrusaw
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>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XML and ASP.NET


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway