Is it posibble to develop codes to convert and xml data to csv data ?
If it is...can i know if there are any online toturials that i can follow to learn on this ?
8 4044
While I'm pretty sure there are some IDEs out there that can do that, I would recommend an XSLT to do so.
If you have an xml in the following form:
<table>
<row>
<data>value</data>
<data>value</data>
</row>
</table>
You can easily create either scripts or xslt to convert the document. eg. xslt: - <xsl:template match="row">
-
<xsl:for-each select="data">
-
<xsl:value-of select="."/>
-
<xsl:if test="not(last())">,</xsl:if>
-
</xsl:for-each>
-
<xsl:text>
-
</xsl:text><!-- new line -->
-
</xsl:template>
However, if you have a very large document and performance is an issue, I would try an alternative to XSLT since XSLT requires a decent amount of overhead to build a DOM.
As it is, we'd have to know what languages you can work with, and the form of your input to know more.
Hi,
i want to convert xml data to csv data so that i can export it into MySQL database....using php or javascript...the aren't much working examples online....can anyone suggest any tutorial online site for me to visit...?
Thanks
You need to break this down into 2 seperate tasks:
1. Convert xml to csv.
2. Load csv into MySQL
For #2, you're probably going to be using PHP as opposed to javascript.
One way is here: http://dev.mysql.com/doc/refman/5.0/en/load-data.html - LOAD DATA LOCAL INFILE '/importfile.csv'
-
INTO TABLE test_table
-
FIELDS TERMINATED BY ','
-
LINES TERMINATED BY '\n'
-
(field1, field2, field3);
For #1, again taking advantage of existing XSLT processors would probably be the easiest for you, using the XSLT given above. http://ca3.php.net/manual/en/functio...orm-to-xml.php - <?php
-
-
// Load the XML source
-
$xml = new DOMDocument;
-
$xml->load('collection.xml');
-
-
$xsl = new DOMDocument;
-
$xsl->load('collection.xsl');
-
-
// Configure the transformer
-
$proc = new XSLTProcessor;
-
$proc->importStyleSheet($xsl); // attach the xsl rules
-
-
echo $proc->transformToXML($xml);
-
-
?>
Hi,
Just out of curiousity....can we export xml data to mySQL database directy?
Without converting it to csv?
Thanks for helping...!!!
Hi guys,
I've been following this thread as I also need to export to CSV (so that the user can import to Excel) but unfortunately I cannot use any server-side actions (e.g. PHP).
I am using XSLT along with JavaScript and so am hoping that someone can point me towards a HOWTO that shows me how I could (easily) export data (often already dynamically filtered in with JavaScript/XSLT) to file.
Any tips here would be most welcome.
Regards,
Alan Searle
These tips look great. Many thanks: I will experiment with these techniques and am sure that one will fit my needs.
There is one other thing that I will need to sort out which is how to save the result to a separate (text) file or maybe open directly in Notepad.
Here I have been googling on key words but tend to come up with a lot of commercial products offering this functionality. That's very nice but really I would like to understand the whole process and be able to do it myself so was wondering whether you have any pointers to a HOWTO showing how this can be done (maybe with javascript)?
Many thanks,
Alan Searle
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dan Stromberg |
last post by:
I've written up a page about how to convert native binary data to
another platform's native binary data, as I did some fortran data
conversions for a client.
The programs and documentation are...
|
by: Govind |
last post by:
Hi All,
I want to Convert 32 bit integers to byte in right alighed format .
For 32 = the usual way is BitConverter.GetBytes(int32)==> xx xx 00 00 , but
i want right aligned like 00 00 xx xx.Is...
|
by: mustafa |
last post by:
Dear sir ,
I have built my application in visual basic 6.0 and
crystal Report8.5 , Now i migrated my application to
VB.net using the upgrade wizard.My visual basic form is
upgraded to vb.net...
|
by: Pete Davis |
last post by:
I've never done this in C# so I don't know what the appropriate way of doing
it is.
I've got an array of bytes and I need to convert the array into "usable"
data. For example, the first 4 bytes...
|
by: robert d via AccessMonster.com |
last post by:
I'm looking at converting DAO to ADO in my app. All of my DAO connections
are of the following structure:
Dim wsName As DAO.Workspace
Dim dbName As DAO.Database
Dim rsName As DAO.Recordset
...
|
by: Sharon |
last post by:
I have a buffer of byte that contains a raw data of a 1 byte-per-pixel
image data.
I need to convert this buffer to a Bitmap of Format32bppArgb and to a Bitmap
of Format24bppRgb.
Can anybody...
|
by: Bob Alston |
last post by:
Anyone have experience with converting an access app from Jet database
to Mysql? I am specifically looking for any changes I would have to
make to my access forms, queries, modules, vba code, etc....
|
by: SLC via DBMonster.com |
last post by:
Hello I'm a newbie to this and I need help, please
My question is, we currently have a IDMS db and will be converting to DB2.
What are the things I should do? The IDMS has not been documented very...
|
by: psbasha |
last post by:
Hi ,
When ever we read any data from file ,we read as a single line string ,and we convert the respective field data available in that string based on the data type ( say int,float ).
...
|
by: Krishna Ladwa |
last post by:
In Sql Server 2000 Version, I found that no Notification message box appears when converting text column to varchar but the data gets truncated to the given size for the varchar. Whereas it appears...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |