ORA-31011: XML parsing failed while trying to get XML output

When trying to get a value from an CLOB XML column, I get the following error:

When trying to get a value from an CLOB XML column, I get the following error:

ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00601: Invalid token in: '/l-analysis/vehicle/odometer-reading/reading value/text()'
31011. 00000 -  "XML parsing failed"
*Cause:    XML parser returned an error while trying to parse the document.
*Action:   Check if the document to be parsed is valid.

I have the following XML output:

<?xml version="1.0" encoding="UTF-8"?>
      <model>9000 CSI</model>
      <body-style code="SL">Saloon</body-style>
      <vehicle-type code="7">Passenger car/van</vehicle-type>
      <odometer-reading latest="true">
         <reading value="154267213">154267213</reading>
         <reading-date value="2006-07-17">17-Jul-2006</reading-date>

When trying to get the reading value value, I am running this query:

select XMLTYPE(xml_data).EXTRACT('/l-analysis/vehicle/odometer-reading/reading value/text()').getStringVal() AS XML FROM lm

I believe the error is due reading value having spaces? 'Cause for another XML column that doesn't have spaces it works.

How could I get this working?

JSON vs XML: How Do They Compare?

JSON vs XML: How Do They Compare?

In this article, we will outline what’s going on, and what you need to know about JSON and XML.

JSON and XML are two human-readable text formats that have emerged as rivals over the years. XML’s purpose is storing and defining documents and data through the optional use of a schema. JSON was almost the exact opposite – a serialization format with requirements so simple they fit on the back of a credit card. But, when should you use one or the other? We have to take into account that XML and JSON have similarities and differences that can affect your application’s performance.

In this article, we will outline what’s going on, and what you need to know about JSON and XML.


JavaScript caused a seismic shift in web development with the creation of Node (which is really server-side JavaScript). Everything from this point on got replaced with REST APIs and JSON. JSON became the most efficient data structure standard in web apps. Web 1.0 was hindered with parsing data structures and caused innovation to slow down, while Web 2.0 created an explosion in productivity and Moore’s Law kicked in. JavaScript, which was considered a dead language at one point, was revived and is now one of the most popular languages in 2019.

Comparing JSON and XML


  • Both are human readable.
  • Both are hierarchal with a values within values format.
  • Both can be parsed and used by a number of languages.



  • Shorter
  • Quicker to parse
  • Uses arrays
  • Parsed by a standard JavaScript function
  • Data interchange format


  • Needs an XML parser.
  • Longer to parse.
  • Doesn’t use Arrays!!
Which should I consider?

Everyone has their own opinion about JSON and XML. As a developer, I more or less stick to JSON in my projects unless an API requires XML parsing.

XML is still being used actively in web publishing to create interactive pages. It’s also used for searching the web, metadata and pervasive computing, which is another way to say wireless devices, like cell phones.

Depending on the type of application, it will vary based on what best fits your application to access information.

What’s going on

As applications and platforms evolved, efficiency and performance have been the status quo in priority. APIs evolved over the years to become leaner, and JSON has overtaken XML as the preferred format among developers and technology stacks.

Thanks for reading

If you liked this post, please do share/like it with all of your programming buddies!

Follow us on Facebook | Twitter

Further reading about JavaScript

JSON Tutorial For Beginners | What is JSON | Learning JSON with JavaScript

The complete beginner’s guide to JSON

Converting JSON to CSV in Java

How to use JSON.stringify() and JSON.parse() in JavaScript

The Complete Guide to JSON Web Tokens

Stateless Authentication with JSON Web Tokens

Parsing JSON in Flutter

Authenticate a Node ES6 API with JSON Web Tokens

An Introduction to Oracle SQL

An Introduction to Oracle SQL

An Introduction to Oracle SQL: A quick tour of the six principal clauses of the SELECT statement.

This course is a brief presentation of Oracle SQL.
We will install a version of Oracle Express Edition and Oracle SQL Developer for free.
We'll then look at the SELECT statement with its 6 main clauses (SELECT, FROM, WHERE, GROUP BY, HAVING and ORDER BY).
Following this, we'll look at what else you need to know, and resources (which range from FREE to very expensive) which will help you to learn it..

