Wrox Programmer Forums
|
Other Programming Languages If you have a coding issue to discuss about another language that really isn't provided for in any other forum here (not ASP.NET C#, C++, VB, PHP, JavaScript, Python, Java, Perl, Applescript, XML or any of the other forum topics we have), post it here. Enough discussion on a language we don't have covered could prompt a new forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Other Programming Languages section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 21st, 2006, 09:35 AM
Registered User
 
Join Date: Apr 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Importing XML into database

Hi All
I have to import data(present in csv file format) into database.
The csv data is first converted to a XML file .Then transformed to another XML file , the resolution of keys takes place and then loaded into databse.

Precisely the steps are:
csv to xml1,xml1 to xml2,xml2 to xml3
and xml3 loaded to db
xml1 to xml2 uses a xsl file

The requirement is to create a mapping of input data(coming from csv format) to database table column specified .This mapping is done in xsl file used in transformation(xml1 to xml2).

The xsl file has to be written in a manner so that loading data doesnot fails(coming from csv file) due to relationships(PK,FK or other constraints).But I am not able to handle these relationships in my xsl file.

A part of my xsl file looks like :

<xsl:template match= "Products" >


    <xsl:element name = "catentry" >
        <xsl:attribute name = "partnumber" ><xsl:value-of select = "@ItemPartnumber" /></xsl:attribute>
        <xsl:attribute name = "startdate" ><xsl:value-of select= "@manufacturedate" /></xsl:attribute>
        <xsl:attribute name = "lastupdate" ><xsl:value-of select= "@Lastchangedate" /></xsl:attribute>
        <xsl:attribute name = "catenttype_id" ><xsl:value-of select= "@CategoryIdentifier" /></xsl:attribute>
        <xsl:attribute name = "member_id" ><xsl:value-of select= "$MemberReferenceID" /></xsl:attribute>
        <xsl:attribute name="markfordelete"><xsl:value-of select="$DefaultMarkForDelete"/></xsl:attribute>

    </xsl:element>



    <xsl:element name = "catentdesc" >
        <xsl:attribute name = "shortdescription" ><xsl:value-of select= "@CategoryDesc" /></xsl:attribute>
        <xsl:attribute name="catentry_id"><xsl:value-of select="$CatEntryID"/></xsl:attribute>
        <xsl:attribute name="language_id"><xsl:value-of select="$LanguageID"/></xsl:attribute>
        <xsl:attribute name="available"><xsl:value-of select="$DefaultAvailable"/></xsl:attribute>
        <xsl:attribute name="published">1</xsl:attribute>
    </xsl:element>

CATENTRY,CATENTDESC are table names above!


Hence getting an error:
The insert or update value of the FOREIGN KEY "ADMINISTRATOR.CATENTRY.F_204" is not equal to any value of the parent key of the parent table. SQLSTATE=23503
on record [catentry: [CATENTRY_ID=13651][MEMBER_ID=-700][CATENTTYPE_ID=AP01][PARTNUMBER=MFCS01-CD][MARKFORDELETE=0]]. [sqlcode: -530, sqlstate: 23503]

Looking for suh=ggestions soon,its high priority

Cheers
Ritu


Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
importing XML file in to xslt ashyabhi_hp XSLT 2 September 22nd, 2007 11:15 PM
Problem importing XML data to Excel bluerattle XML 2 July 3rd, 2007 03:35 PM
Problem importing XML data to Excel bluerattle Excel VBA 0 July 3rd, 2007 03:34 PM
Importing XML into database siachen00 XML 0 April 21st, 2006 09:30 AM
Does this book deal with Importing XML? zardos BOOK: Access 2003 VBA Programmer's Reference 0 September 22nd, 2004 06:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.