How to return Different Response Formats (JSON, XML) in Flask REST API

Here I am going to show you how to return different response formats (content negotiation) from Flask REST API. The default response format you receive from the REST API is JSON (JavaScript Object Notation). Now for some requirements you may need to return XML format from your REST API. Then this example may help you how to do it. I…

How to return Different Data Formats (JSON, XML) from Spring REST API

Introduction Here I am going to show you an example on how to return different data formats from REST API using Spring Boot framework. You may have a requirement that you need to return multiple formats, such as XML, JSON, etc., from the REST response, then this example may help you. This example will return XML and JSON format depending…

How to convert XML to CSV using Python

In this example you are going to see how you can convert XML data into CSV data. XML is an Extensible Markup Language and CSV is Comma Separated Values. In this example I am going to read both XML file and XML string and show you how to display the converted csv string data in console as well as in…

How to convert CSV to XML using Python

Introduction Here I am going to create an example on how to convert CSV to XML. CSV means Comma Separated Value. So the sources of these values may be different. These values may be put into a file or in a string. XML is an Extensible Markup Language that defines a set of rules for encoding document in a format…

SAX – Simple API for XML

Introduction SAX – Simple API for XML, allows you to process a document as it is being read, which avoids the need to wait for all of it to be stored before taking action. So it takes less memory to process an XML document, whereas DOM (Document Object Model) parser first stores the whole document into memory before taking action….

DOM – Document Object Model

What is DOM ? A DOM – Document Object Model is a collection of nodes, or pieces of information, organized in a hierarchy. This hierarchy allows a developer to navigate around the tree looking for specific information. Analyzing the structure normally requires the entire document to be loaded and the hierarchy to be built before any work is done. Because…

Modifying XML using Python

Introduction Modifying XML using Python programming language means updating or modifying an existing XML file or XML string using Python. Extensible Markup Language (XML) are the most widely used formats for data, because this format is very well supported by modern applications, and is very well suited for further data manipulation and customization. Therefore it is sometimes required to generate…

Building XML Using Python

XML Building Building XML using Python programming language means creating an XML file or XML string using Python. You might have seen how to parse or read an existing XML file or string using Python in my previous tutorial. Here you will see how to create an XML file or string using Python from scratch. I will not only create…

Parsing XML using Python

XML Parsing Parsing XML using Python is a matter of few lines of code has to be written.  The XML could be in a file or XML could be a string. So basically parsing XML using Python means reading the XML node data and further doing something with those data to use in this application. Extensible Markup Language (XML) are…

How to Convert CSV to XML using PHP

Introduction The example, convert csv to xml using PHP, shows conversion of csv data to xml data. As the title suggests to convert csv to xml using PHP, so I will convert either csv file to xml file or csv string to xml string. When I convert csv string to xml string you will see the output on the browser and…