/[thuban]/branches/WIP-pyshapelib-bramz/Resources/XML/thuban-0.8.dtd
ViewVC logotype

Annotation of /branches/WIP-pyshapelib-bramz/Resources/XML/thuban-0.8.dtd

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1268 - (hide annotations)
Fri Jun 20 16:10:12 2003 UTC (21 years, 8 months ago) by bh
Original Path: trunk/thuban/Resources/XML/thuban-0.8.dtd
File size: 5692 byte(s)
* Resources/XML/thuban-0.8.dtd: New DTD for the new file format
version.

* Thuban/Model/save.py (sort_data_stores): New. Make topological
sort of the data sources so they can be written with sources that
data sources that depend on other data sources come after the
sources they depend on.
(SessionSaver.__init__): Add idmap instance variable to map from
objects to the ids used in the file.
(SessionSaver.get_id, SessionSaver.define_id)
(SessionSaver.has_id): New. Methods to manage the idmap
(SessionSaver.write): Use thuban-0.8.dtd
(SessionSaver.write_session): Add a namespace on the session and
write out the data sources before the maps.
(SessionSaver.write_data_containers): New. Write the data
containers.
(SessionSaver.write_layer): Layer elements now refer to a
shapestore and don't contain filenames anymore.

* Thuban/Model/load.py (LoadError): Exception class to raise when
errors in the files are discovered
(SessionLoader.__init__): Define dispatchers for elements with a
thuban-0.8 namespace too.
(SessionLoader.check_attrs): New helper method to check and
convert attributes
(AttrDesc): New. Helper class for SessionLoader.check_attrs
(SessionLoader.start_fileshapesource)
(SessionLoader.start_derivedshapesource)
(SessionLoader.start_filetable, SessionLoader.start_jointable):
Handlers for the new elements in the new fileformat
(SessionLoader.start_layer): Handle the shapestore attribute in
addition to filename.
(SessionLoader.start_table, SessionLoader.end_table): Removed.
They were never used in the old formats and aren't needed for the
new.

* Thuban/Model/session.py (Session.DataContainers): New method to
return all "data containers", i.e. shapestores and tables

* test/xmlsupport.py (SaxEventLister.__init__)
(SaxEventLister.startElementNS, sax_eventlist): Add support to
normalize IDs.

* test/test_xmlsupport.py
(TestEventList.test_even_list_id_normalization): New test case for
id normalization

* test/test_load.py (LoadSessionTest.check_format): Use ID
normalization
(LoadSessionTest.thubanids, LoadSessionTest.thubanidrefs): New
class atrributes used for ID normalization
(TestSingleLayer, TestLayerVisibility, TestLabels.test)
(TestLayerProjection.test, TestRasterLayer.test): Adapt to new
file format
(TestJoinedTable): New test for loading sessions with joined
tables.
(TestLoadError): New. Test whether missing required attributes
cause a LoadError.

* test/test_save.py (SaveSessionTest.thubanids)
(SaveSessionTest.thubanidrefs): New class attributes for ID
normalization in .thuban files.
(SaveSessionTest.compare_xml): Use id-normalization.
(SaveSessionTest.testEmptySession)
(SaveSessionTest.testLayerProjection)
(SaveSessionTest.testRasterLayer)
(SaveSessionTest.testClassifiedLayer): Adapt to new file format.
(SaveSessionTest.testLayerProjection): The filename used was the
same as for testSingleLayer. Use a different one.
(SaveSessionTest.test_dbf_table)
(SaveSessionTest.test_joined_table): New test cases for saving the
new data sources structures.
(TestStoreSort, MockDataStore): Classes to test the sorting of the
data stores for writing.

1 bh 1268 <?xml version="1.0" encoding="UTF-8"?>
2     <!-- thuban-0.8.dtd
3    
4     Copyright (C) 2001, 2003 by Intevation GmbH
5     Authors:
6     Jan-Oliver Wagner <[email protected]>
7     Bernhard Herzog <[email protected]>
8    
9     This program is free software under the GPL (>=v2)
10     Read the file COPYING coming with Thuban for details.
11     -->
12    
13     <!-- a session contains zero or more datasources and and zero or more maps
14    
15     At some point, the namespace attribute will likely be used by Thuban to
16     identify the version of the file format.
17     -->
18    
19     <!ENTITY % shapesources "fileshapesource | derivedshapesource">
20     <!ENTITY % tables "filetable | jointable">
21     <!ELEMENT session ((%shapesources; | %tables; )*, map*)>
22     <!ATTLIST session
23     title CDATA #REQUIRED
24     xmlns CDATA #IMPLIED
25     >
26    
27    
28     <!--
29     A fileshapesource is a source of shapes and perhaps attribute data
30     read from a file. The filetype attribute must be one of the
31     supported file types. Currently only "shapefile" is supported.
32     -->
33    
34     <!ELEMENT fileshapesource EMPTY>
35     <!ATTLIST fileshapesource
36     id ID #REQUIRED
37     filename CDATA #REQUIRED
38     filetype CDATA #REQUIRED
39     >
40    
41     <!--
42     A derivedshapesource is a source of shapes and attribute data
43     derived from another shapesource for the shapes and a table for the
44     attribute data.
45     -->
46    
47     <!ELEMENT derivedshapesource EMPTY>
48     <!ATTLIST derivedshapesource
49     id ID #REQUIRED
50     shapesource IDREF #REQUIRED
51     table IDREF #REQUIRED
52     >
53    
54    
55     <!-- a filetable points to the actual file that
56     contains the tabular data.
57    
58     The filetype Attribute may be onve of "DBF" or "CSV"
59     -->
60     <!ELEMENT filetable EMPTY>
61     <!ATTLIST filetable
62     id ID #REQUIRED
63     title CDATA #REQUIRED
64     filename CDATA #REQUIRED
65     filetype CDATA #REQUIRED>
66    
67     <!--
68     A jointable is a table with the result of something equivalent to
69     this SQL Statement:
70    
71     SELECT * FROM left JOIN right WHERE left.leftcolumn = right.rightcolumn;
72    
73     The attributes left and right must be the ids of two tables defined
74     previously in the XML-Document file. leftcolumn and rightcolumn are
75     the column names to join on.
76     -->
77     <!ELEMENT jointable EMPTY>
78     <!ATTLIST jointable
79     id ID #REQUIRED
80     title CDATA #REQUIRED
81     left IDREF #REQUIRED
82     leftcolumn CDATA #REQUIRED
83     right IDREF #REQUIRED
84     rightcolumn CDATA #REQUIRED
85     >
86    
87     <!-- A Map
88    
89     A map consists of a number of layers
90     the projection refers to the projection
91     used to display the map. If the projection
92     is missing, geographic coordinates in decimal
93     degrees are assumed.
94     -->
95     <!ELEMENT map (projection?, (layer | rasterlayer)*, labellayer?)>
96     <!ATTLIST map title CDATA #REQUIRED>
97    
98     <!-- a layer represents a set of geographic objects.
99     pointers to the actual data are stored.
100     The shapestore attributes contains the id of the data store
101     shown in the layer.
102     the projection refers to the projection
103     in which the data are stored. If the projection
104     is missing, geographic coordinates in decimal
105     degrees are assumed. Visibility is assumed true
106     unless otherwise specified.
107     -->
108     <!ELEMENT layer (projection?, classification?)>
109     <!ATTLIST layer title CDATA #REQUIRED>
110     <!ATTLIST layer shapestore IDREF #REQUIRED>
111     <!ATTLIST layer visible (true|false) "true">
112     <!-- the fill and stroke attributes can be either "None" or "#RRGGBB"
113     RGB hex values
114    
115     All of fill, stroke and stroke_width may be omitted and default to
116     "None", "#000000" and "1" respectively.
117     -->
118     <!ATTLIST layer fill CDATA "None">
119     <!ATTLIST layer stroke CDATA "#000000">
120     <!ATTLIST layer stroke_width CDATA "1">
121    
122    
123     <!-- a rasterlayer represents an image that has some geographic data
124     associated with it. The filename points to the image used.
125     -->
126     <!ELEMENT rasterlayer (projection?, classification?)>
127     <!ATTLIST rasterlayer
128     title CDATA #REQUIRED
129     filename CDATA #REQUIRED
130     visible (true|false) "true">
131    
132    
133     <!-- Classification data -->
134     <!ELEMENT classification (clnull?, clpoint*, clrange*, clcont*)>
135     <!ATTLIST classification field CDATA #REQUIRED>
136     <!ATTLIST classification field_type CDATA #REQUIRED>
137    
138     <!ELEMENT clnull (cldata*)>
139     <!ELEMENT clpoint (cldata*)>
140     <!ELEMENT clrange (cldata*)>
141     <!ELEMENT clcont (cldata*)>
142    
143     <!ATTLIST clnull label CDATA #IMPLIED>
144    
145     <!ATTLIST clpoint value CDATA #REQUIRED>
146     <!ATTLIST clpoint label CDATA #IMPLIED>
147    
148     <!ATTLIST clrange min CDATA #IMPLIED>
149     <!ATTLIST clrange max CDATA #IMPLIED>
150     <!ATTLIST clrange range CDATA #IMPLIED>
151     <!ATTLIST clrange label CDATA #IMPLIED>
152    
153     <!ATTLIST clcont rmin CDATA #REQUIRED>
154     <!ATTLIST clcont rmax CDATA #REQUIRED>
155     <!ATTLIST clcont dmin CDATA #REQUIRED>
156     <!ATTLIST clcont dmax CDATA #REQUIRED>
157    
158     <!-- Visual appearance of the classification
159    
160     the fill and stroke attributes can be either "None" or "#RRGGBB"
161     RGB hex values
162    
163     All of fill, stroke and stroke_width may be omitted and default to
164     "None", "#000000" and "1" respectively.
165     -->
166     <!ELEMENT cldata EMPTY>
167     <!ATTLIST cldata
168     stroke CDATA #IMPLIED
169     stroke_width CDATA #IMPLIED
170     fill CDATA #IMPLIED
171     >
172    
173    
174     <!-- a projection has a number of parameters
175     -->
176     <!ELEMENT projection (parameter*)>
177     <!ATTLIST projection
178     name CDATA "" >
179    
180     <!-- just a simple parameter consisting of a value
181     -->
182     <!ELEMENT parameter EMPTY>
183     <!ATTLIST parameter value CDATA #REQUIRED>
184    
185    
186     <!-- The label layer contains text labels -->
187     <!ELEMENT labellayer (label*) >
188    
189     <!ELEMENT label EMPTY>
190     <!ATTLIST label
191     x CDATA #REQUIRED
192     y CDATA #REQUIRED
193     text CDATA #REQUIRED
194     halign (left|center|right) #REQUIRED
195     valign (top|center|bottom) #REQUIRED>

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26