Couls someone please advise me on this error. What I am trying to do
is be able to convert an XML document into arrays. I read that the
subs & functions have to be in <script> tags.
Thanks!
Error:
BC30456: 'Read_DOM' is not a member of
'ASP.maps_examples_xml_to_array_aspx'.
Line 53: <asp:Button Text="Read DOM" OnClick="Read_DOM" runat="server"/
Code:
<%@ Import Namespace="System.Xml" %>
<%
Dim randNumbers(1) as Integer
randNumbers(0) = 5
Dim XMLDocument = New XmlDocument
Dim NodeReader = New XmlNodeReader(XMLDocument)
XMLDocument.Load(MapPath("XMLSample.xml"))
While NodeReader.Read()
Dim Spaces As String = Indent(NodeReader.Depth)
If NodeReader.IsStartElement() Then
DOMOut.Text &= "<br/>" & Spaces & "<b>" & NodeReader.Name & "</b>"
DOMOut.Text &= " [Depth: " & NodeReader.Depth & "]"
End If
If NodeReader.NodeType = XmlNodeType.Text Then
DOMOut.Text &= "<b>: </b>" & NodeReader.Value
End If
'List all trees
If NodeReader.Depth = 1 Then
Lbl_Trees.text &= NodeReader.Name & " | "
End if
End While
NodeReader.Close()
%>
<script runat="server" language="vb">
Function Indent(Depth As Integer)
Dim i As Integer
Dim Spaces As String
For i = 1 to Depth
Spaces &= " "
Next
Return Spaces
End Function
</script>
<form runat=server>
<asp:Button Text="Read DOM" OnClick="Read_DOM" runat="server"/>
<P>
<asp:Label id="DOMOut" EnableViewState="False" runat="server"/>
<P>
<asp:Label id="Lbl_Trees" EnableViewState="False" runat="server"/>
</form>
> Couls someone please advise me on this error. What I am trying to do
> is be able to convert an XML document into arrays. I read that the
[quoted text clipped - 64 lines]
> <asp:Label id="Lbl_Trees" EnableViewState="False" runat="server"/>
> </form>
Well, functions and subs have to be in <script> tags. Anyway, from an
architectural point of view, you are implementing bussines logic in a
page. Whay don't you move this code to another class and make it
reusable from all over the application? And why you don't use code-
behind's visual studio feature to separete code from presentation?
Good luck.
-Karl - 18 Jun 2007 15:55 GMT
On Jun 17, 10:48 am, Cubaman <oscar.acostamonte...@googlemail.com>
wrote:
> > Couls someone please advise me on this error. What I am trying to do
> > is be able to convert an XML document into arrays. I read that the
[quoted text clipped - 73 lines]
>
> - Show quoted text -
I am coding this via a notepad like editor. I don't use VS and I
haven't yet look into code behinds (Somewhat complex right now)
What do you mean by seperate class?
I was wanting to keep this piece together for simplicity of managing
the code. I am not planning on reusing this code anywhere in my
project but I understand the value of making this a function for
future use.