Importing text files & empty tags

Questions about XML that are not covered by the other forums should go here.
bds
Posts: 47
Joined: Mon Jun 26, 2006 10:40 pm

Importing text files & empty tags

Post by bds »

All -

does anyone have a recommendation for importing text files (from tab delimited excel sheets) and avoiding empty tags? I've tried changing the settings under Preferences>Database>Import: "Create empty elements for empty values".

Here are some samples:
Text file =

fileName dateScanned bw/color initials caption description genre firstName lastName unknown dateCreated boxNo folderNo topic1 topic2 topic3 topic4 geo1 geo2 geo3 nameSubject1 nameSubject2 nameSubject3 nameSubject4 nameSubject5 nameSubject6 nameSubject7 nameSubject8 nameSubject9 nameSubject10 temporal
aai0039 10-19-09 bw gc Students - 1921 "Group of 5 boys, 1 girl in the background" photograph Unknown 1921 61 20 Students Boys Girls "Gatlinburg, Tennessee" "Founding of Pi Beta Phi Settlement School, Gatlinburg, Tennessee, 1909-1927"

What I'd like to get:
XML =

<row>
<fileName>aai0039</fileName>
<dateScanned>10-19-09</dateScanned>
<bw_color>bw</bw_color>
<initials>gc</initials>
<caption>Students - 1921</caption>
<description>"Group of 5 boys, 1 girl in the background"</description>
<genre>photograph</genre>
<unknown>Unknown</unknown>
<dateCreated>1921</dateCreated>
<boxNo>61</boxNo>
<folderNo>20</folderNo>
<topic1>Students</topic1>
<topic2>Boys</topic2>
<topic3>Girls</topic3>
<geo1>"Gatlinburg, Tennessee"</geo1>
<temporal>"Founding of Pi Beta Phi Settlement School, Gatlinburg, Tennessee, 1909-1927"</temporal>
</row>

And this is what I'm actually getting when I import the file:
Reality =

<row>
<fileName>aai0039</fileName>
<dateScanned>10-19-09</dateScanned>
<bw_color>bw</bw_color>
<initials>gc</initials>
<caption>Students - 1921</caption>
<description>"Group of 5 boys, 1 girl in the background"</description>
<genre>photograph</genre>
<firstName></firstName>
<lastName></lastName>
<unknown>Unknown</unknown>
<dateCreated>1921</dateCreated>
<boxNo>61</boxNo>
<folderNo>20</folderNo>
<topic1>Students</topic1>
<topic2>Boys</topic2>
<topic3>Girls</topic3>
<topic4></topic4>
<geo1>"Gatlinburg, Tennessee"</geo1>
<geo2></geo2>
<geo3></geo3>
<nameSubject1></nameSubject1>
<nameSubject2></nameSubject2>
<nameSubject3></nameSubject3>
<nameSubject4></nameSubject4>
<nameSubject5></nameSubject5>
<nameSubject6></nameSubject6>
<nameSubject7></nameSubject7>
<nameSubject8></nameSubject8>
<nameSubject9></nameSubject9>
<nameSubject10></nameSubject10>
<temporal>"Founding of Pi Beta Phi Settlement School, Gatlinburg, Tennessee, 1909-1927"</temporal>
</row>

Also, I get the same results when I try to directly import the excel file, and skip using the tab delimited file. Can anyone lend me a hand with this or offer some suggestions?

Thanks so much,

B Dyson-Smith
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

In the current version (8.0) the option "Create empty elements for empty values" applies only to import from database operations. As you can see the path of the panel with that option is Database -> Import. We will consider extending this option to the import from text file and import from spreadsheet operations. In the current version you can remove the empty tags by applying an XSLT stylesheet to the result of the import operation.


Regards,
Sorin
bds
Posts: 47
Joined: Mon Jun 26, 2006 10:40 pm

Post by bds »

Sorin -

Thanks for the reply.

Can anyone point me towards a tutorial that would cover this? Most tutorials seem focused on generating HTML & I'm not familliar enough with XSLT to develop the right code from these tutorials.

Any thoughts are greatly appreciated.

Thanks!

Bridger
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

You can find a link to a website containing an XSLT tutorial on the Tutorials and XML APIs page of the oXygen website. You can find the XSLT tutorial here.

Regards,
Sorin
bds
Posts: 47
Joined: Mon Jun 26, 2006 10:40 pm

Post by bds »

Sorin -

Thanks very much, I'll check them out.

Best,
Bridger
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello Bridger,
sorin wrote:We will consider extending this option to the import from text file and import from spreadsheet operations.
We extended the import options to the import from text file and import from spreadsheet operations. The Import preferences page was moved to the XML group of panels as it is applied now to all import operations. It will be available in the next version of oXygen, that is version 8.2.


Regards,
Sorin
Post Reply