Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

NiFi 1.6.0 TransformXml, Add CDATA Fields (Value of {cdata-section-elements} must be a list of QNames in '{uri}local' notation)

NiFi 1.6.0 TransformXml, Add CDATA Fields (Value of {cdata-section-elements} must be a list of QNames in '{uri}local' notation)

New Contributor

Hi all,

I have some XML files I'd like to transform using an XSLT and the TransformXml processor. I've built the XSLT using an online GUI to check it produces the desired result and is valid.

The original XML contains several CDATA fields that I want to transform and keep the CDATA designation, it's my understanding this should be done using xsl:output tags like the following:

<xsl:output method="html" cdata-section-elements="content"/>

The above should mean the data inside the content element that's output is wrapped in the CDATA designation (the 3rd party online GUI certainly behaved in this way).

When I try the same transformation using NiFI 1.6.0 this exception occurs:

java.lang.IllegalArgumentException: Value of {cdata-section-elements} must be a list of QNames in '{uri}local' notation

Having Googled around the issue, it may be a bug in the Saxon library as detailed here (the stack trace refers to Saxon). I've checked in...

work/nar/extensions/nifi-standard-nar-1.6.0.nar-unpacked/META-INF/bundled-dependencies

...and found that the bundled Saxon is 9.6.0.5 (Saxon-HE-9.6.0-5.jar), but the issue was fixed in 9.7.0.6 and 9.6.0.10 according to the bug report.

Question: If it is the bug from Saxon, how can I either a) work around the issue? or b) drop a newer Saxon into the NiFi install?

I did try just lumping a newer .jar in the same directory, which was a bit of a "hail Mary" move and didn't work. I can give the exception that was produced when I tried the transform again, but it may not be relevant.

Thanks for any help,

Chris.

(Full stack trace of transform using the bundled .jar)

2018-05-01 09:01:18,861 ERROR [Timer-Driven Process Thread-2] o.a.n.processors.standard.TransformXml TransformXml[id=0ad735f3-2234-127c-0000-000038e8a135] Unable to transform StandardFlowFileRecord[uuid=3054a4e2-b70a-4a22-8699-8dac755ebbaa,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1525097440980-1, container=stgkazoofi02_content1, section=1], offset=146962, length=6091],offset=0,name=28527_58_20180428.xml,size=6091] due to org.apache.nifi.processor.exception.ProcessException: IOException thrown from TransformXml[id=0ad735f3-2234-127c-0000-000038e8a135]: java.io.IOException: java.lang.IllegalArgumentException: Value of {cdata-section-elements} must be a list of QNames in '{uri}local' notation: org.apache.nifi.processor.exception.ProcessException: IOException thrown from TransformXml[id=0ad735f3-2234-127c-0000-000038e8a135]: java.io.IOException: java.lang.IllegalArgumentException: Value of {cdata-section-elements} must be a list of QNames in '{uri}local' notation
org.apache.nifi.processor.exception.ProcessException: IOException thrown from TransformXml[id=0ad735f3-2234-127c-0000-000038e8a135]: java.io.IOException: java.lang.IllegalArgumentException: Value of {cdata-section-elements} must be a list of QNames in '{uri}local' notation
at org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2902)
at org.apache.nifi.processors.standard.TransformXml.onTrigger(TransformXml.java:234)
at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1147)
at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:175)
at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: java.lang.IllegalArgumentException: Value of {cdata-section-elements} must be a list of QNames in '{uri}local' notation
at org.apache.nifi.processors.standard.TransformXml$2.process(TransformXml.java:261)
at org.apache.nifi.controller.repository.StandardProcessSession.write(StandardProcessSession.java:2881)
... 12 common frames omitted
Caused by: java.lang.IllegalArgumentException: Value of {cdata-section-elements} must be a list of QNames in '{uri}local' notation
at net.sf.saxon.s9api.Serializer.setOutputProperty(Serializer.java:408)
at net.sf.saxon.jaxp.TransformerImpl.transform(TransformerImpl.java:138)
at org.apache.nifi.processors.standard.TransformXml$2.process(TransformXml.java:259)
... 13 common frames omitted
Don't have an account?
Coming from Hortonworks? Activate your account here