# Importing xml to neo4j

**URL:** <https://community.neo4j.com/t/importing-xml-to-neo4j/11026>\
**Category:** Procedures & APOC\
**Created:** [October 15, 2019, 1:44pm UTC](https://community.neo4j.com/t/importing-xml-to-neo4j/11026 "2019-10-15T13:44:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sam3016](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sam3016/32/4870_2.png) [@sam3016](https://community.neo4j.com/u/sam3016)\
**Post date:** [October 15, 2019, 1:44pm UTC](https://community.neo4j.com/t/importing-xml-to-neo4j/11026/1 "2019-10-15T13:44:21Z")

</div>

Hi, I am new to neo4j. I am trying to import xml to neo4j to visualise another database system in XML format. It is a custom XML so I think I have to modify a bit in order to do so.

what I have tried is using call apoc.load.xml to import the xml file.

but the error message is

Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure `apoc.load.xml`: Caused by: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 21; The entity name must immediately follow the '&' in the entity reference.

for line 6 of the xml file, it is something like "\< FieldCatalog\>", and I have replaced all the "&" into other characters. May be it is better to extract some interested tags and import to neo4j.

Is there any idea to this issue?

---

<div class="post-metadata">

**Author:** ![stefan.armbruster](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/stefan.armbruster/32/74_2.png) [@stefan.armbruster](https://community.neo4j.com/u/stefan.armbruster)\
**Post date:** [October 16, 2019, 3:43am UTC](https://community.neo4j.com/t/importing-xml-to-neo4j/11026/2 "2019-10-16T03:43:59Z")

</div>

That error message indicates that your xml file is syntactically not valid or not even well formed. You need to fix the xml file first prior to import.

---

<div class="post-metadata">

**Author:** ![sam3016](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sam3016/32/4870_2.png) [@sam3016](https://community.neo4j.com/u/sam3016)\
**Post date:** [October 19, 2019, 8:19am UTC](https://community.neo4j.com/t/importing-xml-to-neo4j/11026/3 "2019-10-19T08:19:02Z")

</div>

Thank you. Is there any guide if I would like to fix the format that fit Neo4j?

---

<div class="post-metadata">

**Author:** ![stefan.armbruster](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/stefan.armbruster/32/74_2.png) [@stefan.armbruster](https://community.neo4j.com/u/stefan.armbruster)\
**Post date:** [October 20, 2019, 5:50pm UTC](https://community.neo4j.com/t/importing-xml-to-neo4j/11026/4 "2019-10-20T17:50:30Z")

</div>

Any xml validator will do. Maybe try [xmllint](http://xmlsoft.org/xmllint.html)

---

<div class="post-metadata">

**Author:** ![sam3016](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sam3016/32/4870_2.png) [@sam3016](https://community.neo4j.com/u/sam3016)\
**Post date:** [October 28, 2019, 11:46am UTC](https://community.neo4j.com/t/importing-xml-to-neo4j/11026/5 "2019-10-28T11:46:58Z")

</div>

Hi, I have tried to use xmllint to check my xml file, --debug, -- encode UTF-8, --output as new xml and import into neo4j, it still gave same message.

is , a carriage return valid in apoc import?

May be I clarify my situation, I have uploaded the file to dropbox and create a share link and use it to call apoc command? is it ok to do so?

actually, my file is a local file, could I import it using local path?

---

<div class="post-metadata">

**Author:** ![stefan.armbruster](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/stefan.armbruster/32/74_2.png) [@stefan.armbruster](https://community.neo4j.com/u/stefan.armbruster)\
**Post date:** [October 28, 2019, 6:17pm UTC](https://community.neo4j.com/t/importing-xml-to-neo4j/11026/6 "2019-10-28T18:17:15Z")

</div>

local imports do work via `file:///` notation. Not sure if dropbox would require some specific http headers.

---

<div class="post-metadata">

**Author:** ![sam3016](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/sam3016/32/4870_2.png) [@sam3016](https://community.neo4j.com/u/sam3016)\
**Post date:** [October 30, 2019, 3:56am UTC](https://community.neo4j.com/t/importing-xml-to-neo4j/11026/7 "2019-10-30T03:56:08Z")

</div>

Sorry, do you know how to configure and allow local importing of file. I could only find related post on local importing for CSV

---

<div class="post-metadata">

**Author:** ![stefan.armbruster](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/stefan.armbruster/32/74_2.png) [@stefan.armbruster](https://community.neo4j.com/u/stefan.armbruster)\
**Post date:** [October 30, 2019, 10:46am UTC](https://community.neo4j.com/t/importing-xml-to-neo4j/11026/8 "2019-10-30T10:46:39Z")

</div>

set `apoc.import.file.enabled=true`. For xml import see [https://neo4j.com/docs/labs/apoc/3.5/import/xml/](https://neo4j.com/docs/labs/apoc/3.5/import/xml/)
