Page MenuHomePhabricator

Special:Import does not consider XML namespace
Closed, ResolvedPublic

Description

Author: Martin.Szugat

Description:
Trying to import an XML file that uses a prefix, e.g. "mw", for the namespace "http://www.mediawiki.org/xml/export-0.3.xsd" fails (exception messages are shown). However, the Special:Import page reports that all pages were imported.

Sample import file that fails:

1<mw:mediawiki xmlns:mw="http://www.mediawiki.org/xml/export-0.3/"
2xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.3/
4http://www.mediawiki.org/xml/export-0.3.xsd" version="0.3" xml:lang="en">
5<mw:page>
6 <mw:title>Test</mw:title>
7 <mw:revision>
8 <mw:timestamp>2010-12-31T00:00:00Z</mw:timestamp>
9 <mw:contributor><mw:username>WikiSysop</mw:username><mw:id>1</mw:id></mw:contributor>
10 <mw:text xml:space="preserve">Test</mw:text>
11 </mw:revision>
12</mw:page>
13</mw:mediawiki>


Version: 1.5.x
Latest reproducible version: 1.25 alpha (current master)
Severity: normal

Details

Reference
bz4520

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 21 2014, 9:01 PM
bzimport set Reference to bz4520.
bzimport created this task.Jan 7 2006, 6:13 PM
brion added a comment.Feb 3 2006, 3:23 AM

Can you provide a sample file to test with?

Martin.Szugat wrote:

(In reply to comment #1)

Can you provide a sample file to test with?

I'll send you one per Email. It looks like this:

<mw:mediawiki xmlns:mw="http://www.mediawiki.org/xml/export-0.3/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.3/
http://www.mediawiki.org/xml/export-0.3.xsd" version="0.3" xml:lang="en">
<mw:page>

<mw:title>Test</mw:title>
  <mw:revision>
    <mw:timestamp>2010-12-31T00:00:00Z</mw:timestamp>

<mw:contributor><mw:username>WikiSysop</mw:username><mw:id>1</mw:id></mw:contributo
r>

<mw:text xml:space="preserve">Test</mw:text>
</mw:revision>

</mw:page>
</mw:mediawiki>

And the results is:

Warning: xml_parse() [function.xml-parse]: Unable to call handler () in
C:\Programme\XAMPP 1.5.0 pl1\xampp\htdocs\prothesaurus\includes\SpecialImport.php
on line 276

Warning: xml_parse() [function.xml-parse]: Unable to call handler () in
C:\Programme\XAMPP 1.5.0 pl1\xampp\htdocs\prothesaurus\includes\SpecialImport.php
on line 276

Warning: xml_parse() [function.xml-parse]: Unable to call handler () in
C:\Programme\XAMPP 1.5.0 pl1\xampp\htdocs\prothesaurus\includes\SpecialImport.php
on line 276

Warning: xml_parse() [function.xml-parse]: Unable to call handler () in
C:\Programme\XAMPP 1.5.0 pl1\xampp\htdocs\prothesaurus\includes\SpecialImport.php
on line 276

Warning: xml_parse() [function.xml-parse]: Unable to call handler () in
C:\Programme\XAMPP 1.5.0 pl1\xampp\htdocs\prothesaurus\includes\SpecialImport.php
on line 276

Warning: xml_parse() [function.xml-parse]: Unable to call handler () in
C:\Programme\XAMPP 1.5.0 pl1\xampp\htdocs\prothesaurus\includes\SpecialImport.php
on line 276

Warning: xml_parse() [function.xml-parse]: Unable to call handler () in
C:\Programme\XAMPP 1.5.0 pl1\xampp\htdocs\prothesaurus\includes\SpecialImport.php
on line 276

Warning: xml_parse() [function.xml-parse]: Unable to call handler () in
C:\Programme\XAMPP 1.5.0 pl1\xampp\htdocs\prothesaurus\includes\SpecialImport.php
on line 276

Warning: xml_parse() [function.xml-parse]: Unable to call handler () in
C:\Programme\XAMPP 1.5.0 pl1\xampp\htdocs\prothesaurus\includes\SpecialImport.php
on line 276
Import pages
From ProThesaurus
Import succeeded!

Mass compoment change: <some> -> Export/Import

mike.lifeguard+bugs wrote:

(In reply to comment #2)

(In reply to comment #1)

Can you provide a sample file to test with?

I'll send you one per Email. It looks like this:

You can probably attach that to the bug.

brion added a comment.Dec 11 2008, 6:47 PM

Some work done in r44246; some further work needed (see comments on revision).

Change 149508 had a related patch set uploaded by TTO:
Use XML localName when importing

https://gerrit.wikimedia.org/r/149508

Change 149508 had a related patch set uploaded (by Qgil):
Use XML localName when importing

https://gerrit.wikimedia.org/r/149508

Patch-For-Review

@ArielGlenn, this is one of the oldest tasks assigned to someone.

https://gerrit.wikimedia.org/r/149508 from @TTO is waiting for review. Can you help reviewing it, please? Or at least pointing to who could review this patch.

Qgil removed ArielGlenn as the assignee of this task.Feb 14 2015, 3:24 PM
Ciencia_Al_Poder removed a project: TestMe.
Ciencia_Al_Poder set Security to None.
Ciencia_Al_Poder added a subscriber: Ciencia_Al_Poder.

Change 149508 merged by jenkins-bot:
Use XML localName when importing

https://gerrit.wikimedia.org/r/149508

TTO closed this task as Resolved.Apr 9 2015, 2:39 AM
TTO claimed this task.

I think we can consider this fixed. WikiImporter doesn't take any notice of the xmlns, partly because XMLReader seems to be very naïve when it comes to namespaces, so we'd have to roll the logic ourselves if we wanted to implement that. However, imports shouldn't contain mixed XML trees, so I don't consider that much of a problem.

Meno25 removed a subscriber: Meno25.Oct 3 2016, 4:58 PM