How do I remove XML namespaces from an object's XML representation serialized using DataContractSerializer?
That object needs to be serialized to a very simple output XML.
Latest & greatest - using .Net 4 beta 2
The object will never need to be deserialized.
XML should not have any xmlns:... namespace refs
Any subtypes of Exception an...
For my application, I need to serialize data to file using XML, so I read Introducing XML Serialization on MSDN. One thing that concerns me is under the Security Considerations for XmlSerializer Applications section it reads:
The XmlSerializer creates C# (.cs)
files and compiles them into .dll
files in the directory named by th...
I want my output to look like this
<OrderContainer xmlns="http://blabla/api/products" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
So I added the following to my XmlSerializer
XmlSerializer x = new XmlSerializer(typeof(OrderContainer));
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add("", "http://blabla/a...
Hi,
I have a very large XML file that I need to parse so I need to use XMLReader. This file contains a large number of second level elements that contain the information I'm interested in e.g.:
<topLevelElement>
<SecondLevelElement>
<Information1>blah</Information1>
<Information2>blah</Information2>
<Information3>blah</In...
Hi,
This is what I get:
<ex:test soap:mustUnderstand="1" xmlns:ex="http://www.example.com/namespace">
<ex:A Type="lorem">ipsum</ex:A>
</ex:test>
This is what I want: (Note that the Type-attribute is prefixed with ex.)
<ex:test soap:mustUnderstand="1" xmlns:ex="http://www.example.com/namespace">
<ex:A ex:Type="lorem">ipsum<...
I want to deserialize xml like this:
<Product>
<Classification>
<NewClassification>1</NewClassification>
<NewClassification>2</NewClassification>
<NewClassification>3</NewClassification>
<OldClassification>A</OldClassification>
<OldClassification>B</OldClassification>
</Classification>
</P...
Using SubSonic v2.x: The first issue is the error discussed here:
Server Error in '/......' Application.
Cannot serialize member '.....' of type System.Nullable
I'm not sure where to place the code in my DAL from this post to get this working. I tried placing it in one of the partial classes I created for a table, but no go.
Another ...
I have a class with a collection of other classes that gets serialized.
The collection of classes is defined as such in my SubSonic partial class:
public partial class TblReceipt
{
// no need to override any existing methods or properties as we
// are simply adding
// specifying the types of objects to be contained within...
I have given XML that I can't change and I need to deserialize it to a custom class:
<Person>
<Addresses>
<MainAddress>
<Country />
<City />
</MainAddress>
<AdditionalAddress>
<Country />
<City />
</AdditionalAddress>
<AdditionalAddress>
<Country />
...
I am try to deserialize my class, that normally serialized.
public class MyClass
{
private List<Section> sections = new List<Section>();
public List<Section> Sections
{
get
{
return this.sections;
}
}
}
public class Section1: Section
{
public string MyProperty {get;set;}
}
public class...
Which is faster, XML with XSLT or CLR with DataBinding?
I'm assuming that it's CLR + Databinding but I could be wrong.
...
I have an object graph that I need to serialize to xml and save to a Sql Server row. I have a table with an xml data type and I've been using the SqlXml datatype, providing it a memorystream.
This works well for the most part. However, if my object graph is especially big (~200 meg in size), I get an OutOfMemoryException. What is the mo...
I have a basic WCF service that takes some xml. Some of the xml is a list like so:
<Root>
<Products>
<Product>
<SKU>1234</SKU>
<Price>2533</Price>
<ProductName>Brown Shows</ProductName>
<Quantity>1</Quantity>
</Product>
<Product>
<SKU>345345</SKU>
...
I want to XML-Serialize a complex type (class), that has a property of type System.Drawing.Bitmap among others.
/// <summary>
/// Gets or sets the large icon, a 32x32 pixel image representing this face.
/// </summary>
/// <value>The large icon.</value>
public Bitmap LargeIcon { get; set; }
I now have found out tha...
In my WCF service I only want 1 endpoint (1 URI), however, I want this URI to be able to handle multiple types of requests. 5 different request types can be sent to this service from another company. Each request has a unique XML schemas.
I created classes for each XML request to be serialized. Normally I would just overload a function ...
I am validating form input against an XML schema definition by serializing my business layer objects to a MemoryStream and then reading the MemoryStream using a validating XMLReader. In the callback function for validation errors, I have access to the name of the element failing validation and to a rather lengthy string containing the d...
My goal is to be able to share configration settings amongst apps.
For example I want to be able to use a WinForm app to set and save the settings and have a console app be able to read those settings and run as a scheduled task.
The approach I tried is to create a SharedSettings class that is referenced by both the Winform app and the C...
I am trying out the Simple XML serializer. I am more interested in deserialization from XML->Java. Here is my code as a unit test:
import java.io.StringReader;
import java.io.StringWriter;
import junit.framework.TestCase;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.Seri...
This is duplicate of http://stackoverflow.com/questions/306877/can-xmlserializer-deserialize-into-a-nullableint but I need a solution that neither change xml document nor forces me to implement IXmlSerializable interface. I dont want to implement IXmlSerializable because I have many additional elements beside <number> that get deserializ...
My application receive strings from outside and construct an XML document
string fromOutside = "\0";
XAttribute a = new XAttribute(fromOutside);
when the attribute value contains null character then I got exception when trying to save XML to the disk (when it goes into XmlWriter)
System.ArgumentException : '.', hexadecimal value 0x00...