sateesh arumbaka

Greenhorn
+ Follow
since Nov 22, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sateesh arumbaka

I found this example on
http://www.ibiblio.org/xml/slides/sd2000west/xmlandjava/221.html


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl utput method="text"/>

<xsl:template match="Row">
INSERT INTO composers (
<xsl:apply-templates select="Field" mode="names"/>
)
VALUES (
<xsl:apply-templates select="Field" mode="values"/>
)
</xsl:template>

<xsl:template match="Field" mode="values">
'<xsl:value-of select="."/>'<xsl:if test="position()!=last()">, </xsl:if>
</xsl:template>

<xsl:template match="Field" mode="names" >
'<xsl:value-of select="@name"/>'<xsl:if test="position()!=last()">, </xsl:if>
</xsl:template>

</xsl:stylesheet>
I think using XSLT to generate the insert into queries would do the job faster.

I just started reading a book on XSLT, and my knowledge wouldnt be enough to do this.

can somebody help me with this.

Say for example I have the following xml

<input>
<row>
    <name>clk1</name>
    <pin>N1</pin>
    <fan_out>1365</fan_out>
</row>
<row>
    <name>clk2</name>
    <pin>N2</pin>
    <fan_out>1</fan_out>
</row>
<row>
    <name>clk3</name>
    <pin>N3</pin>
    <fan_out>47</fan_out>
</row>
</input>


how can I get the out put like the following

insert into tableName (name,pin,fan_out) values('clk1','N1','1365')

insert into tableName (name,pin,fan_out) values('clk2','N2','1')

insert into tableName (name,pin,fan_out) values('clk3','N3','47')
[ July 16, 2004: Message edited by: sateesh arumbaka ]
Balaji,

I tried to access the tutorials but its broken.

I too have the same question, what is the best way to push data in to a database from an xml file.

until now I have been using dom parser to parse the xml document and then I put the data in a two dimensional array as name value pairs ,and then create SQL insert into queries from that two dimensional array.

As my XML files have started to become huge, this method is no longer viable as it is taking for ever to load the data in to the two dimensional array.

I am looking out for new and efficient methods of doing this.

One possible solution would be to use XSLTs to generate the SQL insert into queries directly.
or
May be break up the xml files in to smaller pieces and then follow my old procedure...

does any body know of a better way.. please advice..

Thanks in advance
I tried grouping with XSLT but couldnt get it to work,

I heard that XSLT 2.0 has some special functions/support for grouping.
Can you please explain this with an example.

Thanks,
Sateesh
[ July 15, 2004: Message edited by: sateesh arumbaka ]
I too had the same issue....(JDBC returning null for nvarchar types) I am using SQL Server 2000

After searching a lot on the NET....

I realised there is no work around for this issue other than to change the datatype of the column from nvarchar to varchar.

I contacted my dba and asked her to change the nvarchar datatypes columns to varchar. She wasnt ready for that because it was a production database.

So I used a CAST function to convert the nvarchar type to varchar types


for example :
select CAST( columnName as varchar(300)) as columnName from tableName


this worked for me...

hope this helps
Sateesh
Downloaded xerces 1.4.4 and am trying to run SAXCount and DOMCount with validation "on"....
its throwing some errors... like
"[Error] personal-schema.xml:3:50: Element type "personnel" must be declared."
what other settings,,, if any do I need to make/ take care of..
basically I want to run an XML file across a schema and see if the XML file is valid or not...
Thanks in advance..
Sateesh