Search Results

Search found 15718 results on 629 pages for 'xml'.

Page 5/629 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Build XML document using Linq To XML

    - by JasonDR
    Given the following code: string xml = ""; //alternativley: string xml = "<people />"; XDocument xDoc = null; if (!string.IsNullOrEmpty(xml)) { xDoc = XDocument.Parse(xml); xDoc.Element("people").Add( new XElement("person", "p 1") ); } else { xDoc = new XDocument(); xDoc.Add(new XElement("people", new XElement("person", "p 1") )); } As you can see, if the xml variable is blank, I need to create the rood node manually, and append the person the root node, whereas if it is not, I simple add to the people element My question is, is there any way to generically create the document, where it will add all referenced node automatically if they do not already exists?

    Read the article

  • android sdk main.out.xml parsing error?

    - by mobibob
    I just started a new Android project, "WeekendStudy" to continue learning Android development and I got stumped compiling the default 'hello weekendstudy' compile / run. I think that I missed a step in configuration and setup, but I am at a loss to find out where. I have an AVD configured, set and launched. When I press 'run', the SDK is building a file main.out.xml and then fails as this: [2010-03-06 09:46:47 - WeekendStudy]Error in an XML file: aborting build. [2010-03-06 09:46:48 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined. [2010-03-06 09:46:48 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here. [2010-03-06 09:46:48 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found [2010-03-06 09:48:16 - WeekendStudy]Error in an XML file: aborting build. [2010-03-06 09:48:16 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined. [2010-03-06 09:48:16 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here. [2010-03-06 09:48:16 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found [2010-03-06 09:55:29 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined. [2010-03-06 09:55:29 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here. [2010-03-06 09:55:29 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found [2010-03-06 09:55:49 - WeekendStudy]Error in an XML file: aborting build. [2010-03-06 09:55:49 - WeekendStudy]res/layout/main.xml:0: error: Resource entry main is already defined. [2010-03-06 09:55:49 - WeekendStudy]res/layout/main.out.xml:0: Originally defined here. [2010-03-06 09:55:49 - WeekendStudy]/Users/mobibob/Projects/workspace-weekend/WeekendStudy/res/layout/main.out.xml:1: error: Error parsing XML: no element found

    Read the article

  • Element was not expected While Deserializing an Array with XML Serialization

    - by Anthony Shaw
    OK. I'm trying to work on communicating with the Pivotal Tracker API, which only returns data in an XML format. I have the following XML that I'm trying to deserialize into my domain model. <?xml version="1.0" encoding="UTF-8"? <stories type="array" count="2" total="2" <story <id type="integer"2909137</id <project_id type="integer"68153</project_id <story_typebug</story_type <urlhttp://www.pivotaltracker.com/story/show/2909137</url <current_stateunscheduled</current_state <description</description <nameTest #2</name <requested_byAnthony Shaw</requested_by <created_at type="datetime"2010/03/23 20:05:58 EDT</created_at <updated_at type="datetime"2010/03/23 20:05:58 EDT</updated_at </story <story <id type="integer"2909135</id <project_id type="integer"68153</project_id <story_typefeature</story_type <urlhttp://www.pivotaltracker.com/story/show/2909135</url <estimate type="integer"-1</estimate <current_stateunscheduled</current_state <description</description <nameTest #1</name <requested_byAnthony Shaw</requested_by <created_at type="datetime"2010/03/23 20:05:53 EDT</created_at <updated_at type="datetime"2010/03/23 20:05:53 EDT</updated_at </story </stories My 'story' object is created as follows: public class story { public int id { get; set; } public int estimate { get; set; } public int project_id { get; set; } public string story_type { get; set; } public string url { get; set; } public string current_state { get; set; } public string description { get; set; } public string name { get; set; } public string requested_by { get; set; } public string labels { get; set; } public string lighthouse_id { get; set; } public string lighthouse_url { get; set; } public string owned_by { get; set; } public string accepted_at { get; set; } public string created_at { get; set; } public attachment[] attachments { get; set; } public note[] notes { get; set; } } When I execute my deserialization code, I receive the following exception: Exception: There is an error in XML document (2, 2). Inner Exception: <stories xmlns='' was not expected. I can deserialize the individual stories just fine, I just cannot deserialize this xml into an array of 'story' objects And my deserialization code (value is a string of the xml) var byteArray = Encoding.ASCII.GetBytes(value); var stream = new MemoryStream(byteArray); var deserializedObject = new XmlSerializer(typeof (story[])).Deserialize(stream) Does anybody have any ideas?

    Read the article

  • Convert xml as string

    - by hakish
    i have a scenario where in i need to send an xml as a tag content in a SOAP request message to a webservice for example <arg_1><xml version="1.0" encoding="UTF-8"?><sometag><somemoretag>abcd</somemoretag></sometag></arg_1></code> arg_1 happens to be an String parameter to a webservice. So i bring in a CDATA section for this <arg_1><![CDATA[<xml version="1.0" encoding="UTF-8"?><sometag><somemoretag>abcd</somemoretag></sometag>]]></arg_1> But this keeps throwing me an exception org.xml.sax.SAXException: WSWS3084E: Error: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize. Message being parsed: I keep getting this exception. Has anyone seen this before??

    Read the article

  • Parsing XML in a non-XML column

    - by slugster
    Hi, i am reasonably proficient with SQLServer, but i'm not a DBA so i'm not sure how to approach this. I have an XML chunk stored in an ntext column. Due to it being a legacy database and the requirements of the project i cannot change the table (yet). This is an example of the data i need to manipulate: <XmlSerializableHashtable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Entries> <Entry> <key xsi:type="xsd:string">CurrentYear</key><value xsi:type="xsd:string">2010</value> </Entry> <Entry> <key xsi:type="xsd:string">CurrentMonth</key><value xsi:type="xsd:string">4</value> </Entry> </Entries> </XmlSerializableHashtable> each row will have a chunk like this, but obviously with different keys/values in the XML. Is there any clever way i can parse this XML in to a name/value pairs style view? Or should i be using SQLServer's XML querying abilities even though it isn't an XML column? If so, how would i query a specific value out of that column? (Note: adding a computed XML column on the end of the table is a possibility, if that helps). Thanks for any assistance!

    Read the article

  • XML Deserialization in VB/VBA

    - by oharab
    I have a set of VBA classes in an MS Access database. I have an xml string with data I want to create new classes with. Other than setting each property individually, is there an easy way to deserialize the XML into my object? I've seen the code using the TypeLib library Public Sub ISerializable_Deserialize(xml As IXMLDOMNode) Dim tTLI As TLIApplication Dim tInvoke As InvokeKinds Dim tName As String Dim tMem As MemberInfo tInvoke = VbLet For Each tMem In TLI.ClassInfoFromObject(Me).Members tName = LCase(tMem.Name) CallByName Me, tMem.Name, VbLet, xml.Attributes.getNamedItem(tName).Text Next tMem End Sub but this doesn't seem to work with the standard class modules. I get a 429 error: ActiveX Component Cannot Be Created Can anyone else help me out? I'd rather not have to set each propery by hand if I can help it, some of these classes are huge!

    Read the article

  • Parsing third-party XML

    - by mare
    What path would you took to parse a large XML file (2MB - 20 MB or more), that does not have a schema (I cannot infer one with XSD.exe because the file structure is odd, check the snippet below)? Options 1) XML Deserialization (but as said, I don't have a schema and XSD tool complains about the file contents), 2) Linq to XML, 3) loading into XmlDocument, 4) Manual parsing with XmlReader & stuff. This is XML file snippet: <?xml version="1.0" encoding="utf-8"?> <xmlData date="29.04.2010 12:09:13"> <Table> <ident>079186</ident> <stock>0</stock> <pricewotax>33.94000000</pricewotax> <discountpercent>0.00000000</discountpercent> </Table> <Table> <ident>079190</ident> <stock>1</stock> <pricewotax>10.50000000</pricewotax> <discountpercent>0.00000000</discountpercent> <pricebyquantity> <Table> <quantity>5</quantity> <pricewotax>10.00000000</pricewotax> <discountpercent>0.00000000</discountpercent> </Table> <Table> <quantity>8</quantity> <pricewotax>9.00000000</pricewotax> <discountpercent>0.00000000</discountpercent> </Table> </pricebyquantity> </Table> </xmlData>

    Read the article

  • can a valid xml body have escaped characters for the '<' and '>' around the element names

    - by prmatta
    My web service is receiving xml from a third party that looks like this: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> &lt;Foo&gt;bar&lt;/Foo&gt; </SOAP-ENV:Body> </SOAP-ENV:Envelope> My jaxws web service rejects this with a parsing error. Also if I try to validate this xml using soapui it says Body with element-only content type cannot have text element. My question is, is that xml valid? Or is the client supposed to send me something without escaping the < and . Any references to xml standards or rules are appreciated.

    Read the article

  • Binding XML in Sliverlight without Nominal Classes

    - by AnthonyWJones
    Lets say I have a simple chunck of XML:- <root> <item forename="Fred" surname="Flintstone" /> <item forename="Barney" surname="Rubble" /> </root> Having fetched this XML in Silverlight I would like to bind it with xaml of this ilke:- <ListBox x:Name="ItemList" Style="{StaticResource Items}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBox Text="{Binding Forename}" /> <TextBox Text="{Binding Surname}" /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Now I can bind simply enough with LINQ to XML and a nominal class:- public class Person { public string Forename {get; set;} public string Surname {get; set;} } So here is the question, can it be done without this class? IOW coupling between the Sliverlight code and the input XML is limited to the XAML only, other source code is agnostic to the set of attributes on the item element. Edit: The use of XSD is suggested but ultimately it amounts the same thing. XSD-Generated class. Edit: An anonymous class doesn't work, Silverlight can't bind them. Edit: This needs to be two way, the user needs to be able to edit the values and these value end up in the XML. (Changed original TextBlock to TextBox in sample above).

    Read the article

  • Mutating XML in Clojure

    - by mac
    Clojures clojure.xml/parse, clojure.zip/xml-zip and clojure.contrib.zip-filter.xml/xml- are excellent tools for pulling values out of xml, but what if I want to change the xml (the result of clojure.zip/xml-zip) based on what I learn from xml- "queries" and write the result back out as xml? I would have expected that (clojure.contrib.prxml/prxml (clojure.xml/parse xml-content)) spit back xml, but that is not the case.

    Read the article

  • RESTful Web Services: Different XML Representation for the same resource

    - by AlexImmelman
    Hi, I'm developing a REST Web Service using a XML format response and I have some problems (Really, one problem). One of my resources has some final fields so once they're created, they can't be modified. According to that, I need different representations for this resource depending on what I'm doing: Creating or modifiying it. What should I do, give to the user different XML-Schemas for the same resource or write just one XML-Schema and read some fields or not depending on the method I'm being requested?? Thanks

    Read the article

  • LINQ to XML via C#

    - by user70192
    Hello, I'm new to LINQ. I understand it's purpose. But I can't quite figure it out. I have an XML set that looks like the following: <Results> <Result> <ID>1</ID> <Name>John Smith</Name> <EmailAddress>[email protected]</EmailAddress> </Result> <Result> <ID>2</ID> <Name>Bill Young</Name> <EmailAddress>[email protected]</EmailAddress> </Result> </Results> I have loaded this XML into an XDocument as such: string xmlText = GetXML(); XDocument xml = XDocument.Parse(xmlText); Now, I'm trying to get the results into POCO format. In an effort to do this, I'm currently using: var objects = from results in xml.Descendants("Results") select new Results // I'm stuck How do I get a collection of Result elements via LINQ? I'm particularly confused about navigating the XML structure at this point in my code. Thank you!

    Read the article

  • Parsing JSON into XML using Windows Phone

    - by Henry Edwards
    I have this code, but can't get it all working. I am trying to get a json string into xml. So that I can get a list of items when i parse the data. Is there a better way to parse json into xml. If so what's the best way to do it, and if possible could you give me a working example? The URL that is in the code is not the URL that i am using using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.Controls; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Utilities; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Schema; using Newtonsoft.Json.Bson; using System.Xml; using System.Xml.Serialization; using System.Xml.Linq; using System.Xml.Linq.XDocument; using System.IO; namespace WindowsPhonePanoramaApplication3 { public partial class Page2 : PhoneApplicationPage { public Page2() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e1) { /* because the origional JSON string has multiple root's this needs to be added */ string json = "{BFBC2_GlobalStats:"; json += DownlodUrl("http://api.bfbcs.com/api/xbox360?globalstats"); json += "}"; XmlDocument doc = (XmlDocument)JsonConvert.DeserializeObject(json); textBox1.Text = GetXmlString(doc); } private string GetXmlString() { throw new NotImplementedException(); } private string DownlodUrl(string url) { string result = null; try { WebClient client = new WebClient(); result = client.DownloadString(url); } catch (Exception ex) { // handle error result = ex.Message; } return result; } private string GetXmlString(XmlDocument xmlDoc) { sw = new StringWriter(); XmlTextWriter xw = new XmlTextWriter(sw); xw.Formatting = System.Xml.Formatting.Indented; xmlDoc.WriteTo(xw); return sw.ToString(); } } } The URL outputs the following code: {"StopName":"Race Hill", "stopId":7553, "NaptanCode":"bridwja", "LongName":"Race Hill", "OperatorsCode1":" 5", "OperatorsCode2":" ", "OperatorsCode3":" ", "OperatorsCode4":"bridwja", "Departures":[ { "ServiceName":"", "Destination":"", "DepartureTimeAsString":"", "DepartureTime":"30/01/2012 00:00:00", "Notes":""}` Thanks for your responses. So Should i just leave the data a json and then view the data via that??? Is this a way to show the data from a json string. public void Load() { // form the URI UriBuilder uri = new UriBuilder("http://mysite.com/events.json"); WebClient proxy = new WebClient(); proxy.OpenReadCompleted += new OpenReadCompletedEventHandler(OnReadCompleted); proxy.OpenReadAsync(uri.Uri); } void OnReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error == null) { var serializer = new DataContractJsonSerializer(typeof(EventList)); var events = (EventList)serializer.ReadObject(e.Result); foreach (var ev in events) { Items.Add(ev); } } } public ObservableCollection<EventDetails> Items { get; private set; } Edit: Have now kept the url as json and have now got it working by using the json way.

    Read the article

  • C# encrypt whole XML File

    - by René
    I already have a solution for encrypting of several XML nodes or strings. But of course, you can open the local saved XML file and you should see the node tags. For some intelligent people it could be a reference for hidden informations. Is there any way to encrypt and decrypt the whole xml content including all node tags?

    Read the article

  • Formatting datetime values returned in a SELECT..FOR XML statement

    - by TelJanini
    Consider the following table: Orders OrderId Date CustomerId 1000 2012-06-05 20:03:12.000 51 1001 2012-06-16 12:02:31.170 48 1002 2012-06-18 19:45:16.000 33 When I extract the Order data using FOR XML: SELECT OrderId AS 'Order/@Order-Id', Date AS 'Order/ShipDate', CustomerId AS 'Order/Customer' FROM Orders WHERE OrderId = 1000 FOR XML PATH ('') I get the following result: <Order Order-Id="1000"> <ShipDate>2010-02-20T16:03:12</ShipDate> <Customer>51</Customer> </Order> The problem is, the ShipDate value in the XML file needs to be in the format M/DD/YYYY H:mm:ss PM. How can I change the output of the ShipDate in the XML file to the desired format? Any help would be greatly appreciated!

    Read the article

  • Code to read & write in XML

    - by user2954088
    I am trying to write code to read and write the XML but I am facing some errors, Could please someone provide the sample code to read XML in grid and can update/insert data from grid which will be saved in following sample xml file. Sample XML file: I am facing the below exception: The assembly with display name '...XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly '.....XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

    Read the article

  • .NET XML Serialization without <?xml> root node

    - by Graphain
    Hi, I'm trying to generate XML like this: <?xml version="1.0"?> <!DOCTYPE APIRequest SYSTEM "https://url"> <APIRequest> <Head> <Key>123</Key> </Head> <ObjectClass> <Field>Value</Field </ObjectClass> </APIRequest> I have a class (ObjectClass) decorated with XMLSerialization attributes like this: [XmlRoot("ObjectClass")] public class ObjectClass { [XmlElement("Field")] public string Field { get; set; } } And my really hacky intuitive thought to just get this working is to do this when I serialize: ObjectClass inst = new ObjectClass(); XmlSerializer serializer = new XmlSerializer(inst.GetType(), ""); StringWriter w = new StringWriter(); w.WriteLine(@"<?xml version=""1.0""?>"); w.WriteLine("<!DOCTYPE APIRequest SYSTEM"); w.WriteLine(@"""https://url"">"); w.WriteLine("<APIRequest>"); w.WriteLine("<Head>"); w.WriteLine(@"<Field>Value</Field>"); w.WriteLine(@"</Head>"); XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ns.Add("", ""); serializer.Serialize(w, inst, ns); w.WriteLine("</APIRequest>"); However, this generates XML like this: <?xml version="1.0"?> <!DOCTYPE APIRequest SYSTEM "https://url"> <APIRequest> <Head> <Key>123</Key> </Head> <?xml version="1.0" encoding="utf-16"?> <ObjectClass> <Field>Value</Field> </ObjectClass> </APIRequest> i.e. the serialize statement is automatically adding a <?xml root element. I know I'm attacking this wrong so can someone point me in the right direction? As a note, I don't think it will make practical sense to just make an APIRequest class with an ObjectClass in it (because there are say 20 different types of ObjectClass that each needs this boilerplate around them) but correct me if I'm wrong.

    Read the article

  • SSIS - XML Source Script

    - by simonsabin
    The XML Source in SSIS is great if you have a 1 to 1 mapping between entity and table. You can do more complex mapping but it becomes very messy and won't perform. What other options do you have? The challenge with XML processing is to not need a huge amount of memory. I remember using the early versions of Biztalk with loaded the whole document into memory to map from one document type to another. This was fine for small documents but was an absolute killer for large documents. You therefore need a streaming approach. For flexibility however you want to be able to generate your rows easily, and if you've ever used the XmlReader you will know its ugly code to write. That brings me on to LINQ. The is an implementation of LINQ over XML which is really nice. You can write nice LINQ queries instead of the XMLReader stuff. The downside is that by default LINQ to XML requires a whole XML document to work with. No streaming. Your code would look like this. We create an XDocument and then enumerate over a set of annoymous types we generate from our LINQ statement XDocument x = XDocument.Load("C:\\TEMP\\CustomerOrders-Attribute.xml");   foreach (var xdata in (from customer in x.Elements("OrderInterface").Elements("Customer")                        from order in customer.Elements("Orders").Elements("Order")                        select new { Account = customer.Attribute("AccountNumber").Value                                   , OrderDate = order.Attribute("OrderDate").Value }                        )) {     Output0Buffer.AddRow();     Output0Buffer.AccountNumber = xdata.Account;     Output0Buffer.OrderDate = Convert.ToDateTime(xdata.OrderDate); } As I said the downside to this is that you are loading the whole document into memory. I did some googling and came across some helpful videos from a nice UK DPE Mike Taulty http://www.microsoft.com/uk/msdn/screencasts/screencast/289/LINQ-to-XML-Streaming-In-Large-Documents.aspx. Which show you how you can combine LINQ and the XmlReader to get a semi streaming approach. I took what he did and implemented it in SSIS. What I found odd was that when I ran it I got different numbers between using the streamed and non streamed versions. I found the cause was a little bug in Mikes code that causes the pointer in the XmlReader to progress past the start of the element and thus foreach (var xdata in (from customer in StreamReader("C:\\TEMP\\CustomerOrders-Attribute.xml","Customer")                                from order in customer.Elements("Orders").Elements("Order")                                select new { Account = customer.Attribute("AccountNumber").Value                                           , OrderDate = order.Attribute("OrderDate").Value }                                ))         {             Output0Buffer.AddRow();             Output0Buffer.AccountNumber = xdata.Account;             Output0Buffer.OrderDate = Convert.ToDateTime(xdata.OrderDate);         } These look very similiar and they are the key element is the method we are calling, StreamReader. This method is what gives us streaming, what it does is return a enumerable list of elements, because of the way that LINQ works this results in the data being streamed in. static IEnumerable<XElement> StreamReader(String filename, string elementName) {     using (XmlReader xr = XmlReader.Create(filename))     {         xr.MoveToContent();         while (xr.Read()) //Reads the first element         {             while (xr.NodeType == XmlNodeType.Element && xr.Name == elementName)             {                 XElement node = (XElement)XElement.ReadFrom(xr);                   yield return node;             }         }         xr.Close();     } } This code is specifically designed to return a list of the elements with a specific name. The first Read reads the root element and then the inner while loop checks to see if the current element is the type we want. If not we do the xr.Read() again until we find the element type we want. We then use the neat function XElement.ReadFrom to read an element and all its sub elements into an XElement. This is what is returned and can be consumed by the LINQ statement. Essentially once one element has been read we need to check if we are still on the same element type and name (the inner loop) This was Mikes mistake, if we called .Read again we would advance the XmlReader beyond the start of the Element and so the ReadFrom method wouldn't work. So with the code above you can use what ever LINQ statement you like to flatten your XML into the rowsets you want. You could even have multiple outputs and generate your own surrogate keys.        

    Read the article

  • Parse an XML file

    - by karan@dotnet
    The following code shows a simple method of parsing through an XML file/string. We can get the parent name, child name, attributes etc from the XML. The namespace System.Xml would be the only additional namespace that we would be using. string myXMl = "<Employees>" + "<Employee ID='1' Name='John Mayer'" + "Address='12th Street'" + "City='New York' Zip='10004'>" + "</Employee>" + "</Employees>"; XmlDocument xDoc = new XmlDocument();xDoc.LoadXml(myXMl);XmlNodeList xNodeList = xDoc.SelectNodes("Employees/child::node()");foreach (XmlNode xNode in xNodeList){ if (xNode.Name == "Employee") { string ID = xNode.Attributes["ID"].Value; //Outputs: 1 string Name = xNode.Attributes["Name"].Value;//Outputs: John Mayer string Address = xNode.Attributes["Address"].Value;//Outputs: 12th Street string City = xNode.Attributes["City"].Value;//Outputs: New York string Zip = xNode.Attributes["Zip"].Value; //Outputs: 10004 }} Lets look at another XML: string myXMl = "<root>" + "<parent1>..some data</parent1>" + "<parent2>" + "<Child1 id='1' name='Adam'>data1</Child1>" + "<Child2 id='2' name='Stanley'>data2</Child2>" + "</parent2>" + "</root>"; XmlDocument xDoc = new XmlDocument();xDoc.LoadXml(myXMl);XmlNodeList xNodeList = xDoc.SelectNodes("root/child::node()"); //Traverse the entire XML nodes.foreach (XmlNode xNode in xNodeList) { //Looks for any particular nodes if (xNode.Name == "parent1") { //some traversing.... } if (xNode.Name == "parent2") { //If the parent node has child nodes then //traverse the child nodes foreach (XmlNode xNode1 in xNode.ChildNodes) { string childNodeName = xNode1.Name; //Ouputs: Child1 string childNodeData = xNode1.InnerText; //Outputs: data1 //Loop through each attribute of the child nodes foreach (XmlAttribute xAtt in xNode1.Attributes) { string attrName = xAtt.Name; //Outputs: id string attrValue = xAtt.Value; //Outputs: 1 } } }}  

    Read the article

  • IIS MIME type for XML content

    - by Rodolfo
    recently a third party plugin I'm using to display online magazines stopped working on mobile devices. According to their help page, this happens for people serving with IIS. Their solution is to set the MIME type .xml to "application/xml". It's by default set to "text/xml". Changing it does work, but would that have unintended side effects or is it actually the correct way and IIS just set it wrong?

    Read the article

  • .XML Sitemaps and HTML Sitemaps Clarification

    - by MSchumacher
    I've got a website with about 170 pages and I want to create an effective Sitemap for it as it is long due. The website is internally linked very well but I still want to take advantage of creating a sitemap to allow SE's to crawl my site easier and to hopefully increase my websites PR. Though I am slightly confused to what I must do: Is it necessary to create a .xml sitemap AND a HTML Sitemap (both)? ... Because I've never worked with .xml ... where do I put this file once it's created? In the Root folder? So I assume that this sitemap.xml is ONLY to be read by spiders and NOT by website visitors. IE: No visitor on my website is going to visit the page sitemap.xml, am I correct? ... Hence why I should also create an HTML sitemap (sitemap.htm)?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >