Model, validate, transform, and exchange structured data. Learn XML schemas, XPath, XSLT, DOM vs SAX, serialization, namespaces, and integration patterns for configuration, messaging, and document workflows across platforms.
276 posts160 contributors
In this article, we will learn how to create an XML file in-memory and write it to the local storage using C# and .NET.
Today, more and more applications are migrating to the Web and the Cloud services are taking over the world; XML has become one of the key and vital parts of the data exchange mechanism. Whether you are developing client centric applications or building a consumer product, you will end up working with XML.
Programming XML with C# is a 65 pages book written for C# programmers who wish to learn how to work with XML documents using C# language. In this book, you will learn the basic elements of XML and classes and objects available in .NET Framework to work with XML.
This article shows you how to use MSBuild to build your project and how to create a custom task that will allow you to modify sections of your XML configuration files.
How can we sanitize an XML or SVG file when it is 10 GB in size and uploaded through TUS multipart with multiple concurrent users? The file must be uploaded to S3
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(w3schools.com/xml/schema_facets.asp) but it does not worked when i add this pattern: <xs:restriction base="xs:Double"> <xs:pattern value="[0-9]| 'exist'"/> </xs:restriction> how to fix that ?
XSLT (XML Stylesheet Transformation) is a powerful language used for converting XML documents into various formats. It utilizes an XSLT processor to parse input XML and the associated stylesheet, executing defined transformation instructions.
This album allows you to drag your images directly from Windows Explorer into the spot you want your picture to occupy. You can also edit the captions by clicking on the labels under the pictures.
Using XML in .NET Core Web API simplifies data management by encapsulating complex data structures into a single format. This reduces method complexity, minimizes errors, and enhances interoperability with legacy systems.
Generating XML dynamically with a defined schema involves handling namespaces and prefixes correctly. Using XmlElement and XmlAttribute classes helps serialize XML parts, but achieving a prefixed root node like sl : RandomWindow requires careful setup of XmlRoot attributes.
Learn to parse and manipulate XML data in C# effortlessly. Utilize XML readers, XPath, or LINQ to XML for efficient XML processing. Handle XML documents, elements, attributes, and namespaces seamlessly within your C# applications.
Develop a Windows application to read an XML file and perform insert, search, update, and delete operations on student records. The form includes a DataGridView, PictureBox, OpenFileDialogs, Labels, TextBoxes, and Buttons to display and manipulate data.
Learn how to use .NET reflection and XmlDocument to map XML element and attribute values to properties of a C# class.
I have been using the code example here for creating-excel-file-using-openxml this is simple enough code and it does work nicely i can send my data and save it as an .xlsx file. However when i open the file it is corrupted and needs to be opend as repaired. when i do open it all the data is there the formatting/styles are nissing but all the data is there. looking at the log file i see this <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <recoveryLog xmlns="------schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error290880_01.xml</logFileName><summary>Errors were detected in file 'D:\M36_Results_22_04_2024 2_46_34 PM.xlsx'</summary><repairedRecords><repairedRecord>Repaired Records: Format from /xl/styles.xml part (Styles)</repairedRecord><repairedRecord>Repaired Records: Cell information from /xl/worksheets/sheet1.xml part</repairedRecord></repairedRecords></recoveryLog> any help appreciated. i am new to openXML
This article presents a method for generating Excel/Word/HTML documents in C# using ADO.Net dataset. By internally generating XML and XSL documents, it transforms them into well-formatted HTML files. The CreateDocument function facilitates file creation based on parameters.
hi, i have been using jquery to get data from database using controllers and then use looping or if then else of javascript and css. to transform the html. need to know where practically xslt can help?( basically i do not want to add extra technologies) yours sincerly
Someone can help me, I had in a XMLDocument variable the following: <autorizaciones><autorizacion><estado>aaa</estado><numeroAutorizacion>2011202</numeroAutorizacion><fechaAutorizacion>2023-11-20T10:30:14-05:00</fechaAutorizacion><ambiente>prueba</ambiente><comprobante><?xml version="1.0" encoding="UTF-8"?> <factura id="comprobante" version="1.0.0"> <infoTributaria> <ambiente>2</ambiente> <tipoEmision>1</tipoEmision> <razonSocial>EMPRESA</razonSocial> <nombreComercial>EMPRESA</nombreComercial> <ruc>0993222011001</ruc> <claveAcceso>2011202</claveAcceso> <codDoc>01</codDoc> <estab>001</estab> <ptoEmi>002</ptoEmi> <secuencial>000107272</secuencial> <dirMatriz>AV 25 DE Y 8 VO CLLJN</dirMatriz> </infoTributaria></comprobante><mensajes /></autorizacion></autorizaciones> I want to save to a file in the following format: <autorizaciones><autorizacion><estado>aaa</estado><numeroAutorizacion>2011202</numeroAutorizacion><fechaAutorizacion>2023-11-20T10:30:14-05:00</fechaAutorizacion><ambiente>prueba</ambiente><comprobante><![CDATA[<?xml version="1.0" encoding="UTF-8"?> <factura id="comprobante" version="1.0.0"> <infoTributaria> <ambiente&g
In this blog, I will explain how to deserialize an XML file with an array and single nodes.
In this article I will explain how to create an Excel file using C# without any third party paid dll files or Microsoft Interop services, but OpenXml dll, which is free and available in a nuget package.
In this tutorial, you will learn how to read and write XML documents in Microsoft .NET using C# language.
I want fill dependent dropdown by XML file which be create(data by sql server) on session intialization.
Learn how W3C XML Signatures work and how to use .NET SignedXml classes in C# to sign and verify complete or partial XML documents.
How we can optimize SVG Files for Web Performance Complete Guide
Hi, I am have below input xml, I want to remove special characters from all nodes through xslt, please help me <?xml version="1.0" encoding="UTF-8"?> <data> <row id="tE9BC880F01DC4A7CA1B261A3BF04DBE8"> <Title>Notice</Title> <Name>Abhi</Name> <Address>Janpath-Building 1 & 2, near Western Court, Janpath, New Delhi, Delhi-110001</Address> <Phone>98765-43210</Phone> </row> <row id="tE9BC880F01DC4A7CA1B261A3BF04DBE8"> <Title>CancellationNotice</Title> <Name>O'Niel</Name> <Address>C-56, G Block BKC, Bandra Kurla Complex, Bandra East, Mumbai, Maharashtra 400098</Address> <Phone>98765-11221</Phone> </row> </data>
Hi I have an issue while convert data table into XML Error: Cannot serialize the DataTable. DataTable name is not set. What I have tried : Public Function ConvertDatatableToXML(ByVal dt As DataTable) As String Dim str As MemoryStream = New MemoryStream() dt.WriteXml(str, True) str.Seek(0, SeekOrigin.Begin) Dim sr As StreamReader = New StreamReader(str) Dim xmlstr As String xmlstr = sr.ReadToEnd() Return (xmlstr) End Function Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click Dim dt As DataTable = New DataTable() dt = GetData() Dim XMLstring As String = clsAPI.ConvertDatatableToXML(dt) Me.txtComments.Text = XMLstring End Sub Public Function GetData() As DataTable Dim dt As New DataTable Dim adp As New SqlDataAdapter("usp_TR_Data", conn) adp.SelectCommand.CommandType = CommandType.StoredProcedure adp.SelectCommand.CommandTimeout = 150 With adp.SelectCommand.Parameters .Clear() .Add("@Action", SqlDbType.NVarChar).Value = "CONVERT-XML" .Add("@SONo", SqlDbType.NVarChar).Value = Me.txtSONo.Text End With adp.Fil
Firstly, im vrey very new to xml and schemas, so apologies if this question is brutally basic. I have created a schema, and am importing another schema that contains a complex type. I am getting the error "type http://myNamespace2.com/songSchema is not declared" I have followed a number of tutorials and cant see where i have gone wrong. can anyone advise? Here is the main schema. The second schema is the one i am importing. Thanks all. <?xml version="1.0" encoding="utf-8"?> <xs:schema id="XMLSchema1" targetNamespace="http://myNamespace1.com/XMLSchema1" elementFormDefault="qualified" xmlns="http://myNamespace1.com/XMLSchema1" xmlns:mstns="http://myNamespace1.com/XMLSchema1" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sn="http://myNamespace2.com/songSchema"> <xs:import namespace="http://myNamespace2.com/songSchema" schemaLocation="C:\Development_Projects\XMLReaderWriter\XMLReaderWriter\XMLReaderWriter\songSchema.xsd"/> <xs:element name="Record"> <xs:complexType> <xs:sequence> <xs:element name="RecordType" type="xs:string"/> <xs:element name="Artist" type ="xs:string"/> <xs:element name="NumSongs" type ="xs:int"/> <xs:element name="SongDetails" type="sn:Song"/> <!--ERROR OCCURS HERE--> </xs:sequence> </xs:complexType>
Hello! in C# - how can i use a variable in this SelectSingleNode statement? assuming fieldId is a var or string. XmlElement elt = xml.SelectSingleNode(String.Format("responses/response/fieldset/field[@id={0}']", fieldId)) as XmlElement; thanks!