Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Converting XML to Access
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

MarkJH
Senior Member

United Kingdom
1722 Posts

Posted - 26 January 2006 :  02:29:20  Show Profile  Visit MarkJH's Homepage
Does anybody know if there's software available to convert an XML document into an Access database?

Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/

HuwR
Forum Admin

United Kingdom
20600 Posts

Posted - 26 January 2006 :  04:38:20  Show Profile  Visit HuwR's Homepage
http://www.databasejournal.com/features/msaccess/article.php/3310901
Go to Top of Page

MarkJH
Senior Member

United Kingdom
1722 Posts

Posted - 26 January 2006 :  19:35:46  Show Profile  Visit MarkJH's Homepage
Thanks, Huw.

Oh my, that is complicated. All I want to do is convert the Musicmoz dump (http://musicmoz.org/xml/) to an Access database so I can extract certain information and merge it into my own site database.

I've tried the Get External Data/Import XML feature in Access 2003 but it explodes with errors.

Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/
Go to Top of Page

MarkJH
Senior Member

United Kingdom
1722 Posts

Posted - 29 January 2006 :  04:28:30  Show Profile  Visit MarkJH's Homepage
Well, I managed to get the file to load into Access 2003. It works "fine" once you remove an '&' from a URL.

Now, everything in the format <field></field> converts into it fine but everything else doesn't.

This is a section of the code for Madonna:

<category name="Bands_and_Artists/M/Madonna" canapply="1" cansubmit="1" type="artist">
<summary>Madonna was born in 1958. She was signed to Sire Records in 1982. In 2000 she launched her newest album Music as well as having her second child Rocco and getting married in Scotland to Guy Richie. Madonna has had a long career spanning the 1980s and 1990s and has produced around a dozen albums during this time.</summary>
<resource name="dmoz" link="http://dmoz.org/Arts/People/M/Madonna/" />
<resource name="amg" link="http://allmusic.com/cg/amg.dll?P=amg&sql=B0iknikc6bbo9" />
<resource name="yahoolaunch" link="http://launch.yahoo.com/artist/default.asp?artistID=1016600" />
<resource name="muchmusic" link="http://www.muchmusic.com/music/artists/index.asp?artist=214" />
<resource name="musicbrainz" link="http://musicbrainz.org/artist/79239441-bfd5-4981-a70c-55c3f15c1287.html" />
<resource name="nme" link="http://www.nme.com/artists/55205.htm" />
<resource name="artistdirect" link="http://artistdirect.com/music/artist/card/0,,414944,00.html" />
<resource name="vh1" link="http://www.vh1.com/artists/az/madonna/artist.jhtml" />
<resource name="rollingstone" link="http://rollingstone.com/artists/default.asp?oid=370" />
<resource name="mtv" link="http://www.mtv.com/bands/az/madonna/artist.jhtml" />
<resource name="songfacts" link="http://songfacts.com/artistfacts/detail.lasso?id=118" />
<subcat name="Concerts" items="14" />
<subcat name="Discography" items="15" />
<subcat name="Links" items="95" />
<editor name="mizum" />
<name>Madonna</name>
<from>United States</from>
<style number="1">Pop</style>
<born>1958</born>
<bornas>Madonna Louise Veronica Ciccone</bornas>
<logo src="http://musicmoz.org/img/editors/dpen2000/MadMusic.jpg" width="130" height="130" />
...
...

<summary>, <name>, <from>, <born> and <bornas> sort themselves into fields but the rest doesn't.

I wondered if there was a way I could somehow force the rest of the data to convert to database?

Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/
Go to Top of Page

MarkJH
Senior Member

United Kingdom
1722 Posts

Posted - 30 January 2006 :  19:37:35  Show Profile  Visit MarkJH's Homepage
Anybody?

Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 30 January 2006 :  21:00:39  Show Profile  Visit dayve's Homepage
just parse the XML using ASP and insert it into a database. there is not going to be an easy way to tell Access how to import the data.

Go to Top of Page

MarkJH
Senior Member

United Kingdom
1722 Posts

Posted - 31 January 2006 :  02:22:37  Show Profile  Visit MarkJH's Homepage
Okay, so this should help me, right?

You've put me on the right track, thanks Dayve.

Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 01 February 2006 :  00:16:21  Show Profile  Visit dayve's Homepage
quote:
Originally posted by MarkJH

Okay, so this should help me, right?


kind of.... but you will need to use the XML HTTP Request because you are reading a remote file, but once you do that, reading the nodes is quite similar.

Go to Top of Page

MarkJH
Senior Member

United Kingdom
1722 Posts

Posted - 01 February 2006 :  02:16:54  Show Profile  Visit MarkJH's Homepage
Okay, I'll let you know how I get on. I'll owe you a very large drink if this all works out.

Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/
Go to Top of Page

MarkJH
Senior Member

United Kingdom
1722 Posts

Posted - 01 February 2006 :  12:34:25  Show Profile  Visit MarkJH's Homepage
I've been studying up on XML... about time I got to grips with a different language.

It would seem that if I change the attributes such as:

<release type="album" name="American Life" date="2003" ref="Bands_and_Artists/M/Madonna/Discography/American_Life" />


into child elements such as:

<release>
  <type>album</type>
  <name>American Life</name>
  <date>2003</date>
  <ref>Bands_and_Artists/M/Madonna/Discography/American_Life</ref>
</release>


then I can easily import it into Access without the need of a parser. Either a bunch of find/replaces or maybe (doubtful) there is software that will convert attributes to child elements.

Am I over-complicating things for myself or does this make sense?

Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/

Edited by - MarkJH on 01 February 2006 12:35:39
Go to Top of Page

MarkJH
Senior Member

United Kingdom
1722 Posts

Posted - 01 February 2006 :  19:40:13  Show Profile  Visit MarkJH's Homepage
Well, after learning XML on the fly, I've managed to come up with this XSL to lift the artist biographies out of the original dump:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
  <body style="font-family:Arial,helvetica,sans-serif;font-size:10pt;
        background-color:#EEEEEE">
    <xsl:for-each select="musicmoz//item">
      <xsl:if test="@type='biography'">
        <xsl:if test="preceding-sibling::name">
      		<div style="background-color:red;color:white;padding:4px">
        		<span style="font-weight:bold;color:white">
        		<xsl:value-of select="preceding-sibling::name"/>
        		</span>
      		</div>
      		<div style="background-color:teal;color:white;padding:4px">
        		<span style="font-weight:bold;color:white">
        		<img src="{preceding-sibling::logo/@src}"/>
        		<xsl:value-of select="body"/>
     		   	</span>
      		</div>
      		<div style="margin-left:20px;margin-bottom:1em;font-size:8pt">
        		<span style="font-style:italic">
        		</span>
      		</div>
      	</xsl:if>
    	</xsl:if>
    </xsl:for-each>
  </body>
</html>
</xsl:template>
</xsl:stylesheet>


Now that I've got is sussed this far, I don't think I'll have too much of a problem extracting pretty much anything I like out of it.

Bandlink.net - http://www.bandlink.net/
Bandlink Music Forums - http://www.bandlink.net/forum/

Edited by - MarkJH on 01 February 2006 19:54:29
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.37 seconds. Powered By: Snitz Forums 2000 Version 3.4.07