xml-serialization

How to prevent XMLSerializer.serializeToString() from re-ordering attributes?

I'm using jQuery to load arbitrary XML strings (fragments of a larger document) into the browser DOM and manipulate them, then using XMLSerializer to load them back to strings and send them back to the server, where they are processed (by python and lxml) and re-integrated into a full XML document. The XML starts and ends in a git repos...

How to prevent illegal characters to appear in my XML when retrieving it from SQL Server

Sometimes the string values of Properties in my Classes become odd. They contain illegal characters and are displayed like this (with boxes): 123[]45[]6789 I'm assuming those are illegal/unrecognized characters. I serialize all my objects to XML and then upload them via Web Service. When I retrieve them again, some characters are re...

Choosing framework for XML persistency

I need to choose a framework for XML persistency of some java classes in our application. My requirements are: 1. I start from java classes, not from schema 2. Using annotations for customization 3. Ability to generate schema. Until now only JAXB seems to satosty all my requirements. XStream does not generate schema JiXB dows not use j...

XML Deserialization (DOCTYPE Issue)

I am trying to Deserialize the XML input which i get. I have Created Classes for Deserialization. In my XML input there is a DOCTYPE tag which specifies the DTD. So the problem is, if i remove the DTD tag from the input (using substring) it gets Deserialized but if i dont remove it it gets stuck at requestObject = (Request)serializer....

How do I model a dynamic XML element in a C# serialization class?

I have an XML document where one of the element nodes can be dynamic, or of any XML structure. I'm having a difficult time modeling the corresponding C# serialization class. For example I have something like this in my C# class: [XmlAnyElement] public XmlNode Value { get; set; } Where XmlNode is System.Xml.XmlNode. A few notes: I...

How can I XML Serialize a Sealed Class with No Parameterless Constructor?

I'm currently using an XMLSerializer to serialize a list of a class of my own. One of the class's properties is an instance of a sealed class that does not have a parameterless constructor, so the XML Serializer refuses to serialize the class. How can I get around this? I need that property to be serialized. Is there some way for me ...

How do you control what goes into XSDs generated from C# objects?

I know I can generate an XSD files from a C# assembly using XSD.exe or svcutil.exe. Is there anyway to control what goes in to the XSD file? I am mainly interested in adding restriction tags. ...

What is the equivalent for org.apache.xml.serialize.OutputFormat in DOM Level 3

We recently moved to xercesImpl-2.10.0.jar from previous version and some of our old usages are showing as deprecated. Can I know the latest usage for them FileOutputStream fos = new FileOutputStream(vAdjustmentFile + "_merged"); **OutputFormat** of = new OutputFormat("XML", "ISO-8859-1", true); ...

Even using sgen on my service class still results in agonizingly slow constructor

Hi all. So I'm trying to speed up our applications startup times -- and I've identified a major bottleneck to work on. Each of our webservice client classes takes forever and a day to instantiate. Some investigation revealed this is entirely due to the SoapHttpClientProtocol running GenerateXMLMappings. I started searching for inform...

Should I store serialized (to xml) object in SharePoint list?

A requirement of my website is that I pull down data from external sources. To pull down the data, I have created a timer job (SPJobDefinition). In this job, I need to store the external data somewhere. First I was thinking I would just store it in cache, but then I was thinking I might want to have the data around longer (plus, I don't ...

.NET: How to insert XML document into SQL Server

i want to insert arbitrary xml into SQL Server. The xml is contained in an XmlDocument object. The column i want to insert into is either nvarchar, ntext, or xml column (If it makes your life easier then you can pick which type it is. Really it's an xml column). Prototype void SaveXmlToDatabase(DbConnection connection, XmlDocume...

What are the weaknesses of XML?

Hi, Reading StackOverflow and listening the podcasts by Joel Spolsky and Jeff Atwood, I start to believe that many developers hate using XML or at least try to avoid using XML as much as possible for storing or exchanging data. On the other hand, I enjoy using XML a lot for several reasons: XML serialization is implemented in most mo...

.Net Settings file, complex types and serialization

Hi I have the following types [Serializable, XmlType(Namespace="http://mycompany/foo"] public sealed class Limit { [XmlElement(ElementName="Value1")] public double Value1 {get;set;} [XmlElement(ElementName="ComplexValue1")] public ComplexValue ComplexValue1 {get;set;} } [Serializable, XmlType(Namespace="http://mycomp...

Problem with a conversion of a complexType FROM object TO XML

For those that like to resolve problems, here's a big one :P Well, I am developing a system using web services, where I send and receive XML as parameter (not normal parameters as Int, String, bool, etc). After I receive a XML, I validate the XML with the XSD and also I convert that to an object.. after the process I also convert that ...

Boost serialization compiling issue

Hi, I am using boost serialization on windows, and I wanted to test my code on linux (ubuntu) and unfortunately it does not compile. #include <string> #include <fstream> #include <boost/archive/xml_iarchive.hpp> #include <boost/archive/xml_oarchive.hpp> #include <boost/serialization/string.hpp> #include <boost/serialization/nvp.hpp>...

C# XML Serializer won't store an attribute

Hello, everyone, This is my first question on Stack Overflow. Apologies in advance if I don't do things quite right while I'm learning how things work here. Here is my code : public void TestSerialize() { ShoppingBag _shoppingBag = new ShoppingBag(); Fruits _fruits = new Fruits(); _fruits.testAttribute = "foo"; Fruit...

unique id to record xml

how can I add to each node I add to xml a unique index value for example I have <events> <event><id>0</id> </event> <event><id>1</id></event> </events> I want to add another event "node" that the id will be 6 /edited/ i have created xsd an added to the id elment autoincrease =true but idont really know wha...

XMLWriter vs XMLDictionaryWriter

What's the difference between XMLWriter and XMLDictionaryWriter? In which cases is each one generally used? ...

.NET XML Serialization Array/List object alias

Hi, I need to serialize an object like this: public class Book { public string Title { get; set; } public string[] Authors { get; set; } } This generates something like this: <?xml version="1.0" encoding="utf-8"?> <Book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema...

JSON.NET, XmlSerializer and "Specified" property

I have a REST service which takes JSON and XML as input and does a SOAP call to an extenal service with the deserialized content. The classes which are used for deserialization are auto-generated from the wsdl of the SOAP service. I use the XmlSerializer in case of a XML request and I want to use the Newton JSON.NET JsonSerializer for JS...