Dynamic properties ?

C

C# newbie

Hi,

I've a program which runs some XPath queries to retreive information within
an xml file. it does keep track of every path (in case of finding the item).
Along with this it should capture attribute information of every visited
node during a seek procedure.
I've used an ArrayList and a class which has properties for node name and
its realted informationi. Regarding to xml structure there is a cateogry and
ID so we know we have a pattern for it but for number of attributes is
vary. Some nodes may have 6 attributes and some none and ...
Is there any way to have dynamic properties in a class ? !! or any solution
?

Let's say the xml is like:

<?xml version="1.0"?>
<frame frameName="empty" frameID="1" StyleUsage="URL"
xmlns=http://www.focxvbotererwest.com frameProgrammer="Co\foo"
DateTime="2/12/2004 5:00:54 PM">
<Params>
<BackgroundColor>#19384A</BackgroundColor>
<LinkColor>#ffffff</LinkColor>
<VisitedLinkColor>#ffffff</VisitedLinkColor>
<TextColor>#ffffff</TextColor>
<Direction>ltr</Direction>
<BackgroundImage>
</BackgroundImage>
<Header>&lt;table width='600' cellspacing='0' callpadding='0' border='0'
align='center'&gt; &lt;tr&gt;&lt;td&gt;&lt;img
src='http://img.fooresearch.com/images/foologo.gif' alt='foo' width='175'
height='62'&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;&lt;br&gt;</Header>
<Footer>&lt;table align=center border='0' Width='600'&gt;
&lt;tr&gt;&lt;td width='50%'&gt;&lt;FONT FACE='Arial,Helvetica' Size='1'
COLOR='#FFFFFF'&gt;COPYRIGHT &lt;script
language='javascript'&gt;document.write(String.fromCharCode(38));&lt;/script
&gt;copy 2000 - 2004 foo CORP. All rights reserved.&lt;/font&gt;&lt;/td&gt;
&lt;td width='50%' align='right'&gt;&lt;FONT FACE='Arial,Helvetica' Size='1'
COLOR='#FFFFFF'&gt;Technical Problems? &lt;a
href='http://www.fooresearch.com/support_form.asp'&gt;Contact Us, please
reference frame content in the subject
line&lt;/a&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt;</Footer>
<CSS>frame.css</CSS>
<MouseOverMessage>
</MouseOverMessage>
</Params>
<RepeatLists />
 
J

Jon Skeet [C# MVP]

C# newbie said:
I've a program which runs some XPath queries to retreive information within
an xml file. it does keep track of every path (in case of finding the item).
Along with this it should capture attribute information of every visited
node during a seek procedure.
I've used an ArrayList and a class which has properties for node name and
its realted informationi. Regarding to xml structure there is a cateogry and
ID so we know we have a pattern for it but for number of attributes is
vary. Some nodes may have 6 attributes and some none and ...
Is there any way to have dynamic properties in a class ? !! or any solution
?

I suggest you use a map such as a Hashtable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top