It looks like this is because id at this point ends with "bar.xml/content" while isContentNode(id) tests for id ending with "/jcr:content". The "jcr:" prefix has been removed at this point during writing (but is present when getNode("jcr:content") is called). If I extend FileSystemConnector and override isContentNode(String) and fileFor(String) so they handle a suffix of "/content" as well as "/jcr:content" then I get the behaviour I expect i.e. a non-empty XML file with the correct content.
This is indeed strange. The ID should not have just "bar.xml/content", so this looks like a bug.
Looking at the code, it looks like the ID is being written with only the local name (e.g., "content" without the prefix) on line 543. Please log a defect. IIRC, we're using only the local part because the IDs are translated into filenames, which generally shouldn't have a ":" character. At a minimum, we need to decide how we want to encode the node names into IDs, but we should probably handle "jcr:content" nodes in a special way in the "newDocumentId(..)" method. I think it's a bit too dangerous to change the "isContentNode(String)" method and "fileFor(String)" method to consider any ID ending in "content" as the file content node.
Do you want to try this? If so, do you want to create a pull-request with the change??
You did everything perfectly. (UPDATE: Actually, see my comment on the pull-request: you should make your changes on a topic branch. It's okay this time.)
Thanks! I'll merge the pull-request shortly.
Thanks for the pointer to the workflow page - I'll certainly be sure to use a topic branch in future.