Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: use section of XML as source/destination of XmlSerializer? [Thread Next] Re: use section of XML as source/destination of XmlSerializer?To: NULL Date: 3/12/2009 1:52:00 PM Excellent, thanks!
I have another question for you. Actually, more of an approach. My
application is based on a plugin architecture. Each plugin have settings
that don't fit nicely into the My.Settings.* model. Rather, it makes sense
to represent them in XML (essentially serialized classes that are contained
in the plugin). Thus far, I have them stored in an XML document. In your
opinion, is this a good approach? It seems a bit fragile. Can you suggest
another approach?
Thanks,
Craig
"Martin Honnen" <mahotrash@y...> wrote in message
news:uaTYqkzoJHA.504@T......
> Craig Buchanan wrote:
>> I have an Xml file that I use as a database of information about a
>> manufactures products. It has the format:
>>
>> <Manufacturer>
>> <Products>
>> <Product id="1" name="product a" price="1.00" />
>> ...
>> </Products>
>> <Suppliers>
>> <Supplier id="1" name="supplier x" />
>> ...
>> </Suppliers>
>> </Manufacturer>
>>
>> I would like to be able to use the Suppliers node as the source for the
>> XmlSerializer's Deserialize and Serialize methods. I figure that I can
>> load an XmlDocument, then select the Suppliers node using an Xpath query
>> (//Supplers). The question is how to send this to the XmlSerialier.
>
> Use an XmlNodeReader over the Suppliers XmlElement node e.g.
> Dim doc As New XmlDocument()
> doc.Load("file.xml")
> Dim suppliers as XmlNode =
> doc.SelectSingleNode("/Manufacturer/Suppliers")
> Dim reader As XmlReader = New XmlNodeReader(suppliers)
> ' now pass reader to Deserialze method of an XmlSerializer
>
>
>
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
