Member since
05-20-2022
66
Posts
6
Kudos Received
6
Solutions
My Accepted Solutions
Title | Views | Posted |
---|---|---|
1222 | 07-17-2023 11:25 PM | |
1206 | 04-17-2023 02:29 PM | |
5798 | 02-15-2023 08:47 PM | |
934 | 02-08-2023 06:02 PM | |
4591 | 10-17-2022 11:48 AM |
09-18-2022
05:28 PM
Thank you SAMSAL for the reply. Ordinarily you would be correct, however, the ValidateXML processor does things differently. If my flowfile has an attribute named "schema.name" and I use the following expression language: ${schema.name:prepend('/opt/nifi/schemas/xsd/'):append('.xsd')} ...then I get the following error. It seems the ValidateXML processor doesn't actually support dynamic run-time assignment of variables. Even using the variable registry doesn't solve the problem because the path/filename variable needs to resolve at design time. Perform Validation. Component is invalid: 'Schema File' validated against '/opt/nifi/schemas/xsd/.xsd' is invalid because The specified resource(s) do not exist or could not be accessed: [/opt/nifi/schemas/xsd/.xsd] Hopefully there is something I'm missing, otherwise I'll have to use the ExecuteScript to build my own validation routine. @ChuckE wrote: I have about 25-30 XML message types and each message type has its own XSD. I need to validate each message against their respective XSD. When using the ValidateXML processor is there any way to dynamically assign the appropriate XSD to a flow file based on on attribute value? I don't see the purpose/benefit of using so-called variables when said variables aren't even variable--they are STATIC! Why does this processor ONLY use variable_registry variables and not attribute values like every other processor in NiFi?
... View more
09-16-2022
10:14 PM
I have about 25-30 XML message types and each message type has its own XSD. I need to validate each message against their respective XSD. When using the ValidateXML processor is there any way to dynamically assign the appropriate XSD to a flow file based on on attribute value? I don't see the purpose/benefit of using so-called variables when said variables aren't even variable--they are STATIC! Why does this processor ONLY use variable_registry variables and not attribute values like every other processor in NiFi?
... View more
Labels:
- Labels:
-
Apache NiFi
09-14-2022
10:22 AM
There seems to be an inconsistency in the JOLT Transform Processors, but maybe I'm just missing something, and hopefully someone can shed some light on my confusion. Below is a really simple JSON dataset and an equally simple JOLT transform, which works as expected on the Jolt-Transform-Demo site (https://jolt-demo.appspot.com/). Incoming JSON: {
"loaf1": {
"type": "white"
},
"loaf2": {
"type": "wheat"
}
} JOLT spec: [{
"operation": "shift",
"spec": {
"*": "bread.&"
}
}] As you can see I've declared the operation as a "shift", and there is only a single "spec". When using the JoltTransformJSON processor, I set the Jolt Transformation DSL = "shift", then the specification fails to validate. Why? However, if I remove the square braces "[ ]" from the spec then the specification will successfully validate. However, it doesn't properly transform the data, and return "null". Why? But... If I leave the square braces in the spec, but change the Jolt Transformation DSL = "chain" then the validation works and it correctly transforms the data. Why does this need to be set to "chain" when there is only a single spec in the specification? I appreciate any insight into the behavior of the JOLT processors.
... View more
Labels:
- Labels:
-
Apache NiFi
08-03-2022
07:59 PM
1 Kudo
I create an XMLRecordSetWriter in the Controller Services, then using a ConvertRecord processor I'm able to read the xml record and then immediately write it out with a new root tag, which I can then pass to my next processor. I discovered this when I was reading the documentation for the XMLRecordSetWriter. Very first line in the documentation. 😃 https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-record-serialization-services-nar/1.7.0/org.apache.nifi.xml.XMLRecordSetWriter/index.html
... View more
08-03-2022
10:13 AM
1 Kudo
I've since discovered a super easy way to resolve this. Simply using the XMLRecordSetWriter does EXACTLY what I was looking for.
... View more
08-02-2022
10:41 PM
1 Kudo
This seems like a good idea. I'll give this a try and test the performance against the XSLT transform. I've never used the JOLT processors before so this will be a good opportunity to experiment with one. Thanks for the idea.
... View more
08-01-2022
05:30 PM
Yes, I validate the incoming xml with a strongly typed xsd.
... View more
08-01-2022
07:26 AM
Thank you SAMSL for your response. In the interest of scalability I was trying to avoid performing text manipulations. I ultimately decided to go with an XSLT transform since this processor is optimized for performing these types of operations, making it more scalable. I wanted to verify there wasn't an option within the XMLReader that I was missing, but it seems not. On a side note, as an intellectual curiosity I also tried using the QueryRecord processor to see if I could select the outermost element in a query and slap wrapper text around it. But it seems there is no way to perform this task with an XMLReader because it can't discern the schema of the data, so "select * from flowfile" is the only thing that works apparently.
... View more
07-28-2022
11:13 PM
When using the XMLReader service, how do you retain the outermost parent element of an XML document so when I convert it to JSON I have the outermost element in the JSON version too? For example, given the following XML document how do I capture the "<a>" element rather than just the "<b>" element? <a> <b>45</b> </a> What I want: {"a": {"b":45}} What I get: {"b":45}
... View more
Labels:
- Labels:
-
Apache NiFi
07-27-2022
10:05 AM
That would be nice, but unfortunately v.1.16.x doesn't incorporate this feature and all you get is a generic message: "Validation Failed". In the end I just resorted to downloading the problem flowfile from the queue, and then used xmllint to run a validation, which gave me the answer instantly. But it would be really nice if the developers put the error message back into the "validatexml.invalid.error" attribute in v.1.16.x
... View more
- « Previous
- Next »