Hi,
I came across an potential enhancement for the enrich mediator. Currently,
the enrich mediator does not check if an element has an xsi:nil attribute.
I think enrich should check for xsi:nil and remove it.
Currently, if an xml or soap message has an element with xsi:nil, you can
use enrich mediator to add content:
Mediator config:
> <enrich>
> <source clone="true" xpath="get-property('someProperty')"/>
> <target xpath="//systemId"/>
> </enrich>
Before Enrich:
> <systemId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:nil="true"/>
After Enrich:
> <systemId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:nil="true">enrichedValue</systemId>
Unfortunately, the second message violates the XML spec for xsi:nil (1),
because any element with xsi:nil must be empty. I think we should change
the enrich mediator to check for xsi:nil attributes. This is only
necessary if the enrich source is NOT inline, because inline source
enrichment overwrites attributes already.
WDYT?
(1) from http://www.w3.org/TR/xmlschema-1/ :
> 2.6.2 xsi:nil
> XML Schema: Structures introduces a mechanism for signaling that an
> element should be accepted as ·valid· when it has no content despite a
> content type which does not require or even necessarily allow empty
> content. An element may be ·valid· without content if it has the attribute
> xsi:nil with the value true. An element so labeled *must be empty*, but
> can carry attributes if permitted by the corresponding complex type.
Thanks,
Colin Roy-Ehri
Software Engineer
*WSO2, Inc. : wso2.com <http://wso2.com/>*
*Mobile* : 812-219-6517
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture