My mapping problem is a side effect of (1) new collection wrapping code in
XMLMappingLoader and (2) the DTD setting a default value for the container
attribute. When the DTD is referenced in mapping.xml, 'container="false"'
is generated and the parse triggers the output I reported. The short-term
solution is to remove the DOCTYPE tag from mapping.xml. This problem will
likely go away once new wrapping code appears, but for the time being its
real.
// =================================================
// Line 459 triggers the wrap when container=false
// =================================================
456: //-- wrap collection in element?
457: else if (nodeType == NodeType.Element) {
458: if (fieldMap.hasContainer() && (!fieldMap.getContainer())) {
459: xmlDesc = wrapCollection(xmlDesc);
460: }
461: }
// =================================================
// DTD sets default value of containter to false
// =================================================
<!ELEMENT field ( description?, sql?, bind-xml?, ldap? )>
<!ATTLIST field
name NMTOKEN #REQUIRED
type NMTOKEN #IMPLIED
required ( true | false ) "false"
direct ( true | false ) "false"
lazy ( true | false ) "false"
handler NMTOKEN #IMPLIED
get-method NMTOKEN #IMPLIED
set-method NMTOKEN #IMPLIED
create-method NMTOKEN #IMPLIED
transient (true|false) "false"
container ( true | false ) "false"
collection ( array | arraylist | vector | hashtable | collection |
set | map | enumerate ) #IMPLIED>
// =================================================
// Results when DOCTYPE is included in mapping.xml (wrong)
// =================================================
<?xml version="1.0" encoding="UTF-8"?>
<breeds>
<breed>
<string>Boxer</string>
<string>Dalmatian</string>
</breed>
</breeds>
// =================================================
// Results when DOCTYPE is removed from mapping.xml (right)
// =================================================
<?xml version="1.0" encoding="UTF-8"?>
<breeds>
<breed>Boxer</breed>
<breed>Dalmatian</breed>
</breeds>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev