Intro on Eclipse
Eclipse has two major bundles:
- Eclipse IDE for Java Developers
- Eclipse IDE for Java EE Developers.
Info here: http://www.eclipse.org/downloads/
The major difference is that Eclipse for JavaEE includes the Web Tools Platform (WTP). WTP has editors, designers, JavaEE perspective, new projects and so on.
I generally prefer to use the ‘Java’ perspective as opposed to the ‘JavaEE’ perspective, because the latter is too cluttered, but the one thing from WTP without which I cannot live is the XML editor. There are variations for XSL transformations and XML Schemas.
XML Schemas (XSD)
By default Eclipse can validate XML Schemas, because it has the schema for XSDs. Did you get this one? Let’s try again. XSD is a language written in xml that defines rules for xml files who want to conform to certain rules. This allows us to validate such files versus a schema. Finally XSD is also XML, so there is a special XSD Schema that defines how to write XSD Schemas. And the dog catches its tail.
XML Schema language is also defined in DTD. DTD is the predecessor of XSD.
Anyway, if you want to learn more, go to W3C Schools - the best place to learn XML, XSD, XSLT. This is also the official site of WWW Consortium (W3C) which handles the expert groups that define these standards.
Where is XSL.xsd?
XSL is written in xml, so there is an XSD Schema that defines how to write XSL files.
The schema for XSLT 2.0 (2007 revision) is here: http://www.w3.org/2007/schema-for-xslt20.xsd (the most up-to-date)
The DTD for XSLT 1.0 (1999 revision) is here: http://www.w3.org/TR/1999/REC-xslt-19991116.xml (I couldn’t find XSD for XSL 1.0, maybe because XSL 1.0 is too old)
So the only thing I need to do is put XSL.xsd in Eclipse?
Yes. Here’s how: go to Window –> Preferences and then to XML –> XML Catalogs:
(XML Catalogs are a very interesting topic. There’s an article on them in this blog here)
There are 3 ways to add an XML Schema to Eclipse
- Via an URL (as in the picture)
- Via a workspace location
- Via a file on the file system
How do we validate?
Via the "Validate" button on the context menu on any XML/XSL file.