473,471 Members | 4,687 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Saving XML to db

Hi All,

What would be the best way to save XML to a database?

I mean I can use the example
'http://www.php.net/manual/en/function.mysql-real-escape-string.php'.

they give a function to prevent any SQL Injection,

function quote_smart($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not integer
if (!is_numeric($value)) {
$value = "'" . mysql_real_escape_string($value) . "'";
}
return $value;
}

but then how do I get the data back, (as intended), from the db?
what would be the reverse of the above code?

Many thanks
Simon
Jul 17 '05 #1
4 1423
*** simon escribió/wrote (Fri, 11 Feb 2005 18:15:00 -0000):
but then how do I get the data back, (as intended), from the db?
what would be the reverse of the above code?


No.

--
-+ Álvaro G. Vicario - Burgos, Spain
+- http://www.demogracia.com (la web de humor barnizada para la intemperie)
++ Manda tus dudas al grupo, no a mi buzón
-+ Send your questions to the group, not to my mailbox
--
Jul 17 '05 #2
"Alvaro G. Vicario" <kA*****************@terra.es> wrote in message
news:nj*****************************@40tude.net...
*** simon escribió/wrote (Fri, 11 Feb 2005 18:15:00 -0000):
but then how do I get the data back, (as intended), from the db?
what would be the reverse of the above code?


No.


Sorry, what does that mean? is there no way to get the data back as
intended? So how would I save XML then?

Simon
Jul 17 '05 #3
simon <sp********@myoddweb.com> wrote:
but then how do I get the data back, (as intended), from the db?
what would be the reverse of the above code?


No.


Sorry, what does that mean? is there no way to get the data back as
intended?


The code tries to handle magic quotes settings (which IMHO is extremely
evil by default), so if $value isn't extracted from GET/POST/COOKIE it
will be wrongfully stripped.

Jul 17 '05 #4
I would use a Native XML data base like Apache.org's Xindice (http://xml.apache.org/xindice/) or DBXML (http://www.dbxml.com/)

The advantage is the DOM of the XML is stored not the textual strings, so you can search the XML data in the database using XML
constructs like XPATH (very cool).

I think both os these run in either the Jetty Java servlet container or under Tomcat.

I've heard, but not confirmed, that Oracle 8 and above can also provide an XML schema capable of the same functions.

On Fri, 11 Feb 2005 18:15:00 -0000, "simon" <sp********@myoddweb.com> wrote:
Hi All,

What would be the best way to save XML to a database?

I mean I can use the example
'http://www.php.net/manual/en/function.mysql-real-escape-string.php'.

they give a function to prevent any SQL Injection,

function quote_smart($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not integer
if (!is_numeric($value)) {
$value = "'" . mysql_real_escape_string($value) . "'";
}
return $value;
}

but then how do I get the data back, (as intended), from the db?
what would be the reverse of the above code?

Many thanks
Simon


Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: G-Factor | last post by:
Hi all I've just started learning about saving files. I got bit of a problem. The following code gives me an error about incompatible types. (Cannot covert from class character to char *). I...
1
by: Mahesh Devjibhai Dhola [MVP] | last post by:
Hi, User can adjust the size of columns of a table or the position of splitter in UI. We want these adjustments to be remembered when we restart the application. Currently, we are saving these...
2
by: manning_news | last post by:
Has anyone had a problem with Access 2003 not saving their coding? I've been using 2003 for a couple of months now and just this week noticed that some coding I'd done for a database was not there...
14
by: Amitabh Deepak | last post by:
Is there any way to check whether daylight saving is enabled on a linux machine?
2
by: Peder Y | last post by:
My code is something like this: --------------- Image img = Image.FromFile("somefile.bmp"); FileStream fStream = new FileStream("someBinaryFile.dat"); BinaryWriter bw = new...
4
by: John Kandell | last post by:
Hi, I posted this in the asp.net group, but didn't get a response. Maybe someone here can help me with this... --- Would someone be able to shed some light on what is the cost of saving a...
4
by: dale zhang | last post by:
Hi, I am trying to save and read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp Right now, I saved images without any...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
2
by: =?Utf-8?B?bWFydGluMQ==?= | last post by:
Hi, All, My app picks ccurrent time on the PC to retrieve data from sql DB, the Sql data is always data with non-daylight saving. The app runs on PC with both daylight saving and non-daylight...
27
by: RobG | last post by:
I was investigating a function to determine whether daylight saving was being observed on a particular date (given the platform's regional settings) and came across a suggestion at merlyn.com to...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
tracyyun
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.