473,324 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

XmlSerializer--return fragment only without leading<?xml version="

Sky
Hello:

I'm trying to emulate the userSettings storage system on CE.

XmlSerialization looks like a very useful 1-line solution that looks
wonderful for serializing one class to one xml document -- but not an xml
string fragment...

Because that user.config often has more than just class serialized into
(such as one per assembly if each assembly has a Settings.settings file). An
example would be this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>

<!--
Some Notes I want to keep , etc.
-->

<userSettings>
<XAct.Study.UserSettings.Properties.Settings>
<setting name="MyUserSetting2" serializeAs="String">
<value>PinkAndFlufyXTRA</value>
</setting>
<setting name="MyUserSetting" serializeAs="String">
<value>PinkAndFlufy</value>
</setting>
</XAct.Study.UserSettings.Properties.Settings>
<XAct.Module1.Properties.Settings>
<setting name="MoreSettings" serializeAs="String">
<value>Chiwawa</value>
</setting>
<setting name="MoreSettings2" serializeAs="String">
<value>HighPitchedBark</value>
</setting>
</XAct.Module1.Properties.Settings>
</userSettings>
</configuration>
How can I force the XmlSerializer to return everything minus the leading
<?xml version="1.0" encoding="utf-8"?up front, so that I can stringbuild
several classes together before saving it?

BTW: I see one overload that allows for multiple types to be given, but I
don't think that's what I want -- because user.settings may contain other
fragments, notes, etc, so I don't want to give over to the XmlSerializer
complete control of the file (it will erase the notes, etc.).

Or is there a better approach to this?

Thank you very much,
Sky

it appears to create a full xml document, rather than just a string fragment.
Jul 31 '06 #1
0 1432

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stuart Baker | last post by:
I just added session support to a web site and the URL's that contain a #fragment no longer function. Is there a delimiter that I can add following the #fragment that will tell the browser that the...
5
by: reddy | last post by:
I am trying to insert a node into an XMLFile. using XMLTextwriter. My Question is Is it possible to do without using XMLDocument. Because its loading all the the file into memory. I just want to...
2
by: Joe Gass | last post by:
Hi I have a query that uses for xml auto I'd like to load this into an xmldocument with an xmlreader e.g. Dim xr As XmlReader xmlDoc = New XmlDocument xr = oCom.ExecuteXmlReader If xr.Read...
0
by: The Last Danish Pastry | last post by:
A couple of days ago there was a thread "Returning the machine epsilon". The responses in that thread suggested using Double.Epsilon or Single.Epsilon. Since both these seem to return zero I...
0
by: Troy Simpson | last post by:
Hi, I have a website which is made up of dynamic pages. Each page that's loaded has some code which looks at which template to load amongst other things, which causes the page to take a little...
3
by: Gustaf | last post by:
I'm trying to grasp this little passage from the XBRL spec: "The xlink:href attribute MUST be a URI. The URI MUST point to an XML document or to one or more XML fragments within an XML document....
0
by: Russell | last post by:
I have a class with a single public member. I use the XmlAttribute attribute to serialize it as an attribute rather than an element. I want to create methods to serialize and deserialize...
2
by: Shimon Sim | last post by:
Hi I keep getting error : WriteStartDocument cannot be called on writers created with ConformanceLevel.Fragment. The code that I have is very simple. SimpleClass c = new SimpleClass();
1
by: benmarco7 | last post by:
CODE COMPLETE, page 356 if(StatusOK) { if(DataAvail) { ImportantVar = x; goto MID_LOOP; } }
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.