@@ -67,7 +67,7 @@ public final class FormatRssInstance implements FormatInstance {
6767 @ SuppressWarnings ("ConstantName" )
6868 private static final XMLOutputFactory xmlOutputFactory = WstxOutputFactory .newFactory ();
6969
70- private static final String CUSTOM_NAMESPACE = "https://yaytay.github.io/query-engine/rss" ;
70+ private static final String DEFAULT_CUSTOM_NAMESPACE = "https://yaytay.github.io/query-engine/rss" ;
7171
7272 private static final Set <String > STD_ITEM_ELEMENTS = ImmutableSet .<String >builder ()
7373 .add ("title" )
@@ -90,6 +90,8 @@ public final class FormatRssInstance implements FormatInstance {
9090 private final DateTimeFormatter dateTimeFormatter ;
9191 private final DateTimeFormatter timeFormatter ;
9292
93+ private final String customNamespace ;
94+
9395 private final AtomicBoolean started = new AtomicBoolean ();
9496 private XMLStreamWriter writer ;
9597
@@ -112,6 +114,7 @@ public FormatRssInstance(FormatRss definition, WriteStream<Buffer> outputStream)
112114 this .dateFormatter = Strings .isNullOrEmpty (definition .getDateFormat ()) ? null : DateTimeFormatter .ofPattern (definition .getDateFormat ());
113115 this .dateTimeFormatter = Strings .isNullOrEmpty (definition .getDateTimeFormat ()) ? null : DateTimeFormatter .ofPattern (definition .getDateTimeFormat ());
114116 this .timeFormatter = Strings .isNullOrEmpty (definition .getTimeFormat ()) ? null : DateTimeFormatter .ofPattern (definition .getTimeFormat ());
117+ this .customNamespace = Strings .isNullOrEmpty (definition .getCustomNamespace ()) ? DEFAULT_CUSTOM_NAMESPACE : definition .getCustomNamespace ();
115118 this .formattingStream = new FormattingWriteStream (outputStream ,
116119 v -> Future .succeededFuture (),
117120 row -> {
@@ -169,7 +172,7 @@ private void start() throws IOException {
169172 try {
170173 writer = xmlOutputFactory .createXMLStreamWriter (streamWrapper , StandardCharsets .UTF_8 .name ());
171174 writer .writeStartElement ("rss" );
172- writer .writeNamespace ("custom" , Strings . isNullOrEmpty ( defn . getCustomNamespace ()) ? CUSTOM_NAMESPACE : defn . getCustomNamespace () );
175+ writer .writeNamespace ("custom" , customNamespace );
173176 writer .writeAttribute ("version" , "2.0" );
174177 writer .writeCharacters ("\n " );
175178 writer .writeStartElement ("channel" );
@@ -263,7 +266,7 @@ private void outputRow(DataRow row) throws Throwable {
263266 if (STD_ITEM_ELEMENTS .contains (fieldName )) {
264267 writer .writeStartElement (fieldName );
265268 } else {
266- writer .writeStartElement ("custom" , fieldName , Strings . isNullOrEmpty ( defn . getCustomNamespace ()) ? CUSTOM_NAMESPACE : defn . getCustomNamespace () );
269+ writer .writeStartElement ("custom" , customNamespace );
267270 }
268271 if (v != null ) {
269272 writer .writeCharacters (formatValue (v ));
0 commit comments