Update of /cvsroot/monetdb/MonetDB5/src/modules/atoms
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26665/src/modules/atoms
Modified Files:
Tag: GDK-2
Makefile.ag
Added Files:
Tag: GDK-2
xml.mx
Log Message:
propagated changes of Friday Aug 17 2007 - Tuesday Aug 21 2007
from the development trunk to the GDK-2 branch
Index: Makefile.ag
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/atoms/Makefile.ag,v
retrieving revision 1.32.2.1
retrieving revision 1.32.2.2
diff -u -d -r1.32.2.1 -r1.32.2.2
--- Makefile.ag 17 Aug 2007 15:36:53 -0000 1.32.2.1
+++ Makefile.ag 21 Aug 2007 13:24:00 -0000 1.32.2.2
@@ -46,7 +46,7 @@
scripts_mal = {
DIR = pkglibdir
- SOURCES = str.mx blob.mx url.mx mtime.mx streams.mx inet.mx color.mx
+ SOURCES = str.mx blob.mx url.mx mtime.mx streams.mx inet.mx color.mx
xml.mx
}
EXTRA_DIST_DIR = Tests
--- NEW FILE: xml.mx ---
@' The contents of this file are subject to the MonetDB Public License
@' Version 1.1 (the "License"); you may not use this file except in
@' compliance with the License. You may obtain a copy of the License at
@' http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html
@'
@' Software distributed under the License is distributed on an "AS IS"
@' basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
@' License for the specific language governing rights and limitations
@' under the License.
@'
@' The Original Code is the MonetDB Database System.
@'
@' The Initial Developer of the Original Code is CWI.
@' Portions created by CWI are Copyright (C) 1997-2007 CWI.
@' All Rights Reserved.
@f xml
@a Sjoerd Mullender, Niels Nes, Martin Kersten
@v 0.1
@+ MAL support for XQL
This module contains the primitives needed in the SQL
front-end to support SQL/XML.
@mal
atom xml:str; #use a subtype for XML
command xml(src:str):xml
address XMLstr2xml
comment "Cast the string to an xml compliant string";
command str(src:xml):str
address XMLxml2str
comment "Cast the string to an xml compliant string";
command comment(val:str):xml
address XMLcomment
comment "Construct an comment struction ";
command parse(val:str,option:str):xml
address XMLparse
comment "Parse the XML document or element string values ";
command pi(nme:str,val:str):xml
address XMLpi
comment "Call the processing instruction";
command root(val:xml, version:str, standalone:str):xml
address XMLroot
comment "Contruct the root nodes";
command attribute(name:str, val:str):xml
address XMLattribute
comment "Construct an attribute value pair";
pattern attributes(val:xml... ):xml
address XMLattributes
comment "Collect the attributes of an element into a single structure";
pattern element(name:str, ns:bat[:oid,:str], attr:xml, s:xml... ) :xml
address XMLelement
comment "The basic building block for XML elements are namespaces, attributes
and a sequence
of xml elements. The name space and the attributes may be left
unspecified(=nil:bat).";
pattern concat(val:xml... ):xml
address XMLconcat
comment "Concatenate the xml values";
command trunk(nme:str, val:xml):xml
address XMLtrunk
comment "Prepare an element for a forest construction";
pattern forest(val:xml...):xml
address XMLforest
comment "Construct an element list");
command isdocument(val:str):bit
address XMLisdocument
comment "Validate the string as a document"
@{
@- Implementation
The implementation of the XML atomary type is based
on linking in a portable library, e.g. libxml2 ?
@h
#ifndef XML_H
#define XML_H
#include "mal_config.h"
#include <gdk.h>
#include "mal.h"
#include "mal_instruction.h"
#include "mal_exception.h"
typedef str xml;
#ifdef WIN32
#ifndef LIBURL
#define xml_export extern __declspec(dllimport)
#else
#define xml_export extern __declspec(dllexport)
#endif
#else
#define xml_export extern
#endif
xml_export str XMLxml2str(str *s, xml *x);
xml_export str XMLstr2xml(xml *x, str *s);
xml_export str XMLisdcoument(bit *x, str *s);
xml_export str XMLcomment(xml *x, str *s);
xml_export str XMLpi(xml *x, str *nme, str *s);
xml_export str XMLroot(str *x, str *v, str *version, str *standalone);
xml_export str XMLparse(xml *x, str *s, str *option);
xml_export str XMLattribute(xml *ret, str *name, str *val);
xml_export str XMLattributes(MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
xml_export str XMLelement(MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
xml_export str XMLconcat(MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
xml_export str XMLforest(MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
xml_export str XMLtrunk(int *ret, str *nme, str *val);
#endif /* XML_H */
@c
#include "xml.h"
str
XMLxml2str(str *s, xml *x){
*s= GDKstrdup(*x);
return MAL_SUCCEED;
}
str
XMLstr2xml(xml *x, str *s){
(void) x;
(void) s;
if(/* validate string */ 0)
throw(MAL,"xml.xml","Invalid xml format");
return MAL_SUCCEED;
}
str
XMLisdocument(bit *x, str *s){
(void) x;
(void) s;
throw(MAL,"xml.isdocument","Not yet implemented");
}
str
XMLcomment(xml *x, str *s){
(void) x;
(void) s;
throw(MAL,"xml.comment","Not yet implemented");
}
str
XMLparse(xml *x, str *nme, str *option){
(void) x;
(void) option;
(void) nme;
throw(MAL,"xml.parse","Not yet implemented");
}
str
XMLpi(str *ret, str *operator, str *bid)
{
(void) ret;
(void) operator;
(void) bid;
throw(MAL,"xml.pi","Not yet implemented");
}
str
XMLroot(str *ret, str *bid, str *version, str *standalone)
{
(void) ret;
(void) version;
(void) standalone;
(void) bid;
throw(MAL,"xml.root","Not yet implemented");
}
str
XMLattribute(xml *ret, str *name, str *val)
{
(void) ret;
(void) name;
(void) val;
throw(MAL,"xml.attribute","Not yet implemented");
}
str
XMLattributes(MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
(void) mb;
(void) stk;
(void) p;
throw(MAL,"xml.attributes","Not yet implemented");
}
str
XMLelement(MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
(void) mb;
(void) stk;
(void) p;
throw(MAL,"xml.element","Not yet implemented");
}
str
XMLconcat(MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
(void) mb;
(void) stk;
(void) p;
throw(MAL,"xml.element","Not yet implemented");
}
str
XMLtrunk(int *ret, str *nme, str *val){
(void) ret;
(void) nme;
(void) val;
throw(MAL,"xml.trunk","Not yet implemented");
}
str
XMLforest(MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
{
(void) mb;
(void) stk;
(void) p;
throw(MAL,"xml.element","Not yet implemented");
}
@sql
CREATE TYPE xml EXTERNAL NAME xml;
CREATE FUNCTION xml (s STRING) RETURNS xml external name xml.xml;
CREATE FUNCTION str (s XML) RETURNS STRING external name xml.str;
CREATE FUNCTION comment (s STRING) RETURNS xml external name xml.comment;
CREATE FUNCTION parse (val STRING, option STRING) RETURNS xml external name
xml.parse;
CREATE FUNCTION pi (nme STRING, val STRING) RETURNS xml external name xml.pi;
CREATE FUNCTION root (val STRING, version STRING, standalone STRING) RETURNS
xml external name xml.root;
CREATE FUNCTION attribute (nme STRING, val STRING) RETURNS xml external name
xml.attribute;
CREATE FUNCTION element (nme STRING, ns STRING, attr xml, s xml) RETURNS xml
external name xml.element;
CREATE FUNCTION concat (val1 xml, val2 xml) RETURNS xml external name
xml.concat;
CREATE FUNCTION trunk (nme str, val xml) RETURNS xml external name xml.trunk;
CREATE FUNCTION forest (val1 xml, val2 xml) RETURNS xml external name
xml.forest;
CREATE FUNCTION isdocument (val STRING) RETURNS xml external name
xml.isdocument;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins