Move hard-coded prefix
[yangtools.git] / 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());
             }