File: binding.dtd

package info (click to toggle)
libjibx-java 1.0.1-2
  • links: PTS
  • area: contrib
  • in suites: lenny
  • size: 15,748 kB
  • ctags: 10,069
  • sloc: java: 29,151; xml: 7,963; makefile: 14
file content (424 lines) | stat: -rw-r--r-- 17,491 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
<!--

DTD for JiBX binding definition file

This file is generally kept up to date in terms of structure, but the comments
may not match the HTML binding documentation. The HTML documentation should be
considered correct in the case of any differences.

-->

<!--
  Style attribute. This determines whether simple values are expressed as
  attributes or elements in the XML representation. The value is inherited,
  so it can be set at any level of the binding definition hierarchy.

  Basic attributes:
    value-style - mapping style, simple values as: <"element"> or "attribute".
-->

<!ENTITY % style-attribute "
    value-style CDATA   #IMPLIED"
  >

<!--
  Attributes for a name definition. These attributes are used when defining
  an element or attribute name.

  Basic attributes:
    name - element or attribute name
    ns - namespace URI; default is innermost associated namespace ns value
      default, if any
-->

<!ENTITY % name-attributes "
    name        CDATA   #IMPLIED
    ns          CDATA   #IMPLIED"
  >

<!--
  Attributes for an object mapping. These attributes are all used in creating
  a linkage to an object.

  Special instance handling:
    factory - factory method for constructing new instances of object; this
      applies to bindings for unmarshalling only, and if supplied it must be
      in the form of a fully-qualified class+method name (e.g.,
      "com.sosnoski.jibx.ObjectBuilderFactory.newInstance" specifies
      the newInstance() method of the ObjectBuilderFactory class in the
      com.sosnoski.jibx package) for a static, no-argument method returning
      an object of the bound class. If not supplied instances of the
      bound class are constructed using a null argument constructor.
    pre-set - bound class method called on new instances of the class before
      they are populated with data from unmarshalling.
    post-set - bound class method called on new instances of the class after
      they are populated with data from unmarshalling.
    pre-get - bound class method called before instances of the class are
      marshalled.

  Special conversion handling:
    marshaller - custom serialization handler class, as the fully-qualified
      name of a class implementing the org.jibx.runtime.Marshaller interface.
      This is only allowed with an output binding; it is required if an
      unmarshaller is defined for an input-output binding.
    unmarshaller - custom deserialization handler class, as the fully-qualified
      name of a class implementing the org.jibx.runtime.Unmarshaller
      interface. This attribute is only allowed with an input binding; it is
      required if a marshaller is defined for an input-output binding.
  
  The set of attributes used for special instance handling are incompatible
  with those used for special conversion handling.
-->

<!ENTITY % object-attributes "
    factory     CDATA   #IMPLIED
    pre-set     CDATA   #IMPLIED
    post-set    CDATA   #IMPLIED
    pre-get     CDATA   #IMPLIED
    marshaller  CDATA   #IMPLIED
    unmarshaller CDATA   #IMPLIED"
  >

<!--
  Attributes for a property mapping. These attributes are all used in creating
  a binding to a Java language value (primitive or object) that's a property
  of some object.

  Basic attributes:
    field - name of associated field within bound class; this is required
      except for auto-generated identity fields, for values from a collection,
      or when both get-method (for output bindings) and set-method (for input
      bindings) are supplied. The name "this" is always allowed, in order to
      explicitly refer to the containing object, but may not be used in
      combination with either get-method or set-method.
    type - fully-qualified class name for value of field; This can be used to
      force a more specific type for a property value defined by the field
      definition or access method signature as either a base class or an
      interface

  Optional item attributes:
    usage - usage requirement: <"required"> or "optional".
    test-method - method for checking if optional value is present in instance
      of bound class. This is the name of a no-argument method with return type
      "boolean", which must return "true" if the value is present and "false"
      if it is not present. This is only allowed in combination with
      usage="optional". If not specified, a simple "==" comparison is used with
      primitive types to check for a value different from the default, and a
      "equals()" comparison for object types with non-null defaults.

  Special conversion handling:
    get-method - getter method for retrieving value from instance of bound
      class. This is the name of a no-argument method returning a
      value (primitive or object).
    set-method - setter method for storing value in instance of bound class.
      This is the name of a method with return type "void", taking a
      single value (primitive or object) as a parameter. If both get-method
      and set-method are defined, the set-method parameter type must be the
      same as the get-method return value.
-->

<!ENTITY % property-attributes "
    field       CDATA   #IMPLIED
    type        CDATA   #IMPLIED
    usage       CDATA   #IMPLIED
    test-method CDATA   #IMPLIED
    get-method  CDATA   #IMPLIED
    set-method  CDATA   #IMPLIED"
  >

