From: Terry D. <ter...@ho...> - 2004-04-20 12:32:43
|
Rob, Well if you agree that there needs to be an object model (code-dom) in the wix assembly and I need one to allow programmatic manipulation of a wix file I can go ahead and get started on this. Before I do though, am I being "difficult" in not wanting to use the same way the tools (candle/light) work in just dealing with everything as XmlNodes? What I don't like about doing everything through XmlNodes is everytime I need to deal with a distinct set of objects, I'll need to iterate through the parent XmlNode's children finding all objects of a given type and populate some collection/list that the UI can deal with. Lets look at Properties. If I wanted to display a DataGrid or ListView of Properties to allow you to edit them I'll need to scan the Project node's children looking for all nodes with with a Name of Property and add them to my collection/list that will then be used as the datasource for the GUI control. Then at somepoint I'll need to account for any items that are created/edited/removed from the collection/list and propogate that back to the Project's children nodes and either update a given XmlNode, remove it or add it to the ChildNodes collection. I can see where the Wix schema is fine for the build tools because the assumption is that the Wix model loaded from the wxs file will be static for the duration of the tool using the file, but in the case of a GUI editor, the model is constantly changing and the wxs file is just the serialized representation of the model in memory. Terry >From: "Rob Mensching" <ro...@us...> >Reply-To: wix...@li... >To: <wix...@li...> >Subject: RE: [WiX-devs] WiX : Suggestions for serializing wxs file >Date: Tue, 20 Apr 2004 00:32:31 -0700 > >Interesting. > >First, the WiX schema was designed to be written. As you've anticipated, I >am against adding elements/attributes that don't improve readability. I'd >much rather put the burden of authoring .wxs files on a tool rather than a >developer. > >That said, it sounds like you are looking for a "code-dom" for .wxs files. >The closest thing today is the XmlSerializer that appears to not be ideal >for your needs. I agree, you'd have to maintain several ArrayLists (or >something) and then dump them into the XmlSerializer for persistence. >Non-ideal for sure. > >I'm not sure there is a good way to get all of your needs and avoid >creating >a new object model for creating .wxs files. The code-dom in the CLR is >very >different from the reflection API for this very reason. I think you may be >hitting that. > >Maybe it would make sense to create a "code-dom" object model in the >wix.dll? I haven't spent much time in this space (plenty of other bugs to >fix in the core), so I'm not sure I've said anything profound. <smile/> > >-----Original Message----- >From: wix...@li... >[mailto:wix...@li...] On Behalf Of Terry Denham >Sent: Monday, April 19, 2004 8:50 PM >To: wix...@li... >Subject: [WiX-devs] WiX : Suggestions for serializing wxs file > >Rob et al, > >I'm making good progress getting a working GUI tool for managing the >complexity of the wxs file but in trying not to reinvent the wheel I'd like >to take advantage of as much of the wix assembly as I can but here's the >problem I'm running into. > >The wxs file is not "valid" in the sense that it can be loaded into a >DataSet. The reasoning is that the Property table is basically foreign >keyed > >back to two different tables. There is no way you could do this in Sql >Server but because xml places no restriction on this layout, it's valid but >still won't load up into a DataSet. Would have been better to have child >tables ProductProperties and ModuleProperties that would contain Property >records instead of having a generic Property table. > >Be that is may, I don't think I will be able to persuade you all the the >schema should be improved to allow loading into a DataSet. > >The second solution I tried and does work is to use XmlSerailizer to >load/save an wxs file into a instance of the Wix object. The problem with >this solution is that the objects in wix.cs contain arrays of objects and >this is not as flexible as a collection of objects because I constantly >have > >to change the size of the array to account for items being added and >removed > >for the array. Also because the Item property contains the array of >subitems > >for a given object, if I add objects to the array I'll end up with objects >allocated at any ordinal within the array. To access the items in the array >I'll need an associative array to map an item back to an ordinal within the >array. > >For example if I display a list of dialogs and allow you to select one to >edit, that dialog may be the 5th dialog but it could be the 20th object in >the Item array because of all the other objects stored in the array. > >So I've started to look at SerializeInfo to see if there is a way to >control > >the load and saving of the Wix objects declared in wix.cs. > >I would like to avoid having to declare wrapper classes for the all the >classes declared in wix.cs and I'd like to not have to write the whole >serialization process to load and save a wxs file. > >I think the goal would be to be able to load a wxs file into a wix object >and say the Directory could contain a collection of Directory objects or of >files. So to add a new directory it would be something like > >Wix wix = new Wix(); >wix.Project.Directories.Add( new Directory("My Favorites") ); > > >I have a utility class that supports adding typesafe items to the arrays >that are exposed on each object but it's at a call level interface right >now > >and not an object level. > >WixModel model = new WixModel(); > >Project proj = model.CreateProject(); >model.Project = proj; > >Directory dir = model.CreateDirectory("My Favorites"); >model.AddDirectoryToProject( proj, dir ); > >I don't like this at all but I'd like to not have to derive wrapper classes >for every class in the Serialize namespace. > >Anybody have any suggestions? > >Terry Denham > >_________________________________________________________________ >FREE pop-up blocking with the new MSN Toolbar - get it now! >http://toolbar.msn.com/go/onm00200415ave/direct/01/ > > > >------------------------------------------------------- >This SF.Net email is sponsored by: IBM Linux Tutorials >Free Linux tutorial presented by Daniel Robbins, President and CEO of >GenToo technologies. Learn everything from fundamentals to system >administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >_______________________________________________ >WiX-devs mailing list >WiX...@li... >https://lists.sourceforge.net/lists/listinfo/wix-devs > > > >------------------------------------------------------- >This SF.Net email is sponsored by: IBM Linux Tutorials >Free Linux tutorial presented by Daniel Robbins, President and CEO of >GenToo technologies. Learn everything from fundamentals to system >administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >_______________________________________________ >WiX-devs mailing list >WiX...@li... >https://lists.sourceforge.net/lists/listinfo/wix-devs _________________________________________________________________ From must-see cities to the best beaches, plan a getaway with the Spring Travel Guide! http://special.msn.com/local/springtravel.armx |