What you'll learn

  • Either Download and Install Oracle Express Edition and Oracle SQL Developer on your computer - for free
  • Write your own SELECT statements.
  • Learn the SELECT, FROM, WHERE, GROUP BY, HAVING and ORDER BY clauses.
  • Get an easy way to remember the order of these clauses.
  • Find out what more you need to know, and resources in how to learn it.

How to install Ubuntu with Oracle VirtualBox

How to install Ubuntu with Oracle VirtualBox

This Ubuntu tutorial explains how to install Ubuntu with Oracle VirtualBox. What is VirtualBox? Why Ubuntu? Oracle VM VirtualBox is a cross-platform virtualization application. You can run Windows and Linux on your Mac, run Windows server on your Linux server or run Linux on your Windows PC

What is VirtualBox?

Oracle VM VirtualBox is a cross-platform virtualization application developed by Oracle Corporation. It allows users to virtually install operating systems on virtual hard disks such as Windows, macOS, Solaris and Linux.

As an example, you can run Windows and Linux on your Mac, run Windows server on your Linux server or run Linux on your Windows PC while running your other existing applications.

Disk space and memory are the only problems that you'll face when installing multiple virtual machines.

Why You’ll Need It
  • Oracle’s VirtualBox is easy to install and use.
  • It's free.
  • You can run and experience any operating system safely.
  • If you’re a developer, VirtualBox can be used as a tool for safely testing your own development projects in multiple OS environments.
  • It can run everywhere from small embedded systems to laptops.
  • It's good for testing and disaster recoverable as it can be easily copied, backed-up and transported between hosts.
VirtualBox Installation

VirtualBox can be downloaded here: VirtualBox Downloads

Why Ubuntu?
  • It's free.
  • Easy customization: The GNOME desktop environment helps you customize easily.
  • It's secure.
  • Ubuntu is open-source.
  • Friendly and supportive community.
  • Low system requirements.
  • According to FOSSBYTES, Ubuntu is the second best Linux distro for programming & developers [2019 Edition].
  • It's beginner friendly.
Setup for Ubuntu

First, open the VirtualBox. Then click "New" to create a virtual machine.

Fill the OS name as Ubuntu since we're installing it. Check the type as Linux and select version Ubuntu (64-bit).

NOTE: Select the amount of memory as you wish but don't add more than 50 percentage of your RAM.

Check the "Create a virtual hard disk now" so we can later define our Ubuntu OS virtual hard disk size.

Now, we want to select "VHD (Virtual Hard Disk)".

Next, we'll dynamically allocate storage on physical hard disk.

We want to specify our Ubuntu OS's size. Recommended size is 10 GB. You can increase more than that.

After creating a virtual hard disk you'll see Ubuntu in your dashboard.

Now, we have to set up the Ubuntu disk image file (.iso)

The Ubuntu disk image file can be downloaded here: Ubuntu OS download

To set up the Ubuntu disk image file, go to settings and follow these steps:

  1. Click "Storage".
  2. In storage devices, click "Empty".
  3. In attributes, click the disk image and "Choose Virtual Optical Disk File".
  4. Select the Ubuntu disk image file and open it.

Click OK.

Your Ubuntu OS is fully ready for installation in your VirtualBox. So let's start it!

NOTE: Ubuntu VirtualBox installation and actual OS installation steps may vary. This guide helps you to install Ubuntu in VirtualBox only.

Let's install Ubuntu!

Click Install Ubuntu.

Select your keyboard layout.

In "Updates and other software" section check the "Normal installation" and continue.

In "Installation type", check "Erase disk and install Ubuntu".

Click "Continue".

Choose your current location.

Now, set up your profile.

You'll see Ubuntu installation.

After the installation, restart it.

After logging in, you'll see Ubuntu desktop.

We have successfully installed Ubuntu in VirtualBox. It's ready to use for your future development projects.

Let's verify the installation.

Open your terminal (Press Ctrl+Alt+T) and type the below commands and check if they work.

  1. pwd: This will print the current working directory.
  2. ls: This will list all items in your current directory.

After checking those, power off your machine by using the following command.



VirtualBox is free and is a great tool for running multiple OS in a single OS. Ubuntu has its benefits. If you're a beginner to Linux, I would recommend you to use Ubuntu as it's beginner friendly.

Please feel free to let me know if you have any questions.

Thank you for reading.

Happy Coding!