<!--
  Attributes for a string value. These attributes are all used in working with
  simple text values, which may be expressed in XML as attribute values or
  character data content in simple elements (those with no child elements).

  Optional item attributes:
    default - default value; implies an optional value. If not specified,
      the default for primitive types is the same as the member variable initial
      state defined by the JLS, and for object types is "null".

  Special conversion handling:
    serializer - custom serialization handler method, as the fully-qualified
      name of a static method with the signature "String xxxx(Target value)",
      where "xxxx" is the method name and "Target" is the class of the field
      (primitive or object)
    deserializer - custom deserialization handler method, as the
      fully-qualified name of a static method with the signature
      "Target xxxx(String text)", where "xxxx" is the method name and
      "Target" is the class of the field (primitive or object)
-->

<!ENTITY % string-attributes "
    default     CDATA   #IMPLIED
    serializer  CDATA   #IMPLIED
    deserializer CDATA  #IMPLIED"
  >

<!--
  Attributes for component structures. These attributes are used to define and
  reference labeled binding components, allowing reuse of definitions. They're
  supported by structures and collections.
  
  Component references:
    label - identifier for this componet, allowing it to be reused from other
      locations in the binding definition
    using - identifier for component definition to be reused
  
  Component ordering:
    ordered - ordered content flag: <"true"> (child binding components define
      ordered content) or "false" (unordered child content)
    choice - choice of content flag: "true" (choice between child binding
      components) or <"false"> (multiple child binding components allowed)
-->

<!ENTITY % structure-attributes "
    label       CDATA   #IMPLIED
    using       CDATA   #IMPLIED
    ordered     CDATA   #IMPLIED
    choice      CDATA   #IMPLIED"
  >

<!--
  Root element for binding definition.

  Basic attributes:
    name - binding name (default is same as file name, without suffix)
    direction - usage of this binding: "input", "output", or <"both">
    forwards - allow forward references on ids in unmarshalling: <"true">
      (forward references handled) or "false" (all ids must be defined in XML
      before first reference)
    package - package for created binding factory class, default is same
      package as class for first mapping element
    track-source - track unmarshalling source position: "true" or <"false">
    force-classes - force class generation for top-level abstract mappings:
      "true" or <"false">

  along with the style attributes defined above.
-->

<!ELEMENT binding (include*, namespace*, format*, mapping+)>
  <!ATTLIST binding
    name        CDATA   #IMPLIED
    direction   CDATA   #IMPLIED
    forwards    CDATA   #IMPLIED
    package     CDATA   #IMPLIED
    track-source CDATA  #IMPLIED
    force-classes CDATA  #IMPLIED
    %style-attribute;
  >

<!--
  Included binding definition. This can only be used at the top level of a
  binding.

  Basic attributes:
    path - included binding path
-->

<!ELEMENT include EMPTY>
  <!ATTLIST namespace
    path        CDATA   #REQUIRED
  >

<!--
  Namespace mapping definition. This can be defined at the top level of the
  binding, or nested within one or more levels of containing definitions. It
  applies by default to all values of the specified type enclosed within the
  parent element.

  Basic attributes:
    uri - namespace URI
    prefix - prefix to map to namespace, ignored on input (namespace URI
      is used directly to identify elements and attributes). The prefix
      is not required if the binding direction is given as "input", or
      if the default attribute is specified with a value of "elements"
      so long as the namespace is never used except where it's the default.
    default - use this namespace by default for child elements and/or
      attributes of parent: <"none"> (not used by default, only when
      specified), "elements" (default for elements only, not attributes),
      "attributes" (default for attributes only, not elements), "all"
      (default for both elements and attributes). It is an error if multiple
      sibling namespace elements claim to be the default for either elements
      or attributes.
-->

<!ELEMENT namespace EMPTY>
  <!ATTLIST namespace
    uri         CDATA   #REQUIRED
    prefix      CDATA   #IMPLIED
    default     CDATA   #IMPLIED
  >

<!--
  Type conversion format definition. This can be defined at the top level of
  the binding, or nested within one or more levels of containing definitions.

  Basic attributes:
    label - format identifier, only needed for referencing this definition.
    type - fully-qualified class name for conversion.
  
  and the string attributes defined above. If the label attribute is supplied
  this format applies only when referenced by label within a value definition;
  if the label attribute is not supplied this applies by default to all values
  of the specified type enclosed within the parent element.
-->

<!ELEMENT format EMPTY>
  <!ATTLIST format
    label       CDATA   #IMPLIED
    type        CDATA   #REQUIRED
    %string-attributes;
  >

<!--
  Class binding definition. This can be defined at the top level of the
  binding, or nested within one or more levels of containing definitions.

  Basic attributes:
    class - fully qualified class name of bound class, which must be a user
      class modifiable by the binding compiler.
    abstract - abstract definition to be extended by subclass mappings: "true"
      (abstract definition) or <"false"> (concrete definition used directly).
    extends - fully qualified class name of base class with defined abstract
      mapping being extended by subclass.
    type-name - optional type name for an abstract binding.

  along with all the style, name, and object attributes defined above.
  The name attribute is required unless either abstract="true" is specified or
  a marshaller or unmarshaller is supplied using the object attributes.
