[Gd-chatter] r10729 - trunk/libraries/xml-parser

turbo24prg at gwydiondylan.org turbo24prg at gwydiondylan.org
Fri May 12 13:34:42 CEST 2006


Author: turbo24prg
Date: Fri May 12 13:34:39 2006
New Revision: 10729

Modified:
   trunk/libraries/xml-parser/printing.dylan
   trunk/libraries/xml-parser/simple-xml.dylan
Log:
Bug: 7306
needed by xmpp


Modified: trunk/libraries/xml-parser/printing.dylan
==============================================================================
--- trunk/libraries/xml-parser/printing.dylan	(original)
+++ trunk/libraries/xml-parser/printing.dylan	Fri May 12 13:34:39 2006
@@ -216,3 +216,10 @@
 define method prepare-document(doc :: <document>, state :: <printing>, 
                                stream :: <stream>) => ()
 end method prepare-document;
+
+define method as (class == <string>, xml :: <xml>)
+ => (res :: <string>);
+  let stream = make(<string-stream>, direction: #"output");
+  print-object(xml, stream);
+  stream-contents(stream);
+end method as;

Modified: trunk/libraries/xml-parser/simple-xml.dylan
==============================================================================
--- trunk/libraries/xml-parser/simple-xml.dylan	(original)
+++ trunk/libraries/xml-parser/simple-xml.dylan	Fri May 12 13:34:39 2006
@@ -213,6 +213,7 @@
   end if;
 end method;
 
+define open generic elements (element :: <element>, name :: <object>) => (res :: <sequence>);
 define method elements (element :: <element>, element-name) 
  => (res :: <sequence>);
   choose(method (a)
@@ -267,3 +268,15 @@
   remove-attribute(element, "xmlns");
   element;
 end method remove-namespace;
+
+define method replace-element-text (element :: <element>, node :: <string>, text :: <string>)
+  let replace-element = #f;
+  let replace-elements = elements(element, node);
+  if (empty?(replace-elements))
+    replace-element := make(<element>, name: node);
+    add-element(element, replace-element);
+  else
+    replace-element := first(replace-elements);
+  end if;
+  replace-element.text := escape-xml(text);
+end method replace-element-text;



More information about the chatter mailing list