# Importing XML content from file

DevFeed: [Importing XML content from file](<https://devfeed.tech/articles/importing-xml-content-from-file-34337.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2009/02/importing-xml-content-from-file/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2009-02-04T23:00:00Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [XML](<https://devfeed.tech/topics/xml.md>), [Database](<https://devfeed.tech/topics/database.md>), [import](<https://devfeed.tech/topics/import.md>), [file](<https://devfeed.tech/topics/file.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [database](<https://devfeed.tech/tags/database.md>), [file](<https://devfeed.tech/tags/file.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [import](<https://devfeed.tech/tags/import.md>), [xml](<https://devfeed.tech/tags/xml.md>)

## AI overview

This tutorial explains how to load the contents of an XML file into a single database field. It contrasts the usual COPY command with a large objects API approach that loads the file into memory, parses the encoded content, and returns an XML datatype object.

## Source excerpt

The problem was raised this week on IRC and this time again I felt it would be a good occasion for a blog entry: how to load an XML file content into a single field? The usual tool used to import files is COPY, but it'll want each line of the file to host a text representation of a database tuple, so it doesn't apply to the case at hand. RhodiumToad was online and offered the following code to solve the problem: