Home

Cardbox Talk

 

CardboxForumsCardbox Talk > "XML import in Cardbox 3"

XML import in Cardbox 3

Current user: [none]
Register / Log In · Help

Posted By Post

Marcel Kelfkens

30-Sep-2005 08:45

Does anybody know if it is possible to import data in XML format into Cardbox 3?

cardboss

3-Oct-2005 09:53

Cardbox 3 doesn't import any XML-based data format at present, although you could construct an XSLT transform that converted XML to the Cardbox External format.

What XML-based format were you thinking of importing? As you probably know, XML on its own is not a format for data transfer, only a basis upon which data transfer formats can be constructed.

Marcel Kelfkens

3-Oct-2005 11:31

My data (structured literature references) come from the Ovid search platform and may look like this:

 <?xml version="1.0" standalone="yes" ?>
- <!-- <!DOCTYPE ovidresults SYSTEM "http://www.ovid.com/dtds/ovidxmloutput.dtd">
  -->
- <ovidresults>
- <records>
- <record index="1">
- <F C="an" L="Accession Number">
- <T>
  <BR />
  </T>
- <D type="c">
  PREV200510181233
- <T>
  <BR />
  </T>
  </D>
  </F>
- <F C="au" L="Author/Editor/Inventor">
- <T>
  <BR />
  </T>
  <D type="s">Janmaat, Alida F. [Author, Reprint Author; E-mail: alida_janmaat@sfu.ca]</D>
  <T>;</T>
  <D type="s">Myers, Judith H. [Author]</D>
- <T>
  .
  <BR />
  </T>
  </F>
- <F C="in" L="Institution">
- <T>
  <BR />
  </T>
- <D type="c">
  Simon Fraser Univ, Dept Biol Sci, 888 Univ Dr, Burnaby, BC V5A 1S6, Canada
- <T>
  .
  <BR />
  </T>
  </D>
  </F>
- <F C="ti" L="Title">
- <T>
  <BR />
  </T>
- <D type="c">
  The cost of resistance to Bacillus thuringiensis varies with the host plant of Trichoplusia ni
- <T>
  <BR />
  </T>
  </D>
  </F>
- <F C="so" L="Source">
- <T>
  <BR />
  </T>
- <D type="c">
  Proceedings of the Royal Society of London - Series B: Biological Sciences
  <T>.</T>
  272
  <T>(</T>
  1567
  <T>).</T>
  MAY 22 2005
  <T>.</T>
  1031-1038
- <T>
  .
  <BR />
  </T>
  </D>
  </F>
- <F C="ab" L="Abstract">
- <T>
  <BR />
  </T>
- <D type="c">
  Selection for resistance to insecticides, diseases and parasitoids is assumed to be costly and often requires tradeoffs with reproductive fitness. The costs of resistance, however, are often difficult to measure. Cabbage looper, Trichoplusia ni, a generalist Lepidopteran herbivore, has become highly resistant following the extensive use of the microbial insecticide, Bacillus thuringiensis kurstaki (Bt) in vegetable greenhouses. We compared the growth rate, pupal size and survival of resistant, susceptible and hybrid T ni larvae fed on tomato, bell pepper and cucumber. Performance was best on cucumber and worst on pepper, and the magnitude of fitness costs associated with Bt resistance increased with declining host plant suitability. This supports the hypothesis that in this system, resistance costs are condition dependent and are greatest in the most stressful environment. Management strategies that rely on the presence of fitness costs to reduce the frequency of resistance genes must consider this variation and should be more successful on crops that are less suitable food plants. In general, condition dependence should be considered in studies designed to measure the costs of resistance.
- <T>
  <BR />
  </T>
  </D>
  </F>
  </record>

The data are send automatically to individuals within my company. I want my people to be able to import them simply into a database without the need to transform them.

bert

3-Oct-2005 12:55

Hi,
Are all fields which Ovid uses in the send data, present in this example?
Then importing this in Cardbox seems 'easy' to do with a Cardbox macro!

Regards
Bert Stortenbeker

Marcel Kelfkens

3-Oct-2005 14:06

Applying a macro: is that something that can be automated, so 'digibetes' could perform it?

regards
Marcel Kelfkens

bert

3-Oct-2005 14:40

Marcel,
In Cardbox 3 a macro can added into the (or only this) application on such a way that even digibetes can use this (a button or a menuoption).
Save the xml file as file 'xyz.xml', start then the macro which read the records into the database.
Also controls can be added that deduplicate (btw a powerful option in Cardbox 3), won't be necessairy after reading the records anymore...
Regards
bert stortenbeker

cardboss

6-Oct-2005 09:53

Bert/Marcel: yes, the best approach is to use a macro. This can do the conversion (by calling an external program, if necessary) and it can then tell Cardbox to import the converted file.

Marcel: the basic problem with providing "XML import" for Cardbox is that there are infinitely many XML-based formats.

For example, you have shown us one in which the hierarchy is

<ovidresults>
<records>
<record id="recordnumber">
<F c="fieldcode">

with each <F> tag containing a complicated mixture of <D> and <T> tags (I say "complicated" because sometimes both tags are present inside the <F> tag and sometimes the <T> tags occur **inside** the <D> tags).

But other formats are possible. The tag names may be different from your Ovid sample. Or the tag names may be the same as the field names themselves - something like:

<RECORD>
<AN>PREV200510181233</AN>
<AU>Janmaat, Alida F. [Author, Reprint Author; E-mail: alida_janmaat@sfu.ca]</AU>
<RECORD>

Or there may be various other ways of specifying field names - for example, a separate tag that lists field names before the first <RECORD> tag, or even the method adopted in CSV format, where a dummy "Record 0" effectively gives the names of the fields.

It would be almost impossible to give the user enough options within Cardbox to handle all these variants, and if we did offer all those options then no user would ever be able to understand them! This is why it is best to have an external program doing some preprocessing and conversion.

Ultimately most kinds of XML reformatting and conversion can be done with XSLT transforms, and so we would in principle be able to do the mirror-image of Cardbox's XML output: you would be able to specify an XSLT transform for converting your XML input into a standard form before Cardbox receives it. But there are still some open questions about how to do this most effectively, and until more people are reading data from XML-based formats, it is best to use macros for the conversion.

Quick Reply

Please log in or register before trying to post a reply.

 
© 2010 Cardbox Software Limited   Home