diff options
author | scottkurz <scottkurz@13f79535-47bb-0310-9956-ffa450edef68> | 2011-04-27 21:10:49 +0000 |
---|---|---|
committer | scottkurz <scottkurz@13f79535-47bb-0310-9956-ffa450edef68> | 2011-04-27 21:10:49 +0000 |
commit | 7fc7949157739dd6b446abdbdd6d9981d2745246 (patch) | |
tree | 475fa7dd95f95d53c4f4981c568be3d01d4de366 /sca-java-2.x/trunk | |
parent | 3ebc74f23e3abac07ba4f27b8f6f35fd0355fe9f (diff) |
Pass through XMLStreamReader rather than returning 'null' on xsi:nil="true" element.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1097243 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r-- | sca-java-2.x/trunk/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sca-java-2.x/trunk/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java b/sca-java-2.x/trunk/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java index e0da9ad428..4c7be59466 100644 --- a/sca-java-2.x/trunk/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java +++ b/sca-java-2.x/trunk/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java @@ -32,20 +32,22 @@ import org.apache.tuscany.sca.databinding.BaseTransformer; */ public class OMElement2XMLStreamReader extends BaseTransformer<OMElement, XMLStreamReader> implements PullTransformer<OMElement, XMLStreamReader> { - // private XmlOptions options; - - public static final QName QNAME_NIL = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil"); + /* + * Reverting the behavior here in 2.x (though not in 1.x) to pass through the + * XMLStreamReader even in the case of an xsi:nil element. This appears to only + * be relied upon in 1.x by the XMLStreamReader2CallableReference transformer, and can + * be changed in 2.x without breaking anything. + * + * I'd preferto move the responsibility for handling xsi:nil to transformers such as + * XMLStreamReader2CallableReference. While for something like JAXB, xsi:nil would + * typically map to 'null', for something XML-centric like DOM I think it's more useful + * to transform to a DOM Element with xsi:nil="true". For now I'll leave this issue + * unaddressed in 2.x, where we'd have to adjust XMLStreamReader2CallableReference in + * order to make a change like this. + */ public XMLStreamReader transform(OMElement source, TransformationContext context) { - if (source == null) { - return null; - } else { - if ("true".equals(source.getAttributeValue(QNAME_NIL))) { - return null; - } else { - return source.getXMLStreamReader(); - } - } + return source != null ? source.getXMLStreamReader() : null; } @Override |