I've been doing alot of XML processing in C# of late and after coming back to C# from a long stint javascript coding I'm really missing some of the nice short cuts of JS.
I've go a sizable XML document made up of lot so elements, child elements, etc. Representing Accommodations/Flights/Attraction tickets for an online booking.
So far I...
I want a method to return an XML Serialized Typed object. Is there an interface I can use to enforce this requirement?
...
Hi, reading the documentation for java org.w3c.dom.ls it seems as a Element only can be serialized to a String with the java native string encoding, UTF-16. I need however to create a UTF-8 string, escaped or what not, I understand that it still will be a UTF-16 String. Anyone has an idea to get around this?
I need the string to pass in ...
I have some very similar XML structures which are in fact quite distinct, but it appears that XmlSerializer.Deserialize is very "forgiving" and will go out of its way to take XML and deserialize out into a strongly typed object I created from the source XSDs. Is there any way to make it more strict or do some type of deeper validation?
...
I am trying to send and receive XML from a website using ASP.NET C# application.
I tried both httpwebrequest and webclient, and both of them throw exception:
"Unable to connect to the remote server. No connection could be made because the target machine actively refused it" followed by the IP Address I think.
Now, is there a site o...
Are there any closed or open source projects for a XML serializer for C# that can serialize for the most part any object without the need to pollute my domain objects with tons of attributes? That will also handle serialization of collections built with the internal generics classes? A bonus would be that it can handle serializing an int...
Hi all,
I’m using XmlSerializer to deserialize complex object, using XSD auto-generated classes. But when it comes to enumeration, there is some problem,
I want some attribute to be restricted to specific values, such as:
<xs:simpleType name="choiceType">
<xs:restriction base="xs:string">
<xs:enumeration value="Yes"/>
...
I'm using XMLSerializer to serialize an object that contains a generic list
List <ChildBase> Children {get;set}
The problem is that each element derives from ChildBase which in fact is an abstract class.
When I try to deserialize, I get an invalidOperationException
Is there a way I can use XMLSerializer with derived objects?
Thanks.
...
Here are the steps I've taken so far to work with an XmlDocument being returned by a 3rd party DLL.
I saved the XmlDocument as SegmentationSummary.xml.
I used XSD.exe to create SegmentationSummary.xsd.
I used XSD.exe to create SegmentationSummary.cs.
Here is a sample of SegmentationSummary.cs. Note that ShmResult is the root node ...
Is there an easy way to force the WebService .Net XmlSerialiser to check that an attribute is present?
In the following example, I want the webService's caller do not forget to set the Price and the Currency:
public class Quote
{
public decimal Price;
public string Currency;
}
[WebService]
public class MyWebService : WebService
...
I've used XSD.EXE to convert an XSD into an object. That works fine and I can Deserialize using XMLSerializer just fine, except that the subelements which are generated as arrays don't populate.
private SubElements[] subelementsField;
/// <remarks/>
[System.Xml.Serialization.XmlArrayItemAttribute("SubElement", IsNullable=f...
I have an object that I am serializing to xml. It appears that a value in one of the properties contains the hex character 0x1E. I've tried setting The Encoding property of XmlWriterSettings to both "utf-16" and "unicode" but I still get an exception thrown:
here was an error generating the XML document. ---> System.InvalidOperationEx...
the title says it all. i noticed that serialization as well des deserialization takes 10x as lang with protobuf-net compared to XmlSerializer. the output files however are much smaller. i find this confusing because protobuf is such a simple format that should run very fast.
any hints on how to speed it are greatly appreciated.
Edit: h...
I have an XmlReader that is trying to read text into a list of elements. I am having trouble getting it to reader the text: "a [ z ]". If I try with the text "a [ z ] " (same but with two trailing spaces) it works fine. Below is an example:
TextReader tr = new StringReader("a [ z ]");
XmlReaderSettings settings = new XmlReaderSettings
...
Good afternoon,
I'm trying to render as XML the complete ActiveRecord error list, problem is when you do something like:
respond_to do |format|
format.xml { render :xml => @object }
end
It does not render nested attributes if you don't say so, so either: you should create a template or calling explicity to_xml method and using ":i...
I've got the hierarchial structure of files and folders inside of my application. Application works with absolute paths, which are stored in FileNode.Items list of strings.
When i've got to save my project, I serialize FileNode class in XML. But, I need to convert absolute paths to relatives (if possible) and then serialize.
So, my que...
TinyXML
I have a XML file that keeps a bunch of data that is loaded into objects. Right now, I have one giant method that parses the XML file and creates the appropriate objects depending on the contents of the XML file. This function is very large and imports lots of class definitions.
Would it be better to each class type to do its ...
Hi, so I'm serializing an object that contains a List<Object> property, and it serializes it like this:
<Explorer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Explorer1</Name>
<Items>
<anyType xsi:type="FolderObject">
<Name>Folder1</Name>
<Items>
...
Hi,
I'm using XmlSerializer to deserialize Xml achives. But I found the class xsd.exe generated only offers capability to read the xml, but no validation. For example, if one node is missing in a document, the attribute field of the generated class will be null, rather than throws a validation exception as I expected. How can I achieve...
I have structure like this:
public interface A
{
public void method();
}
public class B : A
{
}
public class C : A
{
}
List<A> list;
List contains objects of type B and C they also have some fields that I would like to keep, can I now serialize it, deserialize back and get the proper object instances?
Preferably to XML
EDIT:
...