Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: use section of XML as source/destination of XmlSerializer?

From: "Craig Buchanan" <someone@---------.--->
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/ 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent