Re: Transformation interceptor to replace arbitrary text content
On 29.11.17 14:37, Sergey Beryozkin wrote: > Right, the transform feature is not meant to replace XSLT, it would be > much faster for straightforward transforms at the element > structure/namespace level but it's not a good fit for the complex > transformations... Indeed, we'd need something like Collections.singletonMap("{*}*=VABSENT", "{*}*=") but that ain't supported. We're likely going the XSLT way but it occurred to me I also need to check whether we could tweak JAXB to unmarshall this differently. > Note if all of these arbitrary simple elements are united by a namespace > which does not qualify complex ones as well, then you may still be able > to use the transform one, check the tests, there some examples how to > use the wildcards > > Sergey > On 29/11/17 13:32, Marcel Stör wrote: >> I think either of us doesn't understand ;-) >> >> Since the service provider essentially replaced the SOAP string type >> with its own 'StringType' simple type that "VEMPTY" text content can >> appear in any element. Hence, I need to globally replace that text in >> every SOAP message - regardless of which XML element it is used with. >> That's why I concluded that I can't use the standard >> TransformationFeature. >> >> I was also checking whether CXF allowed to register custom >> deserializers/mapper for a given type (i.e. from that custom XML >> StringType to Java String) but I haven't found anything yet. >> >> On 29.11.17 14:22, Sergey Beryozkin wrote: >>> You should be able to replace it: >>> >>> https://github.com/apache/cxf/blob/master/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java#L56 >>> >>> >>> >>> and >>> >>> https://github.com/apache/cxf/blob/master/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java#L73 >>> >>> >>> >>> You'd likely need to say that {someNs}modifiedBy has to be replaced by >>> {someNs}modifiedBy >>> >>> HTH, Sergey >>> On 29/11/17 09:22, Marcel Stör wrote: We're consuming SOAP messages for which the string type was extended or redefined (see at the bottom). To denote null/empty values the XML element uses "VEMPTY" as text content. Example: VEMPTY Before the message is deserialized and mapped to the Java model we'd like to transform "VEMPTY" to "". As this special text content can appear in arbitrary elements I don't think the standard TransformationFeature as per https://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Replacingtextcontent is applicable. Correct? I suspect we need to use the XSLT transformation, right? [StringType] ...some documentation... VEMPTY if effective value is null ...some more documentation... >>> >>> >> >> -- Marcel Stör, https://frightanic.com My PGP key: https://frightanic.com/pgp/ Couchsurfing: http://www.couchsurfing.com/people/marcelstoer O< ascii ribbon campaign - stop html mail - http://j.mp/1OThh9L signature.asc Description: OpenPGP digital signature
Re: Transformation interceptor to replace arbitrary text content
Right, the transform feature is not meant to replace XSLT, it would be much faster for straightforward transforms at the element structure/namespace level but it's not a good fit for the complex transformations... Note if all of these arbitrary simple elements are united by a namespace which does not qualify complex ones as well, then you may still be able to use the transform one, check the tests, there some examples how to use the wildcards Sergey On 29/11/17 13:32, Marcel Stör wrote: I think either of us doesn't understand ;-) Since the service provider essentially replaced the SOAP string type with its own 'StringType' simple type that "VEMPTY" text content can appear in any element. Hence, I need to globally replace that text in every SOAP message - regardless of which XML element it is used with. That's why I concluded that I can't use the standard TransformationFeature. I was also checking whether CXF allowed to register custom deserializers/mapper for a given type (i.e. from that custom XML StringType to Java String) but I haven't found anything yet. On 29.11.17 14:22, Sergey Beryozkin wrote: You should be able to replace it: https://github.com/apache/cxf/blob/master/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java#L56 and https://github.com/apache/cxf/blob/master/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java#L73 You'd likely need to say that {someNs}modifiedBy has to be replaced by {someNs}modifiedBy HTH, Sergey On 29/11/17 09:22, Marcel Stör wrote: We're consuming SOAP messages for which the string type was extended or redefined (see at the bottom). To denote null/empty values the XML element uses "VEMPTY" as text content. Example: VEMPTY Before the message is deserialized and mapped to the Java model we'd like to transform "VEMPTY" to "". As this special text content can appear in arbitrary elements I don't think the standard TransformationFeature as per https://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Replacingtextcontent is applicable. Correct? I suspect we need to use the XSLT transformation, right? [StringType] ...some documentation... VEMPTY if effective value is null ...some more documentation...
Re: Transformation interceptor to replace arbitrary text content
I think either of us doesn't understand ;-) Since the service provider essentially replaced the SOAP string type with its own 'StringType' simple type that "VEMPTY" text content can appear in any element. Hence, I need to globally replace that text in every SOAP message - regardless of which XML element it is used with. That's why I concluded that I can't use the standard TransformationFeature. I was also checking whether CXF allowed to register custom deserializers/mapper for a given type (i.e. from that custom XML StringType to Java String) but I haven't found anything yet. On 29.11.17 14:22, Sergey Beryozkin wrote: > You should be able to replace it: > > https://github.com/apache/cxf/blob/master/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java#L56 > > > and > > https://github.com/apache/cxf/blob/master/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java#L73 > > > You'd likely need to say that {someNs}modifiedBy has to be replaced by > {someNs}modifiedBy > > HTH, Sergey > On 29/11/17 09:22, Marcel Stör wrote: >> We're consuming SOAP messages for which the string type was extended or >> redefined (see at the bottom). To denote null/empty values the XML >> element uses "VEMPTY" as text content. >> >> Example: VEMPTY >> >> Before the message is deserialized and mapped to the Java model we'd >> like to transform "VEMPTY" to "". As this special text content can >> appear in arbitrary elements I don't think the standard >> TransformationFeature as per >> https://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Replacingtextcontent >> >> is applicable. Correct? >> >> I suspect we need to use the XSLT transformation, right? >> >> [StringType] >> >> >> >> ...some documentation... >> VEMPTY if effective value is null >> ...some more documentation... >> >> >> >> >> >> >> >> >> >> >> >> >> > > -- Marcel Stör, https://frightanic.com My PGP key: https://frightanic.com/pgp/ Couchsurfing: http://www.couchsurfing.com/people/marcelstoer O< ascii ribbon campaign - stop html mail - http://j.mp/1OThh9L signature.asc Description: OpenPGP digital signature
Re: Transformation interceptor to replace arbitrary text content
Or may be "{http://bar}a";, "{http://bar}a= " or similar, please experiment. XSLTFeature should def work though... On 29/11/17 13:22, Sergey Beryozkin wrote: You should be able to replace it: https://github.com/apache/cxf/blob/master/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java#L56 and https://github.com/apache/cxf/blob/master/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java#L73 You'd likely need to say that {someNs}modifiedBy has to be replaced by {someNs}modifiedBy HTH, Sergey On 29/11/17 09:22, Marcel Stör wrote: We're consuming SOAP messages for which the string type was extended or redefined (see at the bottom). To denote null/empty values the XML element uses "VEMPTY" as text content. Example: VEMPTY Before the message is deserialized and mapped to the Java model we'd like to transform "VEMPTY" to "". As this special text content can appear in arbitrary elements I don't think the standard TransformationFeature as per https://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Replacingtextcontent is applicable. Correct? I suspect we need to use the XSLT transformation, right? [StringType] ...some documentation... VEMPTY if effective value is null ...some more documentation...
Re: Transformation interceptor to replace arbitrary text content
You should be able to replace it: https://github.com/apache/cxf/blob/master/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java#L56 and https://github.com/apache/cxf/blob/master/core/src/test/java/org/apache/cxf/staxutils/transform/InTransformReaderTest.java#L73 You'd likely need to say that {someNs}modifiedBy has to be replaced by {someNs}modifiedBy HTH, Sergey On 29/11/17 09:22, Marcel Stör wrote: We're consuming SOAP messages for which the string type was extended or redefined (see at the bottom). To denote null/empty values the XML element uses "VEMPTY" as text content. Example: VEMPTY Before the message is deserialized and mapped to the Java model we'd like to transform "VEMPTY" to "". As this special text content can appear in arbitrary elements I don't think the standard TransformationFeature as per https://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Replacingtextcontent is applicable. Correct? I suspect we need to use the XSLT transformation, right? [StringType] ...some documentation... VEMPTY if effective value is null ...some more documentation... -- Sergey Beryozkin Talend Community Coders http://coders.talend.com/
Transformation interceptor to replace arbitrary text content
We're consuming SOAP messages for which the string type was extended or redefined (see at the bottom). To denote null/empty values the XML element uses "VEMPTY" as text content. Example: VEMPTY Before the message is deserialized and mapped to the Java model we'd like to transform "VEMPTY" to "". As this special text content can appear in arbitrary elements I don't think the standard TransformationFeature as per https://cxf.apache.org/docs/transformationfeature.html#TransformationFeature-Replacingtextcontent is applicable. Correct? I suspect we need to use the XSLT transformation, right? [StringType] ...some documentation... VEMPTY if effective value is null ...some more documentation... -- Marcel Stör, https://frightanic.com My PGP key: https://frightanic.com/pgp/ Couchsurfing: http://www.couchsurfing.com/people/marcelstoer O< ascii ribbon campaign - stop html mail - http://j.mp/1OThh9L signature.asc Description: OpenPGP digital signature