XML-based book library: Draft layout

01/03/2009 @ 10:39 CT: The current version of the XML Schema I came up with is available for public use at http://media.jamesrskemp.com/xsd/MyBooks.xsd

Currently I have a SQL database (converted from an Access database) of all of the books that I own, as well as when I read them, how much I paid, etcetera.

Since I'm moving a good deal of information into XML, I figured I'd attempt to move this into XML as well.

Here's my draft:

  • books
    • book id=""
      • title
      • author
      • editor
      • purchase
        • date
        • place
        • price
      • pages
      • sell
        • date
        • price
      • isbn10
      • isbn13
      • readings read=""
        • read (unbound)
          • start
          • end
      • notes 
      • keywords
        • keyword (unbound)

Items in italic are optional.


Currently I allow for or use the following data:

  • id
  • title
  • author
  • editor
  • bought
  • start
  • finish
  • paid
  • store
  • info
  • pages
  • story
  • read
  • sort
  • philosophy
  • sold
  • sold price 

Fortunately, I read my books multiple times, but that also causes issues with a single field for a start and end date. To work against this a delimited the field with a semi-colon.

I never really used story much, and there must be a better way to sort my books, especially since it allows one option to be selected. The philosophy field is nice, but I don't know that that's applicable to a larger audience. To fight against this I've instead added a keywords element, which allows for multiple sub-elements.

I wanted to add ISBN so that I could better track which books I have, as well as potentially join this to Amazon (Associates).


There are a couple of issues with this design.

First, I have books that I have read, but I have no start or end date. I've made the elements optional, but if I have neither then I have nothing but an empty read element.

Should ISBN-1013 be elements, or attributes of the title?

Should the purchase elements' children be elements or attributes?

Should pages be an element or attribute?

Unfortunately, there isn't already an XML example available that covers all of this additional information. So, I'm building on virgin ground (at least as far as what others make available to the world, and what Google finds in the first part of their results).

I realize that this isn't the best place to post if I want answers soon, but, am I missing anything?