Innehållsförteckning RecentChanges News ElispArea HowTo Problems Suggestions

NxmlModeSchemas

This page is supposed to help you expand your collection of schemas for use in NxmlMode.

Why Schemas?

Adding schemas to NxmlMode helps you turn a generic xml editor into one specific for your document, including content completion and validation.

Acquiring Schemas

For standardized document formats, some kind of validation documents almost always exist. Unfortunately, not all provide the RNC (RelaxNG? compact syntax) schemas required by NxmlMode. Luckily, however, some conversion tools are available. [1]

Otherwise, you can acquire and apply the schemas other than the RNC schemas by using genrnc.el --HiroakiOtsu?

Applying Schemas

The variable rng-schema-locating-files points to a list of XML files specifying when to use which schema based on file name or namespace.

Is it possible to have more then one schema per file? For instance, can I have a buffer validate against an xhtml, jstl and svg schema? --JonathanArkell

Look at NxhtmlMode, which makes it possible. --AadityaSood

Thanks Aaditya for your trust in NxhtmlMode, but unfortunately it can not do this. At least I myself can not see any way to do this. What it can do is handle multiple major modes in a buffer with MuMaMo. The XML parser however (which comes from NxmlMode) always handles the whole buffer. And it uses the same DTD (schema) for the whole file.

But I must say I do not understand what Jonathan wants to do. – LennartBorgman

It seems that what jonathan is asking, if I understand correctly, is this: and single XML file normally has a single schema, often defined by using a namespace declaration on the root tag. But XML allows you to have certain elements be parsed according to a different schema by having a namespace declaration attached to it, just as the root node did. This allows for such fun things as embedding an SVG directly into an XHTML page just my using an svg element, and attaching a namespace declaration to it.

As I see it, this seems to be beyond the scope of nxhtml-mode, and should be handled by nxml-mode instead. personally, I would be very happy to see this implemented. --Matias

nxml-mode already support multiple schemas for an XML file (via namespaces as Matias describes above) --VagnJohansen

Schema Collection

As finding and converting schemas can be a pain, here is a small collection. Everybody please amend it. Currently included are Ant, SVG, X3D and XSL-FO (thanks to MikeHostetler). – nschum

version 2007-03-28

To add the schemas, add this to your .emacs:

  (push "~/path/to/schemas.xml" rng-schema-locating-files-default)
  (push (cons (concat "\\." (regexp-opt '("svg" "x3d") t)
                      "\\'") 'nxml-mode) auto-mode-alist)

Grab my fo-schemas.tar.bz2 file. This has the schema for xsl-fo. I may have more, I will look later. – MikeHostetler

I think you may have uploaded the wrong file … I can’t find anything new in it. – nschum

Oops. Link is fixed now – MikeHostetler

Great. I’ve merged the archives – nschum

I cannot download schemas.xml from WikiUpload?. I instead get a text file, with the error <b>Fatal error</b>: Call to undefined function noImage() in <b>/home/vhosts/www.wikiupload.com/website/download_page.php</b> on line <b>91</b> – BruceIngalls?

I cannot download schemas.xml from WikiUpload?. I get the same file as above. – DavidRoss?

I fixed the link. – nschum

Please upload the files somewhere else. The linke to WikiUpload is broken again

Hi, I’ve uploaded some Apertium-rng files if you want to include them: dix.rng, modes.rng, transfer.rng

As of 2009-12-23 the wikiupload link just displays a blank page. - TobyCabot

Anybody interested in editing JasperReports JRXML files? I derived my jasperreports.rnc from one of the latest DTDs. Sad enough they say, they abandon the DTD in favour of an XSD schema. Let me know, if you are interested in jasperreports.rnc! – JochenHayek


CategoryXML