xmlimportxsdgeorss

How do I correctly reference georss: point in my xsd?


I am putting together an XSD schema to describe an existing GeoRSS feed, but I am stumbling trying to use the external georss.xsd to validate an element of type georss:point. I've reduced the problem to the smallest components thusly:

XML:

<?xml version="1.0" encoding="utf-8"?>
<this>
    <apoint>45.256 -71.92</apoint>
</this>

XSD:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:georss="http://www.georss.org/georss">
<xs:import namespace="http://www.georss.org/georss"
           schemaLocation="http://georss.org/xml/1.1/georss.xsd"/>
    <xs:element name="this">
        <xs:complexType>    
            <xs:sequence>    
                <xs:element name="apoint" type="georss:point"/>   
            </xs:sequence>
        </xs:complexType>   
    </xs:element>
</xs:schema> 

If I make apoint type "xs: string" instead of "georss: point", the XML validates happily against the XSD, but as soon as I reference an imported type (georss: point), my XML validator (Notepad++ | XML Tools) "cannot parse the schema". What am I doing wrong?


Solution

  • In the context of the question, you were referring to a non-existent type. Below is what you're working with:

    enter image description here

    If you want the point element, then you reference it (as you did afterwards). If you want to reuse the type (content model) with your own tag then your apoint's type should've been doubleList.

    It is not uncommon to reuse a type, since it is a method to maximize the "shutout" of unwanted XML namespaces from instance XML (see Venetian blind authoring style). In your case, you would've achieved a namespace-free XML.