xml

XmlSerializer doesn't serialize everything in my class

I have a very basic class that is a list of sub-classes, plus some summary data. [Serializable] public class ProductCollection : List<Product> { public bool flag { get; set; } public double A { get; set; } public double B { get; set; } public double C { get; set; } } ... // method to save this class private void Save...

How to to sort a XML feed with SimpleXML

Hi, I have started to use the simplexml function that seems to work out better than the previous other parser that I have tried to use. I have got to the stage where I need to the sort the items by transmissiondate - I tried using the uasort but does not make any changes the order of the items. also some times a programme is on more t...

Storing XML from a web service in C#

Quick simple question really. I'm sending data to a web service in C# and its giving me XML back. It is a SOAP 1.1 and/or 1.2 web service. I'm not sure how to properly recieve this data and then get the information I need out of it. Here is my code to send it try { _webService.ProcessCard(sVariable1, sVariable2); } catch ( Except...

"Root element not found" - when reading memory stream

I have a class that i store in a list. I serialize it ... XmlDocument xd = new XmlDocument(); MemoryStream ms = new MemoryStream(); XmlSerializer xm = new XmlSerializer(typeof(List<BugWrapper>)); xm.Serialize(ms, _bugs); StreamReader sr = new StreamReader(ms); string str = sr.ReadToEnd()...

XSLT Rename Element

I have a XML document and I want to rename some elements via XSLT: <Assert @some attributes here> <conent> <And> <formula> <Atom> <opr> ... For example I want to rename <opr> to <op>. I have the following XSLT: <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates selec...

Trying to convert xml to a dictionary

My xml looks like: <root> <blah1>some text</blah1> <someother>blah aasdf</someother> </root> I want to convert this to a dictionary So I can do: myDict["blah1"] and it returns the text 'some text' So far I have: Dictionary<string,string> myDict = (from elem in myXmlDoc.Element("Root").Elements() ...

Easy way to convert a Dictionary<string, string> to xml and visa versa

Wondering if there is a fast way, maybe with linq?, to convert a Dictionary into a XML document. And a way to convert the xml back to a dictionary. XML can look like: <root> <key>value</key> <key2>value</key2> </root> ...

XML Deserialization Not Setting Class Values

I am not seeing what I am doing wrong. To see what was being done, I changed the constructor values to "TEST", after the XML gets read in (I verified what the XML is), the class values are still stuck to "TEST". Any more Ideas? I am doing this process already in another class that works fine, neither me nor some co-workers could find the...

Transform XML into specified ordering (DTD -> XSD)

I have a project where the main file we are dealing with is an old XML file where the creator made a very unstructured DTD (All elements are optional, and can occur 0 or more times. Even better the application which reads the file actually expects many of the values as required). I have created an XSD based upon known application require...

nokogiri: xml to html

Hi, I just want to do some straight conversion (almost just search and replace) but I'm having trouble just getting things to sit in place - I'm ending up with links out of place and duplicated content. I'm sure I'm doing something silly with my attempts at traversing the xml : ) I'm trying with: builder = Nokogiri::HTML::Builder.new d...

XML parsing with C#, XPath

Mine is a general question on XML parsing practices. Lets say we have an XML document, and we use XPath to get some node from that document: XMLNode node1=XMLDoc.SelectSingleNode("/SomeNode/SomeOtherNode"); Now n contains the data of SomeOtherNode. Intuitively I'd expect the following line of code: XMLNode node2=XMLDoc.SelectSingleN...

Problem filtering an Array into multiple Tableviews (based on SeismicXML)

I've taken the Seismc XMl example and adjusted it to my needs, I've added a tab bar controller with multiple tabs each with a TableView, so far so good, I now want to filter the main TableView, so that different info appears in each of the TableViews based on category. I've created a class for each filter "type" in the app delegate, and...

Displaying attributes in XML

Hi, Is displaying these two ways the same and correct? E.g. < contents cpid="1" cpnm="1">< /contents > and < contents cpid="1" cpnm="1"> < /contents> ...

Can I link maxOccurs in my schema to a value of another attribute in the target xml file?

I'm defining an xml schema for a file that looks something like this: <data> <config><segmentcount value="10"/></config> <foos> <foo> <segments> <segment data="X"/> <segment data="X"/> <segment data="X"/> <segment data="X"/> <segm...

Xml in Dot net 3.5:how to load xml document into object of class generated from schema?

I have defined schema for xml in file "packetTemplate.xsd".Using ms tool "xsd.exe" i have generated class "PacketTemplate" corresponding to schema.Does dot net provides api that can load xml document by refering to file and returns object of class PacketTemplate. ...

How can i generate xml from an object hierarchy?

I have object, tree/model/hierarchy, whatever the correct term is. It consists of what could be characterized as a one-to-one mapping of the desired XML. That is i have the following (in a non-standard UML sort of syntax) class A { class B b[*] class C class D } class B { class C c[*] string AttributeFoo = "bar" } ...

getname on ReadEndElement

When I am calling getname after reading the end element (ReadEndElement) I get wrong value. eg: dc302149861088513512481 After calling ReadEndElement for "SESSIONID" getname returns the name as "success" ...

Generating XML file from SQL Server 2008

Hi, I am working on an application where I need to get the SQL response as XML into an XML file (and to store it in some physical location, say c:\xyz.xml). I am able to generate the XML content using the provisions available in SQL Server as shown below. SELECT * FROM @Table FOR XML AUTO, ELEMENTS where: @Table is a table vari...

How to create SimpleType enumeration with xmlspy in schema ?

Hi, I'd like to know how to create a SimpleType that is a enumeration with XMLSpy. Do you have link or something useful that can help me ? it's simpletype for country code enumeration AD ("ANDORRA") enumeration AE ("UNITED ARAB EMIRATES") enumeration AF ("AFGHANISTAN") enumeration AG ("ANTIGUA AND BARBUDA") enumeration AI (...

Script to load contents of my XML file into array in Javascript

Hi all, I have an XML file, which can be viewed here, of data concerning a series of music albums, which I would like to load into javascript into an array called "mymusic" in this form: mymusic = [ { title:, artist:, artwork:, tracks: [ { tracktitle:, trackmp3: }, { tracktitle...