Author: tomdz Date: Tue Nov 4 21:35:19 2008 New Revision: 711510 URL: http://svn.apache.org/viewvc?rev=711510&view=rev Log: Minor bug fix: don't print an XML attribute if the value is null
Modified: db/ddlutils/trunk/src/main/java/org/apache/ddlutils/io/PrettyPrintingXmlWriter.java Modified: db/ddlutils/trunk/src/main/java/org/apache/ddlutils/io/PrettyPrintingXmlWriter.java URL: http://svn.apache.org/viewvc/db/ddlutils/trunk/src/main/java/org/apache/ddlutils/io/PrettyPrintingXmlWriter.java?rev=711510&r1=711509&r2=711510&view=diff ============================================================================== --- db/ddlutils/trunk/src/main/java/org/apache/ddlutils/io/PrettyPrintingXmlWriter.java (original) +++ db/ddlutils/trunk/src/main/java/org/apache/ddlutils/io/PrettyPrintingXmlWriter.java Tue Nov 4 21:35:19 2008 @@ -307,21 +307,24 @@ */ public void writeAttribute(String namespaceUri, String localPart, String value) throws DdlUtilsXMLException { - try + if (value != null) { - if (namespaceUri == null) + try { - _writer.writeAttribute(localPart, value); + if (namespaceUri == null) + { + _writer.writeAttribute(localPart, value); + } + else + { + _writer.writeAttribute(namespaceUri, localPart, value); + } } - else + catch (XMLStreamException ex) { - _writer.writeAttribute(namespaceUri, localPart, value); + throwException(ex); } } - catch (XMLStreamException ex) - { - throwException(ex); - } } /** @@ -331,13 +334,16 @@ */ public void writeCData(String data) throws DdlUtilsXMLException { - try - { - _writer.writeCData(data); - } - catch (XMLStreamException ex) + if (data != null) { - throwException(ex); + try + { + _writer.writeCData(data); + } + catch (XMLStreamException ex) + { + throwException(ex); + } } } }