473,473 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Validate S-expression against a DTD or equivalent?

Hello,

Here's a thought that I'm sure has already occurred to
someone else, I just can't find any record of it yet.

An XML document is just a more verbose and clumsy representation
of an ordinary Lisp S-expression. So it's easy enough to translate
some XML into equivalent Lisp. Now I turn it over to the Lisp
parser, which creates the equivalent of the DOM for me.

However, having parsed an S-expression, the Lisp parser doesn't
go any farther; verifying that the expression contains some
particular set of nested tags is Somebody Else's Problem.

I'm not really interested in translating XML and XML DTD
notations into S-expressions. What really interests me is this:
is there some Lisp code out there to apply a DTD-like construct
(essentially a grammar) to validate an S-expression?

Thanks in advance for staying on topic. 8^)

Robert Dodier
Jul 20 '05 #1
3 2265
ro***********@yahoo.com (Robert Dodier) writes:
Hello,

Here's a thought that I'm sure has already occurred to
someone else, I just can't find any record of it yet.

An XML document is just a more verbose and clumsy representation
of an ordinary Lisp S-expression. So it's easy enough to translate
some XML into equivalent Lisp. Now I turn it over to the Lisp
parser, which creates the equivalent of the DOM for me.

However, having parsed an S-expression, the Lisp parser doesn't
go any farther; verifying that the expression contains some
particular set of nested tags is Somebody Else's Problem.

I'm not really interested in translating XML and XML DTD
notations into S-expressions. What really interests me is this:
is there some Lisp code out there to apply a DTD-like construct
(essentially a grammar) to validate an S-expression?


There are a lot of pattern matching programs that match on
s-expressions. Validating an S-expression with one of these would
simply be putting T as the consequence of matching the pattern.

Of course, when you use one of these pattern matching programs you
generally put something a bit more complicated than T or NIL as the
result clause. Thus you get validation and *computation*
simultaneously rather than needing an extra step.
Jul 20 '05 #2


Robert Dodier wrote:

Hello,

Here's a thought that I'm sure has already occurred to
someone else, I just can't find any record of it yet.

An XML document is just a more verbose and clumsy representation
of an ordinary Lisp S-expression.
the abstract syntax of xml is, strictly speaking, not equivalent to an s-expression.
document models are annotated hypergraphs, which lack an "operator" in the
initial position in the expression. none of the various list-based models for
xml really have an s-expression form.
So it's easy enough to translate
some XML into equivalent Lisp.
it is easy to translates "some xml" into _lists_.
Now I turn it over to the Lisp
parser, which creates the equivalent of the DOM for me.

However, having parsed an [X-expression], the Lisp parser doesn't
go any farther; verifying that the expression contains some
particular set of nested tags is Somebody Else's Problem.

I'm not really interested in translating XML and XML DTD
notations into S-expressions. What really interests me is this:
is there some Lisp code out there to apply a DTD-like construct
(essentially a grammar) to validate an [X-expression]?

the validation engine in cl-xml could be used to validate such data models.
on the other hand, where one has all sorts of lisp-based parsers and pattern
matchers at one's disposal, why would one want to bring dtd's into the picture?
Thanks in advance for staying on topic. 8^)

Robert Dodier

Jul 20 '05 #3


james anderson wrote:

Robert Dodier wrote:

Hello,

Here's a thought that I'm sure has already occurred to
someone else, I just can't find any record of it yet.

An XML document is just a more verbose and clumsy representation
of an ordinary Lisp S-expression.


[ok, i went back and looked. the operator constraint was a figment of my imagination...]

....
Jul 20 '05 #4

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

Similar topics

0
by: SHC | last post by:
Hi all, I have a VC++ .NET 2003 - Windows XP Pro PC. I created a Win32 console application in my VC++ .NET 2003 and copied validateDOM.cpp, books.xml and books.xsd (see the attached files below)...
5
by: Jim Heavey | last post by:
When should you use the Page.Validate() method? I thought you would use this method if you have some Server side validation (CustomControl's) you wanted to use and this would cause them to be...
11
by: jjbutera | last post by:
I know how to use the ErrorProvider in my winforms..or do I? I validate the values and set the ErrorProvider in the validating event. If not valid, I set e.Cancel = True. I clear the ErrorProvider...
0
by: Marc Scheuner | last post by:
Folks, I'm faced with a dilemma here - I have an XML document and for part of it, I have an XSD schema to validate it - but not for the rest of it. Can I still validate at least part of the...
4
by: Brybot | last post by:
I have a form that i've split up into multiple asp:panels, each panel has a number of validators which work correctly. At on the last panel, i want to commit the data collected to a database. I...
24
by: Mike Hofer | last post by:
Please forgive the cross-post to multiple forums. I did it intentionally, but I *think* it was appropriate given the nature of my question. I'm working on an open source code library to help...
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,...
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...
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.