www.delorie.com/gnu/docs/kawa/kawa_81.html   search  
 
Buy GNU books!


Kawa, the Java-based Scheme system

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.0.1 Scheme functions

Function: make-element tag [attribute ...] child ...
Create a representation of a XML element, corresponding to
 
<tag attribute...>child...</tag>
The result is a TreeList, though if the result context is a consumer the result is instead "written" to the consumer. Thus nested calls to make-element only result in a single TreeList. More generally, whether an attribute or child is includded by copying or by reference is (for now) undefined. The tag should currently be a symbol, though in the future it should be a qualified name. An attribute is typically a call to make-attribute, but it can be any attribute-valued expression.
 
(make-element 'p
	      "The time is now: "
	      (make-element 'code (make <java.util.Date>)))

Function: make-attribute name value...
Create an "attribute", which is a name-value pair. For now, name should be a symbol

Function: as-xml value
Return a value (or multiple values) that when printed will print value in XML syntax.
 
(require 'xml)
(as-xml (make-element 'p "Some " (make-element 'em "text") "."))
prints <p>Some <em>text</em>.</p>.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003