-
Notifications
You must be signed in to change notification settings - Fork 82
Filename of XLSForm export should be XML compliant #44
Comments
I think exactly those restrictions are why I generate the name as described: I prefix with If you'd prefer risking the user's own input I'm happy to go back to that behaviour. |
I think my reference to the form ID confused things! If you have a form name Is it possible to add validation to form names? |
I'm just going to prefix a |
Hmm. Why not use validation on the names? |
|
@lognaturel had an alternate idea. Given that the form is valid, maybe we should file this as an issue against pyxform and it should handle numbers more gracefully. |
I'm okay with either! This is a pretty simple change on this side, though. Just catch XLSForm files on their way out the door and subst the attachment meta name. |
I'm happy with leading numbers being prepended by |
I've filed this upstream: XLSForm/pyxform#130. I propose we hold off on a fix until the pyxform team has a chance to respond. |
This is still a trivial one-line change on our side. I'm happy to do it or to do nothing; please advise! :) |
I say do nothing for now. I'd rather fix this upstream. |
Okay, removing from the milestone. |
Just to document current behaviour, a form "Test040" will be exported by build2xlsform v1.6 as "Test040-export. Leading with the (sanitised) form title seems OK now. I could even live (better) without the "-export" postfix because 1. the file extension clarifies the form standard and 2. including the exported form in R packages throws an error and I have to manually remove the Update: PR #266 changes this to "Test040.xslx". @yanokwa is this issue addressed? |
To document current behaviour, a form named "290test4" exports to "290test4.xslx" (no errors) with an internal form title and form id of "290test4". Uploading that to ODK Central (1.3) throws no errors.
Does that mean that form titles beginning with numbers are now handled well on the XLSForm side, and this issue here can be closed? |
Ah yes indeed! The file name used to be used as the node name for the child of the |
When pyxform converts XLS to XML, it uses the XLS file name as the root node name. And because XML has special character requirements (e.g., names must begin with a letter, colon, or underscore, subsequent characters can include numbers, dashes, and periods), we have to be careful about the name of the export.
One way to make this name compliant is to use the form ID in the export, but drop "build_" and the timestamp to make it more human-friendly. So for example, if your form id isbuild_Favorite-Color_1480937828
, the exported file name should beFavorite-Color
.edit by @issa-tseng; this section is confusing as it refers to things Build does not actually do
With this strategy, it might still be possible to have an invalid root node name, so the export should also handle names that start with invalid characters.
The text was updated successfully, but these errors were encountered: