Subject: | Request: handle complexType/simple content nicer |
The docs say:
complexType/simpleContent
In this case, the single value container may have attributes. The
number of attributes can be endless, and the value is only one. This
value has no name, and therefore gets a predefined name _.
ยป Example: typical simpleContent example
In XML, this looks like this:
<test2 question="everything">42</test2>
As a HASH, this looks like
test2 => { _ => 42
, question => 'everything'
}
Therefore, I cannot simply do $write->($doc, { foo => 'bar' }); if the
foo type has been declared as a complexType in the XSD - I need to pass
{ foo => { _ => 'bar }} instead.
What would be really nice is if this translation happened automatically
- i.e. in XML::Compile::Translate::Writer::makeComplexElement, instead
of erroring with "complex {tag} requires a HASH of input data..." if
!ref($data), instead it made the transformation to { $tag => { _ =>
$data }} itself.