abstraction.
@c This file is part of the MIT/GNU Scheme Reference Manual.
-@c $Id: io.texi,v 1.12 2006/01/30 20:22:41 cph Exp $
+@c $Id: io.texi,v 1.13 2006/01/30 21:05:54 cph Exp $
@c Copyright 1991,1992,1993,1994,1995 Massachusetts Institute of Technology
@c Copyright 1996,1997,1999,2000,2001 Massachusetts Institute of Technology
@deffn procedure make-xml-name qname uri
Creates and returns an @acronym{XML} name. @var{Qname} must be a symbol
whose name satisfies @code{string-is-xml-name?}. @var{Uri} must be an
-@code{xml-namespace-uri} record. The returned value is an @acronym{XML}
+absolute @acronym{URI} record. The returned value is an @acronym{XML}
name that satisfies @code{xml-name?}.
If @var{uri} is the @dfn{null} namespace (satisfies
converted to a symbol using @code{make-xml-qname}.
For convenience, @var{uri} may be a string, in which case it is
-converted to an @code{xml-namespace-uri} record using
-@code{make-xml-namespace-uri}.
+converted to an absolute @acronym{URI} record using
+@code{->absolute-uri}.
@end deffn
@deffn procedure xml-name? object
@end deffn
@deffn procedure xml-name-uri xml-name
-Returns the @dfn{URI} of @var{xml-name} as an @code{xml-namespace-uri}
+Returns the @dfn{URI} of @var{xml-name} as an absolute @acronym{URI}
record.
@end deffn
representation that speeds up type and equality testing. Two
@acronym{URI}s are tested for equality using @code{eq?}.
-@deffn procedure make-xml-namespace-uri string
-@var{String} must be a syntactically valid @acronym{URI} encoded in
-@acronym{UTF-8}. Returns the corresponding @acronym{URI}.
-@end deffn
-
-@deffn procedure xml-namespace-uri? object
-Returns @code{#t} if @var{object} is an @acronym{URI} record, otherwise
-returns @code{#f}.
-@end deffn
-
-@deffn procedure xml-namespace-uri-string uri
-@var{Uri} must satisfy @code{xml-namespace-uri?}. Returns a newly
-allocated string that is a copy of the string used to create @var{uri}.
-@end deffn
-
-The @acronym{URI} of an @acronym{XML} name may be null if there is no
-namespace associated with the name. The null @acronym{URI} is
-abstracted by the following two procedures. Note that the null
-@acronym{URI} satisfies the predicate @code{xml-namespace-uri?}.
-
@deffn procedure null-xml-namespace-uri
Returns the null @acronym{URI} record.
@end deffn
#| -*-Scheme-*-
-$Id: xdoc.scm,v 1.3 2006/01/30 20:23:05 cph Exp $
+$Id: xdoc.scm,v 1.4 2006/01/30 21:05:45 cph Exp $
Copyright 2003,2004,2006 Massachusetts Institute of Technology
(xml-name=? name 'style)
(and (xml-name-prefix=? name 'xmlns)
(not (string=? (xml-attribute-value attr)
- (xml-namespace-uri-string xdoc-uri)))))))
+ (uri->string xdoc-uri)))))))
(define (merged-attribute? attr)
(let ((name (xml-attribute-name attr)))
;;;; XDOC element data types
(define xdoc-uri
- (make-xml-namespace-uri "http://mit.edu/2003/XDOC"))
+ (->absolute-uri "http://mit.edu/2003/XDOC"))
(define (xdoc-name? name)
(xml-name-uri=? name xdoc-uri))
#| -*-Scheme-*-
-$Id: xhtml.scm,v 1.20 2006/01/30 20:20:40 cph Exp $
+$Id: xhtml.scm,v 1.21 2006/01/30 21:05:29 cph Exp $
Copyright 2002,2003,2004,2005,2006 Massachusetts Institute of Technology
(declare (usual-integrations))
\f
(define html-uri-string "http://www.w3.org/1999/xhtml")
-(define html-uri (make-xml-namespace-uri html-uri-string))
+(define html-uri (->absolute-uri html-uri-string))
(define (html-element? object)
(and (xml-element? object)
#| -*-Scheme-*-
-$Id: xml-names.scm,v 1.10 2006/01/30 20:20:42 cph Exp $
+$Id: xml-names.scm,v 1.11 2006/01/30 21:05:31 cph Exp $
Copyright 2003,2004,2005,2006 Massachusetts Institute of Technology
\f
(define (make-xml-name qname uri)
(let ((qname (make-xml-qname qname))
- (uri (make-xml-namespace-uri uri)))
+ (uri (->absolute-uri uri)))
(if (null-xml-namespace-uri? uri)
qname
(begin
\f
;;;; Namespace URI
-(define (make-xml-namespace-uri object)
- (if (string? object)
- (begin
- (if (not (string-is-namespace-uri? object))
- (error:bad-range-argument object 'MAKE-XML-NAMESPACE-URI))
- (hash-table/intern! namespace-uris object
- (lambda ()
- (%make-xml-namespace-uri object))))
- (begin
- (guarantee-xml-namespace-uri object 'MAKE-XML-NAMESPACE-URI)
- object)))
-
-(define (string-is-namespace-uri? object)
- ;; See RFC 1630 for correct syntax.
- (utf8-string-valid? object))
-
-(define namespace-uris
- (make-string-hash-table))
-
-(define-record-type <xml-namespace-uri>
- (%make-xml-namespace-uri string)
- xml-namespace-uri?
- (string %xml-namespace-uri-string))
-
-(define (guarantee-xml-namespace-uri object caller)
- (if (not (xml-namespace-uri? object))
- (error:not-xml-namespace-uri object caller)))
-
-(define (xml-namespace-uri-string uri)
- (string-copy (%xml-namespace-uri-string uri)))
-
(define (null-xml-namespace-uri? object)
(eq? object null-namespace-uri))
null-namespace-uri)
(define null-namespace-uri
- (make-xml-namespace-uri ""))
-
-(define (error:not-xml-namespace-uri object caller)
- (error:wrong-type-argument object "an XML namespace URI" caller))
+ (->relative-uri ""))
(define xml-uri
- (make-xml-namespace-uri "http://www.w3.org/XML/1998/namespace"))
+ (->absolute-uri "http://www.w3.org/XML/1998/namespace"))
(define xmlns-uri
- (make-xml-namespace-uri "http://www.w3.org/2000/xmlns/"))
\ No newline at end of file
+ (->absolute-uri "http://www.w3.org/2000/xmlns/"))
\ No newline at end of file
#| -*-Scheme-*-
-$Id: xml-parser.scm,v 1.66 2006/01/30 20:20:44 cph Exp $
+$Id: xml-parser.scm,v 1.67 2006/01/30 21:05:32 cph Exp $
Copyright 2001,2002,2003,2004,2005,2006 Massachusetts Institute of Technology
(tail (loop (cdr attrs))))
(let ((qname (car uname))
(p (cdr uname)))
- (let ((get-uri (lambda () (make-xml-namespace-uri value)))
+ (let ((get-uri
+ (lambda ()
+ (if (string-null? value)
+ (null-xml-namespace-uri)
+ (->absolute-uri value))))
(forbidden-uri
(lambda (uri)
(perror p "Forbidden namespace URI" uri))))
#| -*-Scheme-*-
-$Id: xml-struct.scm,v 1.51 2006/01/30 20:20:46 cph Exp $
+$Id: xml-struct.scm,v 1.52 2006/01/30 21:05:33 cph Exp $
Copyright 2001,2002,2003,2004,2005,2006 Massachusetts Institute of Technology
(symbol-append 'xmlns: prefix))
elt)))
(and value
- (make-xml-namespace-uri value))))
+ (if (string-null? value)
+ (null-xml-namespace-uri)
+ (->absolute-uri value)))))
(define (xml-element-namespace-prefix elt uri)
- (let ((uri (xml-namespace-uri-string uri)))
+ (let ((uri (uri->string uri)))
(let ((attr
(find-matching-item (xml-element-attributes elt)
(lambda (attr)
(cond ((xml-content-item? value) value)
((symbol? value) (symbol-name value))
((number? value) (number->string value))
- ((xml-namespace-uri? value) (xml-namespace-uri-string value))
+ ((uri? value) (uri->string value))
((list-of-type? value xml-nmtoken?) (nmtokens->string value))
(else (error:wrong-type-datum value "XML string value"))))
#| -*-Scheme-*-
-$Id: xml.pkg,v 1.62 2006/01/30 20:20:41 cph Exp $
+$Id: xml.pkg,v 1.63 2006/01/30 21:05:30 cph Exp $
Copyright 2001,2002,2003,2004,2005,2006 Massachusetts Institute of Technology
(files "xml-names")
(parent (runtime xml))
(export ()
- <xml-namespace-uri>
error:not-xml-name
- error:not-xml-namespace-uri
error:not-xml-nmtoken
error:not-xml-qname
guarantee-xml-name
- guarantee-xml-namespace-uri
guarantee-xml-nmtoken
guarantee-xml-qname
make-xml-name
make-xml-name-hash-table
- make-xml-namespace-uri
make-xml-nmtoken
make-xml-qname
null-xml-name-prefix
xml-name-uri=?
xml-name=?
xml-name?
- xml-namespace-uri-string
- xml-namespace-uri?
xml-nmtoken-string
xml-nmtoken?
xml-qname-local