Thank you Marcus for your response, but I've tried your solution but
did not succeed!
The problem is that it give a failure saying that [Bind("t...@name")]
is not a valid expression.On Feb 9, 3:42 pm, Marcus Griep <[email protected]> wrote: > Your xpath query seems to be a bit off. > "//Person" means give me all person nodes everywhere. Similarly, "//Test" > means give me all test nodes everywhere. This causes w, x, y, and z to be > selected. > > I am not exactly sure how to organize this to get the effect you are looking > for, but maybe this?: > > [XmlData("//Person", FilePath = "data.xml")] > public Fixture([Bind("@name")] string name) { } > > [XmlData("//Person", FilePath = "data.xml")] > public void Test([Bind("t...@name")] string testName) { } > -- > Marcus Griep > —— > Ακακια את.ψο´, 3° > > > > On Mon, Feb 9, 2009 at 2:57 PM, max2256 <[email protected]> wrote: > > > Hi! > > I've been testing the XmlData attribute for a while, but I've not > > been able to solve the following problem: > > > let's say I have this XML file (data.xml) for example: > > <Fixture> > > <Person name="Mike"> > > <Test name="x"></Test> > > <Test name="y"></Test> > > </Person> > > <Person name="Jim"> > > <Test name="z"></Test> > > <Test name="w"></Test> > > </Person> > > </Fixture> > > > How can I loop on the Test node for this particular person ? > > > I tried this way but it did not succeed: > > > public class Fixture > > { > > [XmlData("//Person", FilePath = "data.xml")] > > public Fixture([Bind("@name")] string name) > > { > > // do something > > } > > > [XmlData("//Test", FilePath = "data.xml")] > > public void Test([Bind("@name")] string testName) > > { > > //do something > > } > > } > > > When I ran this I obtain this : > > > Person("Mike") > > |_ _ Test("x") > > |_ _ Test("y") > > |_ _ Test("z") > > |_ _ Test("w") > > > Person("Jim") > > |_ _ Test("x") > > |_ _ Test("y") > > |_ _ Test("z") > > |_ _ Test("w") > > > Any suggestions? > > > Thanx > > > On Feb 7, 5:09 am, "Jeff Brown" <[email protected]> wrote: > > > There's actually a bunch of docs and examples on the attribute class > > itself. > > > > Hit F1 on the type and see what Visual Studio shows you. (Caveat: It > > might > > > take a bit for VS to regenerate its help index the first time. This is > > > annoying but normal.) > > > > Jeff. > > > > -----Original Message----- > > > From: [email protected] [mailto:[email protected]] > > On > > > > Behalf Of max2256 > > > Sent: Friday, February 06, 2009 10:56 AM > > > To: MbUnit.User > > > Subject: MbUnit XmlData > > > > Hi, > > > > I've installed the current build and I'm very interested in > > > using the XMLData attribute, but I could not find any documentation > > > on how to use it! Is is possible to post a snippet on how to use it or > > it's > > > too soon to use this attribute. > > > > Thanx- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MbUnit.User" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MbUnitUser?hl=en -~----------~----~----~----~------~----~------~--~---
