[Mass-Market-GEO] kml:description content model

Rushforth, Peter prushfor at NRCan.gc.ca
Thu Aug 28 15:21:56 EDT 2008


> I wasn't aware of that, but it's good enough for me. 
> <description> is a field, and hence "just" a string in most 
> implementation code. For
> example:
> http://code.google.com/p/libkml/source/browse/trunk/src/kml/do
> m/feature.h?r=172#122

The schema type says its a string too, but in _fact_ you are
expecting to find markup (well- and really-poorly-formed :) in its
contents.

All I'm saying is it might be possible to adjust the schema to 
allow for markup, as well as the fuzzy stuff you actually find in the
wild.

BTW, I'm using XSLT to generate the KML, not an XML editor.
I'll just have to escape all the markup as entities, which is really
ugly.
  
> Compare with Snippet, which has a maxLines attr and thus 
> can't be a field and is a heavier object:
> http://code.google.com/p/libkml/source/browse/trunk/src/kml/do
> m/snippet.h#40

Maybe the following schema model would do the trick:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:element name="description" type="testAnyTypeWithoutAttributes">
  </xs:element>
  <xs:complexType name="testAnyTypeWithoutAttributes">
    <xs:complexContent mixed="true">
      <xs:restriction base="xs:anyType">
        <xs:sequence>
          <xs:any processContents="skip" minOccurs="0"/>
        </xs:sequence>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>
</xs:schema>

This is valid:
<description xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="test.xsd">
  test test test
</description>

as is this:

<description xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="test.xsd">
  <test>this is a test</test>
</description>

but this isn't (@* is disallowed):

<description test="test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="test.xsd">
  <test>this is a test</test>
</description>

Cheers,
Peter



More information about the Mass-Market-GEO mailing list