To validate your own XRC files, follow these steps:
- Download the project zip file from the main page
- Unzip the downloaded file
- At the top of your XRC file, add the DOCTYPE and the xml-stylesheet instruction:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="file:///c:/dev/xrv/xsl/validator-xhtml.xsl"?> <!DOCTYPE resource SYSTEM "file:///c:/dev/xrv/dtd/xrc.dtd"> <resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0"> ... </resource>
Of course, the "file:///" path must point to the location where you unzipped the project. And you must use local paths (starting with file, not http) if your XRC files are local - transforming a local file by an XSL file over HTTP won't work. You can use relative paths, though, if you prefer.
- Open your XRC file in a browser
That's it! It should all work fine in Mozilla/Firefox/Netscape and Internet Explorer 6. Maybe also in other browsers, as long as they support XSLT transformation.
Mimetype configuration
If you want to validate XRC files over HTTP using Mozilla/Firefox, you'll have to configure your webserver to serve XRC files as "text/xml" mimetype rather than "text/plain". Otherwise, it gets displayed as plain text. How you should do this, depends on your webserver. I was able to do it with a ".htaccess" file:
- Create a file named ".htaccess" (note the dot) in the directory where you keep the XRC files (or a parent directory, I have it in the root)
- In that file, add the line:
AddType text/xml xrc
I had a similar problem with Internet Explorer, but the other way around: it worked over HTTP, but not on local files... This I was able to fix by adding a mimetype key to the registry:
- Open the Registry Editor (Start menu > Run... > "regedit")
- Open the HKEY_CLASSES_ROOT folder. This contains all "known" filetypes.
- Scroll down to find the key called ".xml"
-
This key contains 3 values:
- (Default value): "xmlfile"
- "Content Type": "text/xml"
- "PerceivedType": "text"
- Still under HKEY_CLASSES_ROOT, add a new key and name it ".xrc"
- Add the same three values under the new key
Alternatively, you can always use a standalone XSLT processor.