-->

<!ELEMENT mapping (namespace*, format*, mapping*, (value|structure|collection)*)>
  <!ATTLIST mapping
    class       CDATA   #REQUIRED
    abstract    CDATA   #IMPLIED
    extends     CDATA   #IMPLIED
    type-name   CDATA   #IMPLIED
    %style-attribute;
    %name-attributes;
    %object-attributes;
    %structure-attributes;
  >

<!--
  Value binding definition. This is used to define an attribute or a
  simple element value (one with only character data content).

  Basic attributes:
    format - reference to a named format in a containing scope of the binding
      definition. If given, the named format is used as the default for this
      value binding.
    style - mapping style, express value as: <"element">, "attribute", "text",
      or "cdata".
    constant - contant value always used when marshalling, checked when
      unmarshalling.
 
  Identifier attributes:
    ident - identifier property flag: <"none">, "def" (value is a unique
      identifier for this instance), "auto" (value is autogenerated as a unique
      identifier when marshalling, and used only as an identifier when
      unmarshalling), or "ref" (value is an object with an identifier property,
      the identifier property of the object is used in the XML representation
      rather than the actual object). Only one property with ident="def" or
      "auto" is allowed for a mapping, the property must be a String, and it
	    must be defined directly as a child of the mapping element; it is not
	    allowed as a child of a structure element.
  
  as well as the style, name, property, and string attributes defined above.
  The name attribute is always required. The property attributes are required
  (either as a field name, or as get and/or set methods) unless the value is
  defined as an auto-generated identifier by the string attributes.
-->

<!ELEMENT value EMPTY>
  <!ATTLIST value
    constant    CDATA   #IMPLIED
    format      CDATA   #IMPLIED
    ident       CDATA   #IMPLIED
    style       CDATA   #IMPLIED
    %name-attributes;
    %property-attributes;
    %string-attributes;
  >

<!--
  Structure binding definition. This is used for defining elements with
  complex content. It is also used to include values obtained indirectly
  (from referenced objects) as part of the current element definition, or to
  create an element wrapper containing other values from the current object.

  Mapping references:
    map-as - fully-qualified class name of mapping to be used for property. If
      this attribute is used, the named class must be a superclass or interface
      of the type specified by the property definition and must have a mapping
      defined within an enclosing context. This attribute implies
      mapping="true".

  along with all the style, name, label, property, and object
  attributes defined above. The name attributes are optional; if not supplied, a
  property definition must be present and all contained bindings apply to fields
  of the referenced object. The object attributes are only allowed in
  combination with a field attribute.
-->

<!ELEMENT structure (value|structure|collection)*>
  <!ATTLIST structure
    map-as      CDATA   #IMPLIED
    %style-attribute;
    %name-attributes;
    %object-attributes;
    %property-attributes;
    %structure-attributes;
>
  
<!--
  Collection binding definition. This is used to define handling for Java
  collections.

  Collection handling:
    load-method - indexed load item method for collection. If used, the value is
      the name of a method taking a single int argument and returning the item
      value from the collection. Only allowed in combination with size-method.
    size-method - item count method for collection. If present, the value is the
      name of a no-argument method returning an int count of the items present
      in the collection.
    store-method - indexed store item method for collection. If used, the value
      is the name of a method taking an int and an item value to be stored in
      the collection.
    add-method - add item method for collection. If used, the value is the name
      of a method taking an item value to be appended to the collection.
    iter-method - iterator method for collection. If used, the value is the name
      of a no-argument method returning a java.lang.Iterator or
      java.lang.Enumeration for the objects in a collection.
      
  Value type:
    item-type - fully-qualified class name for items contained in collection,
      where the class has an object type mapping defined at an enclosing level.
      This is used for generic collections and for arrays of a base class or
      interface type. Either this attribute or a contained value or structure
      element with no field attribute must be supplied for a collection-valued
      property.

  along with all the style, name, label, and property attributes
  defined above. The name attributes are optional, but a property definition is
  always required. The collection handling attributes are not needed when the
  property definition is for a standard collection class (java.util.Vector,
  java.util.ArrayList, java.util.List, java.util.Collection,
  com.sun.java.util.ArrayList, com.sun.java.util.List, or
  com.sun.java.util.Collection instance), though if supplied in this case they
  will override the default handling. The direct child components of a
  collection may not use property definitions except for the type attribute.
-->

<!ELEMENT collection (value|structure|collection)*>
  <!ATTLIST collection
    load-method CDATA   #IMPLIED
    size-method CDATA   #IMPLIED
    store-method CDATA  #IMPLIED
    add-method  CDATA   #IMPLIED
    iter-method CDATA   #IMPLIED
    item-type   CDATA   #IMPLIED
    %style-attribute;
    %name-attributes;
    %property-attributes;
    %structure-attributes;
  >