468,110 Members | 1,775 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,110 developers. It's quick & easy.

setting xsi:schemaLocation on XmlSerialize

I'm developing a GUI application in C#. I have a schema
file (.XSD) and am able to serialize and deserialize the
applications data using the schema file to an .XML file.
(I'm using xsd.exe to generate my serializable class,
XmlSerializer to Serialize and DeSerialize and
XMLValidatingReader to validate.

My intention is that application users can edit the
content of the .XML file using their favorite XML editor
as well as by using my app. However I want the user's XML
editor to be aware of my .XSD file. In a previous posting
Priya Lakshminarayanan pointed out that, within the .XML
file, I could specify the location of the schema file
using an xsi:schemaLocation attribute. (Many thanks
Priya).

I would therefore like to provide an xsi:schemaLocation
attribute in my .XML file, (pointing to the .XSD file),
when the file is serialized.

The sensible place for the .XSD file would seem to the the
application's installation folder. However, I will be
shipping my application using MSI installer and so I will
not know until run-time the location of this file.

How can I persuade XmlSerializer to write the following
Root attributes at run-time?

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="(notKnownUntilRunTime)"

Many thanks

Nov 11 '05 #1
0 2344

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Sarah Tegtmeier | last post: by
reply views Thread by kolja2003 | last post: by
2 posts views Thread by grochmal | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.