Click here to Skip to main content
15,888,351 members
Everything / Programming Languages / XML

XML

XML

Great Reads

by Alex Pumpet
A simple program for comparing table data from two sources - SQL databases, Excel, CSV or XML-files
by shunninghuang
CPS1 emulator, ROM hacking
by David Rogers Dev
Learn how to load related entities using the Entity Framework with simple examples
by Thomas Weller
Demonstrates how to run Python scripts from C#

Latest Articles

by Shao Voon Wong
C++ SAX library to simplify XML parsing
by Shao Voon Wong
Tutorial on a cross-platform C++ XML DOM library
by Macabies Gilles
An easy-to-use filterable, multilingual custom DataGrid control for managing and filtering data for your WPF applications
by Ștefan-Mihai MOGA
A look at the URLDownloadToFile function and architecture of IntelliLink

All Articles

Sort by Updated

XML 

22 May 2010 by #realJSOP
Don't reinvent the wheel - use the one that's already on the cart.
23 Mar 2010 by #realJSOP
It's a static class that's initialized when the application starts. There are no events associated with the class.
14 Apr 2010 by #realJSOP
You don't have to change it to XML. Get the HtmlAgility library, and use that. You can find it on CodePlex, and I'll leave the googling to you.
10 Jul 2014 by #realJSOP
Extension methods can help you avoid sticky situations.
21 May 2010 by #realJSOP
If it's a collection of complex objects (versus simple intrinsic types), you could create a property that can returns the objects as XElements, or you could use XML serialization. I personally prefer the property approach.If they're not complex types, you could write extension method...
25 May 2010 by #realJSOP
The following usis Xml.Linq (I prefer this to the original Xml classes in .Net 2.0). Caveat - I did this from memory, so you may have to tweak it a little).XDocument doc = XDocument.Load(xm_Uri);XElement root = doc.Element("JOBS/JOB/CATEGORIES");foreach (XElement element in...
16 Jun 2010 by #realJSOP
Your parameters have to be escaped.Instead of having the pointy brackets, you have to use "" in your string.
19 Jun 2010 by #realJSOP
At the most very basic, it's called "programming". You put a bunch of code into if/then blocks (or whatever control mechanism might be appropriate) and then, under the appropriate conditions, that code will be or won't be executed.I don't see what's so hard about that concept.
23 Jul 2010 by #realJSOP
You can't load files from the client's machine. The error message is telling you that.
9 Aug 2010 by #realJSOP
There are many approaches to doing what you need to do. This is where you use that skill you haven't developed yet - analysis. The XML you've provided is simple in its content, and it isn't that hard to work out what you need to do. Beyond that, nobody here is going to actually write the...
6 Oct 2010 by #realJSOP
Read the file as a text file, and use XElement.Parse() to parse the text. Put the code into a try/catch block just in case you end up parsing something that isn't identifiable as XML.
12 Nov 2010 by #realJSOP
Did you try googling it? There are hundreds of thousands of results, including right here on codeproject.
3 Dec 2010 by #realJSOP
If you're using .Net 3.0 or higher, you can use Linq-To-Xml.
8 Dec 2010 by #realJSOP
You need to pass the XML data to the stored procedure, and in SQL Server, specify a XML parameter in the stored procedure prototype. Google is your friend.
16 Dec 2010 by #realJSOP
Is it really that hard to type "google.com" in your browser?http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx[^]
27 Dec 2010 by #realJSOP
Your question is stated so poorly that nobody can possibly give you the answer you need. You didn't mention the platform, language, or what type of database you're using, so we have to guess at those as a well. Loading and parsing the XML file in the application is actually a very simple...
11 Jan 2011 by #realJSOP
You shouldn't care if something is missing. If you're serializing data into an object, that object should know how to correct erroneous data on its own byy applying default values that don't cause the ob ject to throw an exception.
18 Jan 2011 by #realJSOP
Use HttpWebRequest, and you'll get a web page back. At that point, you can parse the html/xml. There are several CodeProject articles that discuss how to do these things. I've written a couple, as have others:CodeProject Article Scraping[^]CodeProject Article Scraper,...
19 Jan 2011 by #realJSOP
If you're ultimately looking for the value of the hour element, just get the InnerText for the child node instead of the node you're getting it for now.
21 Jan 2011 by #realJSOP
There are a number of ways to get the data into XML, and Xml serialization would probably be the easiest way, assuming that when you read your data in from the text file, you're creating objects, and not just trying to go right from the string values to XML.When I have to do something like...
11 Feb 2011 by #realJSOP
Check this link.http://msdn.microsoft.com/en-us/library/ms256097.aspx[^]I think you need to set the line break to \r\n to see an actual line break in your data.
1 Mar 2011 by #realJSOP
Why don't you just load the file as text, and do approproriate Replace calls on it:string myXML = // load the file into this stringmyXML = my.XML.Replace("", "").Replace("", "");myXML = my.XML.Replace("",...
1 Mar 2011 by #realJSOP
I still think loading it as text and doing replace based on tag names in a app.config is easier, but with some minor googling, I found this example, and you could have to: ...
20 Apr 2011 by #realJSOP
Try this:Dim data2 = (From datafield In ser.Descendants("datafield") Where (datafield.Attribute("tag").Value = "245" And datafield.Elements.Count >= 2) Select datafield.Elements.ElementAt(1))
3 May 2011 by #realJSOP
The limiting factors are disk structure (e.g. FAT or NTFS), the internal code in the Operating System kernel which limits the address space (32-bit or 64-bit), and/or the ability of the application program to address large files (again, 32-bit or 64-bit).Also, keep in mind that the amount of...
6 May 2011 by #realJSOP
Why do you want to reassign a var that was previously assigned as a XElement to a string if it's null?If there's anything you want to do to Num090 after setting it to a value, I'd move the declaration outside the Try block, and do your post processing in the Finally block.
13 Jun 2011 by #realJSOP
There's really no way around slugging it out from scratch. Every customer has his own bizarre ideas about how it should work and what it should look like. The best you can do is to keep the various layers as separated as possible. Write a basic db schema, a business layer to interact with it,...
1 Jul 2011 by #realJSOP
XDocument doc = XDocument.Load(filename);...... blah blah...filename = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), filename);doc.Save(filename);
5 Jul 2011 by #realJSOP
You can also put this into your .aspx.cs file.using System.Text;I don't know why none of the project templates include this (and System.IO) by default yet. I need both in practically every project I create.
26 Jul 2011 by #realJSOP
First, you don't need a web service to do "make the file accessible". Just code up a web page that has no rendered output and that does a Response.WriteFile with the file in question. You don't need to parse the file to make it accessible. Your question is vague at best.
18 Aug 2011 by #realJSOP
I suspect that every once in a while your xmlTag value contains one or more whitespace characters). If yu run it under the debugger, and inspect the variable when it throws the exception, you can verify my assumption.If your table contains columns with spaces in their names, shame on you....
2 Sep 2011 by #realJSOP
The first thing I see is that your new statement is junk. It should be something like this:var result = from ele in doc.Descendants() where ele.HasElements == false //read leaf node select new SomeObject(){ ParentName=ele.Parent.Name, Name=ele.Name ,...
7 Sep 2011 by #realJSOP
So what's your actual problem? Is your code wrong, or is the server not using the latest version of the file? Or both?Delete your cache in the browser, and then try again.
8 Sep 2011 by #realJSOP
Just change the extension from .xml to .txt, and there you have it.BTW, a XML file is already plain text.
26 Dec 2011 by #realJSOP
Pretty much every language in use today is capable of using XML.
29 Sep 2016 by #realJSOP
You have to escape Unicode characters with &# when using them in XML.Google is your friend.
14 Nov 2016 by #realJSOP
I would build a supporting model in code, load and parse the entire xml file, and then use LINQ on the model to find what I'm after.
25 Nov 2016 by #realJSOP
Add an overload of the constructor that doesn't accept parameters. The error tells you exactly what's wrong.public NpcEquippedGear(){}Of course, you could make things easier on yourself and change the inherited class from IEnumerable to List:public class NpcEquippedGear :...
9 Dec 2016 by #realJSOP
I would de-serialize the xml data into an appropriate model, and then use LINQ to find the crap I want in the model instead of dickin' around with parsing the xml on the fly. But that's just me.
30 Jan 2017 by #realJSOP
0) Use a class instead of a struct.1) Use serialization to load/save the xml.
28 Feb 2018 by #realJSOP
Your design is inefficient and needlessly increases project complexity. I would do it with ONE multi-threaded service that does NOT use FileSystemWatcher. The main thread would monitor the folder in question for new files (I would use React/Rx library for this). When a new file is detected,...
25 Mar 2018 by #realJSOP
Learn how to use the Visual Studio debugger. I CANNOT stress this enough. Put a try/catch block around your code and put a breakpoint on one of the catch block curly brackets so the debugger will stop when an exception is throw. Believe it or not, it will TELL YOU exactly which line the problem...
18 Oct 2018 by #realJSOP
I think you're going to have to parse the file as if it was just a text file. I would consider creating a class that loads the file one line at a time into a List object, and then use linq to drill down into the list. Your main problem is that you need to handle at least three element...
22 Oct 2018 by #realJSOP
Why don't you just use DataTable.ReadXML(). At that point, it would be MUCH easier to get the data into a SQL Server database. For info, on that, go here: Google[^]
4 Apr 2019 by #realJSOP
Use LinqwToXML to load the document, add your new data, and save the document. Easy peazy lemon squeezy.
12 Apr 2019 by #realJSOP
I wrote extension methods to return a default value if the element didn't exist. Go to this CP article: Downloads: SQLXAgent - Jobs for SQL Express - Part 1 of 6[^] and scroll down to SqlxCommon\FileExtensions, and look for ExtendLinqToXML.cs BTW, I generally don't us the built-in .Net...
22 May 2019 by #realJSOP
Google this: c# deserialize nested xml
16 Dec 2019 by #realJSOP
Put a try/catch block around your code so you can see where the exception is being thrown. BTW, it's an Invalid Operation exception.
8 Apr 2020 by #realJSOP
If you're talking about reloading it into a desktop application, you set up a FileSystemWatcher object that reacts to changes to the desired file. Alternatively, you could create a thread that does something similar (I would do it this way...
14 Jul 2020 by #realJSOP
Try reducing the BatchSize to 1000 (500,000) seems way to high to be efficient). It will be obvious within a second or two if it's going to work. by simply monitoring the row count in the target table. Another option is to read a certain...
4 Mar 2021 by #realJSOP
Build a proper entity (model) in your app, and let the xml serializer handle the nasty stuff...
1 Apr 2021 by #realJSOP
I think you're better off using serialization. The topic of serialization is honestly too big to cover in a QA answer, but it's easy to find info on the google machine. There's a lot of prep to use it correctly, but once you've got your entities...
1 Jun 2021 by #realJSOP
Create an entity that matches the structure, and then use the built-in XML deserialize functionality in .Net. Deserializing only requires a few lines of code to implement once you'd created an appropriate entity in which to consume the data.It...
9 Dec 2021 by #realJSOP
0) Instead of providing the filename like you're doing, create a string constant set to the filename, and then use the filename constant. Doing this will make it possible to change the filename in one place and not worry about whether or not you...
15 Jul 2001 by (Steven Hicks)n+1
Learn the basics of WML without any previous knowedge of XML
16 Oct 2006 by --==## Andy74 ##==--
Use a personal provider to manage users and roles in a web application.
10 Jan 2015 by .Net Jim
There are a variety of ways to do this. That said there are a few key questions to shape your choices. First, can your users learn to import the xml into Excel? Excel has been able to import xml for over a decade. The key to doing this successfully is to avoid attributes in xml. Just name...
24 Oct 2020 by .Net Perfect Dev
Hello, I have an xml document
8 Nov 2020 by .Net Perfect Dev
Hello, I try to serialize a n object to xml file.this object containt a property length [System.Xml.Serialization.XmlAttributeAttribute()] [System.ComponentModel.DefaultValueAttribute(1D)] public double Length { ...
1 Mar 2022 by .Net Perfect Dev
Hello, I wrote a simple program which allows to test the number in double type. The objective is to read an xml file according to the decimal symbol chosen by the user. when the user changes the configuration of decimal symbol the program must...
13 Jun 2022 by .Net Perfect Dev
​ Hello, i want to validate by xsd an attribute can contain a float type or a word "exist". after search in the net i found this solution(https://www.w3schools.com/xml/schema_facets.asp)� but it does not worked. how to fix that ? ​ What I have...
13 Jun 2022 by .Net Perfect Dev
ok this is an exemple : xml file: and this is the xsd file which i tried:
6 Nov 2012 by 07405
Hi.. This is my xml...
20 Nov 2012 by 07405
Hi...i am very new to javascript. how to call restful web services using javascript. function CreateXMLHttpRequest() { if (typeof XMLHttpRequest != "undefined") { //All modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) uses...
22 Nov 2012 by 07405
Hi...i want to call rest services using javascript. my code isfunction CreateXMLHttpRequest() { if (typeof XMLHttpRequest != "undefined") { alert("1"); //All modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) uses...
23 Nov 2012 by 07405
I have to call Rest Services using javascript. My code is:function CreateXMLHttpRequest() { if (typeof XMLHttpRequest != "undefined") { return new XMLHttpRequest(); } else if (typeof ActiveXObject != "undefined") { return new...
23 Nov 2012 by 07405
I found solution in this article:Consuming WCF REST Services Using jQuery AJAX Calls[^]
26 Nov 2012 by 07405
My code is:var userName = document.getElementById("txtSearch").value; var xhr = new XMLHttpRequest(); xhr.open("POST", "http://www.rest.net/services/abc.svc/json/GetXml", true); xhr.responseType = "text"; xhr.setRequestHeader("Content-Type", "text/xml;charset=UTF-8"); ...
13 Feb 2013 by 09hadi
Hi, Going for something like reading an xml file which looks like this:
15 Feb 2013 by 09hadi
reader.ReadToFollowing("alarm"...
11 Jan 2014 by 1Future
Hi Guys,I have simply created a table in HTML with 2 cells.The first cell entitled "film name" and the second cell empty.I would to fill the second cell with a film title from an external source (xml file). How can I go about in doing this? thank you for your help in advance, new to...
12 Jan 2014 by 1Future
I have created an XML and XSL file to be loaded onto a webpage as HTML. for some reason this is not working .. the data isn't being displayed in a table on to a web browser.Here is my code below, is there anything that i am missing? please help?XML file
13 Jan 2014 by 1Future
i have created a table using HTML, XML and XLST. the I am creating a table using a for-each loop which inserts the data from the xml file.Once the table is filled with data, i would like every cell that is clicked to display dialogue message box.Code for XML file: ...
26 Jun 2011 by 2irfanshaikh
Try the below link:LINQ to XML[^]Manipulate XML data with XPath and XmlDocument (C#)[^]
21 Dec 2006 by 2sky
A brief overview of how the Hera Application Framework aids you in the development of data-driven applications.
14 Jul 2015 by 34nilesh
How to generate binary tree(graphically) dynamically using HTML css java script and xml.Tree should be generate according to XML data (parent child relationship).
20 Oct 2019 by 3razOr1993
I want to parse a xml file and save it as a txt file. My XML-File looks like follows: I am just interested in the attribute type inside the class ATTRIBUTE. I want just to display the values Demonstration and Portfolio in a text file
28 Feb 2006 by 3sL
Dynamically load DLLs, configure them, and use different DLLs / stubs when unit testing and when using the production version.
31 Jul 2017 by 420 Man
I am trying to setup an editing tool for website employees to be able to edit and update their information stored in an xml database. This is a small interactive area I am putting together for a small business with a low budget. I already have databases setup for the rest of the site. No insults...
6 Feb 2010 by 4277480
http://msdn.microsoft.com/en-us/library/aa192546(office.11).aspx[^]
5 Mar 2015 by 65Goat
This contest submission is for a home monitoring solution that reads temperature, humidity and states from various sensors around a home. The data is stored in Azure and can be accessed via mobile devices.
29 Aug 2010 by 69stephen
this is the xml listing.xmlusing linq to xml it never returns Elements from the query listing.Descendants("StreetName") here is the code snippet string queryURI =...
26 Jul 2013 by 7045Jeegnesh
For insert 4000 record, i created XML query and send it to sql server,and my procedure at sql server is look like thisCreate Procedure InsertUpdate_MSLFrequencyMaster_XML( @xml As Xml)AsBegin Insert Into MSLFrequencyMaster(cMSLClass, nSpecialtyNo, nValue, iYear,...
24 Aug 2013 by 7045Jeegnesh
Make less XMl String as much as possible. I remove extra column from the code side and then make Xml string. All other extra record i added in the procedure.
2 Feb 2016 by 7045Jeegnesh
There is tagichicsr_ASdeerrAnd DTD Tag Validation is it's only Validating attribute of Node. it possible to Check VALUE of Nodei.e Value Of Node "Messagetype" Should Be -"ichicsr". or...
30 Aug 2012 by 77Jeff
Is there any way to use an XML file as a cell map for copy/paste between 2 different excel sheets. I am using C# to write a program that would first copy specific cell values from one sheet and then paste the cell values to a different sheet. The cell values are all text. I would like to use an...
10 Dec 2013 by @BangIndia
I am using gcc compiler for building c++ code.I need a xml parser which has to support both windows and linux environment. Can any one suggest on this..
30 Jan 2014 by @donis2014
How to configure IIS Express "applicationhost.config" for handler mappings
29 Mar 2017 by @rpit Trivedi
Try to convert your xml string variable into XmlDocument and then pass that xml object to your Sql query as parameter.protected void UploadXML(object sender, EventArgs e) { string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName); string filePath...
17 Sep 2012 by __TR__
Refer these linksAdd HTML to XML Data[^]Beginners Introduction To XSL Transform : Rendering XML Data using XSL - Get HTML output[^]Loading XML data to HTML table using XML DSO object and JavaScript[^]
2 Dec 2012 by __TR__
Try this. It is a slight modification to the query posted by AmitGajjarSELECT x.y.value( 'Name[1]', 'NVARCHAR(20)' ) AS Name, x.y.value( 'Color[1]', 'NVARCHAR(20)' ) AS Color, REPLACE(REPLACE(CAST (x.y.query( 'Detail[1]') AS NVARCHAR(50)), '',''),'','') FROM...
23 Feb 2006 by _ABHILASH_MS_
A simple example on using the BizTalk Server.
30 Jun 2012 by _Amy
Hi,Here is a grate article on grouping header:Group GridView Data[^] http://www.csharpaspnetarticles.com/2008/11/merging-gridview-headers-to-have.htmlhttp://redsouljaz.wordpress.com/2009/06/12/create-multiple-row-group-header-in-gridview-asp-net/Follow the above link..You'll find...
11 Sep 2012 by _Amy
Refer the links below forArticles:http://kavstech.blogspot.com/2009/07/append-new-node-in-xml-file.html[^]http://kavstech.blogspot.com/2009/06/how-to-remove-nodes-from-xml.html[^]and Similar Threads:...
21 Mar 2013 by _Amy
Try this:public DataTable fnXMLToDataTable(string filePath){ //create the DataTable that will hold the data DataTable table = new DataTable("XmlData"); try { //open the file using a Stream using(Stream stream = new FileStream(filePath, FileMode.Open,...
13 Jun 2013 by _Amy
Try this:if (window.DOMParser) { var parser = new DOMParser(); var doc = parser.parseFromString(stringContainingXMLSource, "application/xml"); return doc;}Refer : Creating a DOMParser[^].--Amit
30 Jul 2014 by _Amy
You need to learn Basics of Web Services and How it interacts with the Client[^].Then you can easily use it in your project. Refer the links below for few articles which describes the use of it.ASP.NET Web Service[^]Creating the Web Sevice[^]MSDN : Web Services with ASP.NET[^]Web...
24 Aug 2014 by _Amy
Why do you need to store entire XML in a variable? Instead you can create a function to read XML File. If you still want to do so, use:XDocument doc = XDocument.Load("XMLFile1.xml" );[Update]//Calling a functionXDocument doc = MyFunction();//Function Hereprivate XDocument...