XML Editing With Eclipse


XML Editing With Eclipse

Elliotte Rusty Harold

Tuesday, August 30, 2005

elharo@metalab.unc.edu

http://www.cafeconleche.org/


Out of the Box


Eclipse Web Tools Platform (WTP) Project


Tools Include


Requires


XML Editor


XML Workflow


Sample Use Case: Day List


Sample Data

Let's put this into Eclipse


Demo!


Creating a DTD


Creating a XSD

  1. Format Document

  2. Hmm, what about namespaces?

  3. elementFormDefault="qualified"

  4. Add an element declaration:

    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
    	targetNamespace="http://namespaces.cafeconleche.org/birds/"
    	xmlns:tns="http://namespaces.cafeconleche.org/birds/"
    	elementFormDefault="qualified">
    	
    	<element name="daylist">
    	  <complexType>
    		<sequence>
    		
    		</sequence>
    	  </complexType>
    	</element>
    	
    	
    </schema>

  5. Unlike DTDs errors are noted dynamically

  6. Set document to validate against schema (comment out DOCTYPE and notice how "too smart" the comment autocomplete is):

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://namespaces.cafeconleche.org/birds/ daylist.xsd"


Finishing the XSD

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://namespaces.cafeconleche.org/birds/"
	xmlns="http://namespaces.cafeconleche.org/birds/"
	elementFormDefault="qualified">

	<xsd:element name="daylist">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="site">
					<xsd:complexType>
						<xsd:complexContent mixed="true">
							<xsd:restriction base="xsd:anyType">
								<xsd:attribute name="id" type="xsd:ID" />
							</xsd:restriction>
						</xsd:complexContent>
					</xsd:complexType>
				</xsd:element>
				<xsd:element name="date" type="xsd:string" />
				<xsd:element name="observers">
					<xsd:complexType>
						<xsd:sequence>
							<xsd:element name="observer" type="xsd:string"
								minOccurs="1" maxOccurs="unbounded" />
						</xsd:sequence>
					</xsd:complexType>
				</xsd:element>
				<xsd:element name="species" type="SpeciesType" minOccurs="1" maxOccurs="unbounded" />
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>

	<xsd:complexType name="SpeciesType" mixed="true">
		<xsd:sequence>
			<xsd:element name="location" type="xsd:string" minOccurs="0" />
			<xsd:element name="time" type="xsd:string" minOccurs="0" />
			<xsd:element name="note" type="xsd:string" minOccurs="0" />
		</xsd:sequence>
	</xsd:complexType>

</xsd:schema>

More Specific Types

In graph view

????

Creating a RNG

No support; can edit like anything else


XML Wizard


Creating Documents from a Schema


Processing XSLT/Java/C++/etc.


XML Menu


WSDL/Schema Editor Features


Web Services Explorer


Web Services Wizard


Test Tools


Plugins


General Purpose Editors


Special Purpose Plugins


Built on top of Eclipse


To Learn More


Index | Cafe con Leche

Copyright 2005 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified May 12, 2005