CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2007
    Location
    Vercelli, Italy
    Posts
    87

    XML serialization based on a node's attribute

    I'm trying to code a couple of tools to manage Visual Studio's projects. The reason why I need an external program for that is that 1) I use VS Express, so I have no macro support, and 2) it may be useful to perform similar operations on VS and non-VS projects.

    The first thing I though about when I needed to model a VS project was to use c#'s XML serialization to load and save the project. But the vcproj file (C++ project file) has configurations that are defined like this:
    Code:
    		<Configuration
    			Name="Debug|Win32"
    			OutputDirectory="..\$(ConfigurationName)"
    			IntermediateDirectory="$(ConfigurationName)"
    			ConfigurationType="4"
    			CharacterSet="2"
    			>
    			<Tool
    				Name="VCPreBuildEventTool"
    			/>
    			<Tool
    				Name="VCCustomBuildTool"
    			/>
    			<Tool
    				Name="VCXMLDataGeneratorTool"
    			/>
    			<Tool
    				Name="VCWebServiceProxyGeneratorTool"
    			/>
    			<Tool
    				Name="VCMIDLTool"
    			/>
    			...
    If I associate the "Tool" XmlElement to a certain class, I am not able to differentiate between the different type of tools. What I would need is to differentiate the classes the element is serialized/deserialized to/from based on the element's "Name" attribute, but I haven't found anything about how to do this.

    Can anybody please give suggestions? Thanks.
    I owe Paul McKenzie a pizza.

    I am no expert; but they say I can make concepts easy to understand. That's why newbies questions are mine!!! XD

  2. #2
    Join Date
    Jun 2007
    Location
    Vercelli, Italy
    Posts
    87

    Re: XML serialization based on a node's attribute

    Nobody has an idea on how to solve this problem? Of course I could load the XML tree and then serialize/deserialize the project myself, but it would be great to use the C# serialization utilities.
    I owe Paul McKenzie a pizza.

    I am no expert; but they say I can make concepts easy to understand. That's why newbies questions are mine!!! XD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured