Importing xml to neo4j

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?

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.

1 Like

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

Any xml validator will do. Maybe try http://xmlsoft.org/xmllint.html

1 Like

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?

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

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

set apoc.import.file.enabled=true. For xml import see https://neo4j.com/docs/labs/apoc/3.5/import/xml/

1 Like