This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > May 2004 > parsing XML from a configuration file Custom Section Handler.





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author parsing XML from a configuration file Custom Section Handler.
Hazzard

2004-05-24, 11:14 pm

I am trying to create a custom section and section handler in my config
file.

The custom section should be something like;
<appSecurity>
<method name = "Protect the Ice Cream">
<allow group = "admin"/>
<allow group = "ice cream eaters"/>
<deny group= "weightwatchers"/>
<deny user = "hazz"/>
</method>
</appSecurity>

How would I parse this XML when a simple Data Handler looks like the
following;
Implements IConfigurationSectionHandler where a simple Section Handler looks
like the following;

Dim data As New NameValueCollection()

Dim root As XmlElement = CType(section, XmlElement)

Dim node As XmlNode

For Each node In root.ChildNodes

data.Add(node.Name, node.InnerText)

Next

*************



Thank you,

-greg



ps. I also posted this to the ASP.NET group and C# group. After I found this
newsgroup, I realized that this is probably the best place!


Hazzard

2004-05-25, 12:18 pm

The context to this question is Rocky's article-> specifically the custom
handler section.
http://msdn.microsoft.com/library/d...net04222003.asp
-greg

"Hazzard" <hazz@sonic.net> wrote in message
news:%23cyMl0fQEHA.964@TK2MSFTNGP10.phx.gbl...
> I am trying to create a custom section and section handler in my config
> file.
>
> The custom section should be something like;
> <appSecurity>
> <method name = "Protect the Ice Cream">
> <allow group = "admin"/>
> <allow group = "ice cream eaters"/>
> <deny group= "weightwatchers"/>
> <deny user = "hazz"/>
> </method>
> </appSecurity>
>
> How would I parse this XML when a simple Data Handler looks like the
> following;
> Implements IConfigurationSectionHandler where a simple Section Handler

looks
> like the following;
>
> Dim data As New NameValueCollection()
>
> Dim root As XmlElement = CType(section, XmlElement)
>
> Dim node As XmlNode
>
> For Each node In root.ChildNodes
>
> data.Add(node.Name, node.InnerText)
>
> Next
>
> *************
>
>
>
> Thank you,
>
> -greg
>
>
>
> ps. I also posted this to the ASP.NET group and C# group. After I found

this
> newsgroup, I realized that this is probably the best place!
>
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews