diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPExportController.h | 5 | ||||
-rw-r--r-- | Source/SPExportController.m | 1 | ||||
-rw-r--r-- | Source/SPExportInitializer.m | 2 | ||||
-rw-r--r-- | Source/SPXMLExporter.h | 7 | ||||
-rw-r--r-- | Source/SPXMLExporter.m | 19 |
5 files changed, 28 insertions, 6 deletions
diff --git a/Source/SPExportController.h b/Source/SPExportController.h index 0865fef3..32541d19 100644 --- a/Source/SPExportController.h +++ b/Source/SPExportController.h @@ -70,7 +70,6 @@ IBOutlet NSButton *exportUseUTF8BOMButton; IBOutlet NSButton *exportCompressOutputFile; IBOutlet NSButton *exportProcessLowMemoryButton; - IBOutlet NSTextField *exportCSVNULLValuesAsTextField; IBOutlet BWAnchoredButtonBar *exportTableListButtonBar; @@ -103,6 +102,10 @@ IBOutlet NSComboBox *exportCSVFieldsWrappedField; IBOutlet NSComboBox *exportCSVFieldsEscapedField; IBOutlet NSComboBox *exportCSVLinesTerminatedField; + IBOutlet NSTextField *exportCSVNULLValuesAsTextField; + + // XML + IBOutlet NSTextField *exportXMLNULLValuesAsTextField; // HTML IBOutlet NSButton *exportHTMLIncludeStructureCheck; diff --git a/Source/SPExportController.m b/Source/SPExportController.m index cb972551..6da5b544 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -325,6 +325,7 @@ [[[exportTableList tableColumnWithIdentifier:@"content"] headerCell] setStringValue:(disable) ? @"" : @"C"]; [exportCSVNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]]; + [exportXMLNULLValuesAsTextField setStringValue:[prefs stringForKey:SPNullValue]]; } } diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m index ce894628..0cfa88b1 100644 --- a/Source/SPExportInitializer.m +++ b/Source/SPExportInitializer.m @@ -540,6 +540,8 @@ // of table and table content exports. [xmlExporter setXmlTableName:[tablesListInstance tableName]]; + [xmlExporter setXmlNULLString:[exportXMLNULLValuesAsTextField stringValue]]; + // If required create separate files if ((exportSource == SPTableExport) && exportToMultipleFiles && (exportTableCount > 0)) { filename = [[exportPathField stringValue] stringByAppendingPathComponent:table]; diff --git a/Source/SPXMLExporter.h b/Source/SPXMLExporter.h index a9e6c2dd..f80aacc6 100644 --- a/Source/SPXMLExporter.h +++ b/Source/SPXMLExporter.h @@ -51,6 +51,11 @@ * Table name */ NSString *xmlTableName; + + /** + * XML NULL string + */ + NSString *xmlNULLString; } @property(readwrite, assign) NSObject *delegate; @@ -58,6 +63,8 @@ @property(readwrite, retain) NSArray *xmlDataArray; @property(readwrite, retain) NSString *xmlTableName; +@property(readwrite, retain) NSString *xmlNULLString; + /** * Initialise an instance of SPXMLExporter using the supplied delegate. * diff --git a/Source/SPXMLExporter.m b/Source/SPXMLExporter.m index 0c060a55..eddfabbf 100644 --- a/Source/SPXMLExporter.m +++ b/Source/SPXMLExporter.m @@ -37,6 +37,7 @@ @synthesize delegate; @synthesize xmlDataArray; @synthesize xmlTableName; +@synthesize xmlNULLString; /** * Initialise an instance of SPXMLExporter using the supplied delegate. @@ -73,7 +74,8 @@ // Check to see if we have at least a table name or data array if ((![self xmlTableName]) && (![self xmlDataArray]) || - ([[self xmlTableName] isEqualToString:@""]) && ([[self xmlDataArray] count] == 0)) + ([[self xmlTableName] length] == 0) && ([[self xmlDataArray] count] == 0) || + (![self xmlNULLString])) { [pool release]; return; @@ -170,19 +172,24 @@ return; } + id data = NSArrayObjectAtIndex(xmlRow, i); + // Retrieve the contents of this tag - if ([NSArrayObjectAtIndex(xmlRow, i) isKindOfClass:[NSData class]]) { - dataConversionString = [[NSString alloc] initWithData:NSArrayObjectAtIndex(xmlRow, i) encoding:[self exportOutputEncoding]]; + if ([data isKindOfClass:[NSData class]]) { + dataConversionString = [[NSString alloc] initWithData:data encoding:[self exportOutputEncoding]]; if (dataConversionString == nil) { - dataConversionString = [[NSString alloc] initWithData:NSArrayObjectAtIndex(xmlRow, i) encoding:NSASCIIStringEncoding]; + dataConversionString = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; } [xmlItem setString:[NSString stringWithString:dataConversionString]]; [dataConversionString release]; } + else if ([data isKindOfClass:[NSNull class]]) { + [xmlItem setString:[self xmlNULLString]]; + } else { - [xmlItem setString:[NSArrayObjectAtIndex(xmlRow, i) description]]; + [xmlItem setString:[data description]]; } // Add the opening and closing tag and the contents to the XML string @@ -249,6 +256,8 @@ if (xmlDataArray) [xmlDataArray release], xmlDataArray = nil; if (xmlTableName) [xmlTableName release], xmlTableName = nil; + [xmlNULLString release], xmlNULLString = nil; + [super dealloc]; } |