Github user MikeThomsen commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2675#discussion_r188055672
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/xml/XMLRecordSetWriter.java
 ---
    @@ -0,0 +1,196 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.nifi.xml;
    +
    +import org.apache.nifi.NullSuppression;
    +import org.apache.nifi.annotation.documentation.CapabilityDescription;
    +import org.apache.nifi.annotation.documentation.Tags;
    +import org.apache.nifi.components.AllowableValue;
    +import org.apache.nifi.components.PropertyDescriptor;
    +import org.apache.nifi.components.ValidationContext;
    +import org.apache.nifi.components.ValidationResult;
    +import org.apache.nifi.expression.ExpressionLanguageScope;
    +import org.apache.nifi.logging.ComponentLog;
    +import org.apache.nifi.processor.util.StandardValidators;
    +import org.apache.nifi.schema.access.SchemaNotFoundException;
    +import org.apache.nifi.serialization.DateTimeTextRecordSetWriter;
    +import org.apache.nifi.serialization.RecordSetWriter;
    +import org.apache.nifi.serialization.RecordSetWriterFactory;
    +import org.apache.nifi.serialization.record.RecordSchema;
    +
    +import java.io.IOException;
    +import java.io.OutputStream;
    +import java.util.ArrayList;
    +import java.util.Collection;
    +import java.util.Collections;
    +import java.util.List;
    +
    +@Tags({"xml", "resultset", "writer", "serialize", "record", "recordset", 
"row"})
    +@CapabilityDescription("Writes a RecordSet to XML. The records are wrapped 
by a root tag.")
    +public class XMLRecordSetWriter extends DateTimeTextRecordSetWriter 
implements RecordSetWriterFactory {
    +
    +    public static final AllowableValue ALWAYS_SUPPRESS = new 
AllowableValue("always-suppress", "Always Suppress",
    +            "Fields that are missing (present in the schema but not in the 
record), or that have a value of null, will not be written out");
    +    public static final AllowableValue NEVER_SUPPRESS = new 
AllowableValue("never-suppress", "Never Suppress",
    +            "Fields that are missing (present in the schema but not in the 
record), or that have a value of null, will be written out as a null value");
    +    public static final AllowableValue SUPPRESS_MISSING = new 
AllowableValue("suppress-missing", "Suppress Missing Values",
    +            "When a field has a value of null, it will be written out. 
However, if a field is defined in the schema and not present in the record, the 
field will not be written out.");
    +
    +    public static final AllowableValue USE_PROPERTY_AS_WRAPPER = new 
AllowableValue("use-property-as-wrapper", "Use Property as Wrapper",
    +            "The value of the property \"Array Tag Name\" will be used as 
the tag name to wrap elements of an array. The field name of the array field 
will be used for the tag name " +
    +                    "of the elements.");
    +    public static final AllowableValue USE_PROPERTY_FOR_ELEMENTS = new 
AllowableValue("use-property-for-elements", "Use Property for Elements",
    +            "The value of the property \"Array Tag Name\" will be used for 
the tag name of the elements of an array. The field name of the array field 
will be used as the tag name " +
    +                    "to wrap elements.");
    +    public static final AllowableValue NO_WRAPPING = new 
AllowableValue("no-wrapping", "No Wrapping",
    +            "The elements of an array will not be wrapped");
    +
    +    public static final PropertyDescriptor SUPPRESS_NULLS = new 
PropertyDescriptor.Builder()
    +            .name("suppress_nulls")
    +            .displayName("Suppress Null Values")
    +            .description("Specifies how the writer should handle a null 
field")
    +            .allowableValues(NEVER_SUPPRESS, ALWAYS_SUPPRESS, 
SUPPRESS_MISSING)
    +            .defaultValue(NEVER_SUPPRESS.getValue())
    +            .required(true)
    +            .build();
    +
    +    public static final PropertyDescriptor PRETTY_PRINT_XML = new 
PropertyDescriptor.Builder()
    +            .name("pretty_print_xml")
    +            .displayName("Pretty Print XML")
    +            .description("Specifies whether or not the XML should be 
pretty printed")
    +            .expressionLanguageSupported(ExpressionLanguageScope.NONE)
    +            .allowableValues("true", "false")
    +            .defaultValue("false")
    +            .required(true)
    +            .build();
    +
    +    public static final PropertyDescriptor ROOT_TAG_NAME = new 
PropertyDescriptor.Builder()
    +            .name("root_tag_name")
    +            .displayName("Name of Root Tag")
    +            .description("Specifies the name of the XML root tag wrapping 
the record set")
    +            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
    +            .expressionLanguageSupported(ExpressionLanguageScope.NONE)
    +            .defaultValue("root")
    +            .required(true)
    +            .build();
    +
    --- End diff --
    
    @JohannesDaniel @markap14 I just merged the linked ticket. You can rebase 
now.


---

Reply via email to