Buenas, quiero hacer un sistemilla un poco peculiar, se compone de:
Un archivo XML donde tengo un nodo padre y tres nodos hijos
Un archivo VB en App_Code llamado setlayout.vb
Un archivo ASPX en el root donde utilizo el codigo del VB.
Ahora les muestro el codigo:
Código:
<?xml version="1.0" encoding="utf-8" ?>
<layout>
<header>
<body>
<div id="wrapper">
<div id="header">
</div>
</header>
<middle>
<div id="middle">
<div id="content">
</div>
<div id="sidebar">
</div>
</div>
</middle>
<footer>
<div id="footer">
</div>
</footer>
</layout>
Código:
Imports System
Imports System.Web
Imports System.Configuration
Imports System.Xml
Namespace OpenDot
Public Class SetLayout
Private nameLayout As String = "~/skins/" & ConfigurationManager.AppSettings("skin") & "/layout.xml"
Public Function PrintHTML(node As String)
Dim oReader As XMLTextReader = New XMLTextReader(nameLayout)
oReader.Read(node)
Return oReader
End Function
End Class
End Namespace
Código:
<%@Page Language="VB"%>
<%@Import Namespace="OpenDot"%>
<script runat="server">
Public Sub Page_Load(Sender as Object, e as EventArgs)
Dim objLYT AS New SetLayout
Dim html As String
html = objLYT.PrintHTML("header")
index.Controls.Add(html)
End Sub
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
<form id="index" runat="server">
</form>
</body>
</html>
Pero muy aparte de haberlo probado, sé que está mal el código, lo que necesito es tomar el texto del nodo
header y colocarlo dentro del
form index, pero no tengo mucha nocion de como hacerlo y por eso recurro a ustedes.
¿Me podrian explicar cómo hacerlo?
Gracias de antemano