crtillerson
Programmer
I'm trying to understand this issue of white space in XML. Could someone out there validate my understanding?
Background:
I'm trying to write a routine to convert some data stored in flat ASCII text files (fixed length) into XML files for a client. A schema was provided that the XML file must validate against. In the original flat text file, there is no such concept as NULL, only blank spaces where there is "no" data or value provided. In the XSD, there is no attribute specified to preserve spaces. There are several string fields defined in the schema where MinOccurs="0" and the min length is set to 1.
As I understand it, in the case above where all I have is blank spaces out of the flat text data file, I cannot represent that as blank spaces in the XML file. Because there is no space attribute defined in the schema, I cannot use <xml:space="preserve"> in the element tag in the XML. The way I should handle this situation is trim the string from the flat text file, and if the length = 0, do not include that element in the XML file.
Do I understand correctly?
Thanks a bunch, if you can either confirm or increase my understanding.
Clint
Background:
I'm trying to write a routine to convert some data stored in flat ASCII text files (fixed length) into XML files for a client. A schema was provided that the XML file must validate against. In the original flat text file, there is no such concept as NULL, only blank spaces where there is "no" data or value provided. In the XSD, there is no attribute specified to preserve spaces. There are several string fields defined in the schema where MinOccurs="0" and the min length is set to 1.
As I understand it, in the case above where all I have is blank spaces out of the flat text data file, I cannot represent that as blank spaces in the XML file. Because there is no space attribute defined in the schema, I cannot use <xml:space="preserve"> in the element tag in the XML. The way I should handle this situation is trim the string from the flat text file, and if the length = 0, do not include that element in the XML file.
Do I understand correctly?
Thanks a bunch, if you can either confirm or increase my understanding.
Clint