473,410 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

Using XML to serialize a SQL Query

Bob
Let me state up front that I know very little about XML. My experience is
pretty much limited using the XML Serializer to serialize a user preferences
class to a file and back again.

I'm writing a rules engine for an application that basically involves
allowing the user to enter the the WHERE clause for a SQL Server query that
becomes the rule. The rules will be stored in a SQL Server database and the
user will be able to make changes to the rules. The rules are entered through
a non-freeform interface, so I don't have to try and parse the rule after the
user enters it. However, when I retrieve the rule from the database I will
need to identify the parts of the rule to properly repopulate the interface.

My first thought was that i would have to create my own syntax to represent
the rule and write code to parse the result but then I thought XML was
supposed to be good at that sort of thing. So I started reading about XSD
schemas hoping to create something that I could use to create an string
containing the rule that I could write into the database and the opposite.

I started trying to create an XSD schema for the rules and then I looked at
the recursive definition of a SQL WHERE clause and figured I'd better ask for
advice.

I did a Google search for an XSD schema for a SQL Server query and came up
with nothing.

Is XML the correct tool for my problem?

Does anyone know where I can get an XSD schema for either a SQL query or the
WHERE clause?

How do I handle the recursive definition of the WHERE clause in an XSD schema?

Is there a better way to approach my problem?

Thanks,

Bob

Nov 12 '05 #1
2 2443
Hi Bob,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to parse the WHERE clause
yourself. If there is any misunderstanding, please feel free to let me know.

As far as I know, XML and XSD are not the right choice for us to achieve
this. Instead, I recommend you use Regular Expressions.

Regular expressions provide a powerful, flexible, and efficient method for
processing text. The extensive pattern-matching notation of regular
expressions allows you to quickly parse large amounts of text to find
specific character patterns; to extract, edit, replace, or delete text
substrings; or to add the extracted strings to a collection in order to
generate a report. For many applications that deal with strings (such as
HTML processing, log file parsing, and HTTP header parsing), regular
expressions are an indispensable tool.

In .NET framework, we have classes that can manipulate on Regular
Expressions such as Regex under namespace System.Text.RegularExpressions.

For more information, please check the following links:

http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconCOMRegularExpressions.asp

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemTextRegularExpressionsRegexClassTopic.a sp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #2
Sorry, Bob, I may not understand your problem quite well. Thanks to Dino,
for providing such useful information.

Also thanks to Bob for sharing your experience with all the people here. If
you have any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 12 '05 #3

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

Similar topics

0
by: Drew | last post by:
Hello- I have am ASP.Net DataGrid object that I bind to from the result of a query. In order to not retrieve this dataset again when the user presses forward and back, I keep the dataset in a...
10
by: Rafi B. | last post by:
I'm running this on a Linux/CentOs/cPanel server, trying to add caching to my PHP5 code, using ADOdb. I have two Linux servers, one of them is running perfect, the second one, just crashes without...
1
by: Peter Nofelt | last post by:
Hey All, I am having issue with serializing a class and its base class using ..net 2.0. I am using IXmlSerializable I've provided code displaying my at the bottom of this post. Thanks ahead...
1
by: Peter Nofelt | last post by:
Hey All, I am having issue with serializing a class and its base class using ..net 2.0. I am using IXmlSerializable I've provided code displaying my at the bottom of this post. Thanks ahead...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...

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.