Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch adds "simple" namespace-aware parsing. By "simple" I mean:
<wxr_version>
to detect the version of WXR (rather than examining the namespaceURI of any element)So
is perfectly acceptable to it.
I decided to do it this way to maintain backwards compatibility with the standard importer (which, of course, ignores namespaces all together), and in keeping with Postel's Law, "Be liberal in what you accept, and conservative in what you send".
The one part of the implementation (not strictly related to namespace-aware parsing) that you may not agree with is that it skips WXR elements until it has detected the version of WXR being used. I did this because of the true streaming nature of this importer. That is, since (according to the RSS spec)
<wp:wxr_version/>
could come at the very end of<channel>
(i.e., after all WXR elements) I don't think it is safe to insert posts, etc into the DB without knowing the version of WXR being used since some future version of WXR could change how the WP-related content is represented. Of course, that case will never happen with the standard exporter, but since this needs to handle exports generated by arbitrary plugins I think it's safer to do it this way.I have also added unit tests and the XML Schema I wrote for WXR 1.2 (which, of course, is not used, but just wanted to get it out there).
Finally, there are a few
@todo
's (distinguished with my initials "pvb" to make them easier to find) that you should read over before committing.