Skip Navigation

[Resolved] Can’t import user forms xml file

This thread is resolved. Here is a description of the problem and solution.

Problem: I am trying to import some User Forms into my site. The Forms were exported from another Toolset site using Toolset's export tool. Instead of importing the Forms as expected, I see a problem: The XML file [name] could not be read. Looks like there is one invalid node name related to a field for storing a user avatar. This node should be renamed to prevent XML parsing errors.

Solution: Edit the exported XML file using any text editor application. Correct any XML syntax errors. The file should pass validation with an online XML validator tool in order to be accepted in the upload/import process.

Relevant Documentation:
@https://www.xmlvalidation.com/
@https://www.w3schools.com/xml/xml_validator.asp

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by nickH-5 1 year, 6 months ago.

Assigned support staff: Christian Cox.

Author
Posts
#2066625

I am having an issue importing the ZIP file created by an export of user forms from this site.

I get the message "The XML file [name] could not be read"

I can provide the XML if that would help

#2066847

Hi, sure I can check the export if you post the XML or zip file to Drive or Dropbox and share a download link here. Any URL you share in the forum is hidden from public view for your privacy.

#2067935

Thanks Christian, here is a link to the file : hidden link

#2068077

Okay thanks, I was able to download the file successfully. I extracted the XML file from the zip archive and ran it through an XML code validator. It looks like some invalid code is included in the XML file, and that is probably causing a parse error in the import process. In other words the issue here may not be an XML export bug or an XML import bug per se - it may be some unexpected data in a Form or in User Forms general configurations, causing an error during the XML parse process.

I found an invalid node name related to a User Avatar custom field of some kind. The node name 81zd2_user_avatar is included in the custom_fields node, which is included just before the end of the file. I'm still investigating but thought I would ask if this rings any bells for you. The invalid node starts at line 3669 in the XML file. Here is the full code of the invalid node 81zd2_user_avatar:

        <81zd2_user_avatar>
            <slug>81zd2_user_avatar</slug>
            <meta_key>81zD2_user_avatar</meta_key>
            <meta_type>usermeta</meta_type>
            <type>textfield</type>
            <name>81zD2_user_avatar</name>
            <description></description>
            <data>
                <controlled>1</controlled>
            </data>
            <id>81zD2_user_avatar</id>
            <post_labels>81zd2_user_avatar</post_labels>
            <post_type>user</post_type>
            <plugin_type>types</plugin_type>
            <plugin_type_prefix></plugin_type_prefix>
        </81zd2_user_avatar>

This is a problem because XML node names beginning with a digit are technically invalid and may cause parse errors during the import process. For a quick workaround I suggest you edit the exported XML file using a text editor application like SublimeText and rename that problematic node to something that begins with an alphabetical character, like abc_81zd2_user_avatar. Change both the opening and closing tags.:

         <abc_81zd2_user_avatar>
            <slug>81zd2_user_avatar</slug>
            ...
            ...
            <plugin_type_prefix></plugin_type_prefix>
        </abc_81zd2_user_avatar>

Do not change any of the other information inside the node for now, just change the node name in the opening and closing tags as shown above. Save the changes to this XML file and try to import the updated XML file once again.

1. Are you able to import successfully after renaming the invalid node?

2. Are you familiar with this specific User Avatar field? I would appreciate any general information you can share about it.

Thank you!

#2068949

That's great; thanks, it worked.