You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-dev@db.apache.org by to...@apache.org on 2008/11/05 06:35:20 UTC
svn commit: r711510 -
/db/ddlutils/trunk/src/main/java/org/apache/ddlutils/io/PrettyPrintingXmlWriter.java
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);
+ }
}
}
}