https://bugzilla.wikimedia.org/show_bug.cgi?id=25753

           Summary: Mediawiki XML file version 0.4 does not validate
                    against its own DTD file
           Product: MediaWiki
           Version: 1.16.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: Export/Import
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: rodrigospr...@gmail.com


Created attachment 7778
  --> https://bugzilla.wikimedia.org/attachment.cgi?id=7778
Patch to fix issues on Mediawiki DTD

Hi,

I'm trying to validate a Mediawiki XML file against its DTD file but the
validation is failing. I'm trying using PHP DOMDocument, I haven't tried the
validation with other tools so I can't be sure if the problem is on PHP or
Mediawiki XML file, but I guess it is more likely to be on Mediawiki.

I'm testing with the attached script (testMediawikiXml.php). When I try to
validate the XML from http://en.wikipedia.org/wiki/Special:Export/Train I get
the following error:

Element '{http://www.w3.org/2001/XMLSchema}element': The attribute 'name' is
required but missing

This error can be fixed by commenting line 119 of
http://www.mediawiki.org/xml/export-0.4.xsd. The content of this line is:

<element minOccurs="0" maxOccurs="1" type="mw:DiscussionThreadingInfo" />

I guess the best solution is to add the "name" attribute but I haven't
investigate and I don't know much about DTD to know what should be the value of
the "name" attribute.

If I try to run the script again another error occurs:

Element '{http://www.mediawiki.org/xml/export-0.4/}namespace', attribute
'case': The attribute 'case' is not allowed.

To fix this one I have added the following line below line 92:

<attribute name="case" type="string" />

After those two changes to the DTD file I'm able to validate the XML file. I'm
attaching the script I'm using to test and a patch with the changes I made to
the DTD file. I guess that the second change is ok but the first issue need to
be properly fixed (instead of just commenting the line).

Thanks, Rodrigo.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to