Move hard-coded prefix 06/53306/5
authorRobert Varga <rovarga@cisco.com>
Tue, 14 Mar 2017 22:24:06 +0000 (23:24 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 17 Mar 2017 09:31:02 +0000 (10:31 +0100)
Prefix constant is used only in one branch, colocate it where it is
needed.

Change-Id: I2f0e954538877af602cc68c710cc491a39bebd7c
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-data-codec-xml/src/main/java/org/opendaylight/yangtools/yang/data/codec/xml/XMLStreamWriterUtils.java

index c9b78d14473f2f722e0e58604c4c4793a9d69460..5205497bceb33defbcb5c13c3c695c458beae74b 100644 (file)
@@ -125,13 +125,13 @@ abstract class XMLStreamWriterUtils {
                       @Nonnull final Object value, final QNameModule parent) throws XMLStreamException {
         if (value instanceof QName) {
             final QName qname = (QName) value;
-            final String prefix = "x";
 
             //in case parent is present and same as element namespace write value without namespace
             if (qname.getNamespace().equals(parent.getNamespace())){
                 writer.writeCharacters(qname.getLocalName());
             } else {
                 final String ns = qname.getNamespace().toString();
+                final String prefix = "x";
                 writer.writeNamespace(prefix, ns);
                 writer.writeCharacters(prefix + ':' + qname.getLocalName());
             }