logo       


r10743 - trunk/libraries/xmpp: msg#00046

Subject: r10743 - trunk/libraries/xmpp
Author: turbo24prg
Date: Tue May 16 23:08:42 2006
New Revision: 10743

Modified:
   trunk/libraries/xmpp/client.dylan
Log:
Bug: 7313
* parser works now
* empty elements still not added


Modified: trunk/libraries/xmpp/client.dylan
==============================================================================
--- trunk/libraries/xmpp/client.dylan   (original)
+++ trunk/libraries/xmpp/client.dylan   Tue May 16 23:08:42 2006
@@ -24,9 +24,10 @@
 
 block ()
 //  let parser-depth = 0;
-//  let stream-initiated? = #f;
+  let stream-running? = #f;
   let parsing-tag? = #f;
   let parser-buffer = "";
+  let current-element = #f;
   
   // keep watching that start tags match end tags
   let tag-queue = make(<deque>);
@@ -43,6 +44,9 @@
           elseif (size(tag-queue) = 0 & received ~= '\n')
             //!!! error: not well-formed xml: chars not contained in root 
element
             format-out("!!! error: not well-formed xml: chars not contained in 
root element\n");
+          elseif (size(tag-queue) > 0 & current-element & received ~= '\n')
+            //!!! collect chars into text of current-element!!!
+            current-element.text := add!(current-element.text, received); 
           end if;
         else
           if (received = '>')
@@ -51,19 +55,37 @@
             format-out(">>> %s\n", parser-buffer);
 
             // could be the start tag of an element
-            let (index, start-tag, opened-element?) = 
scan-start-tag(parser-buffer);
+            let (index, start-tag, attributes, opened-element?) = 
scan-start-tag(parser-buffer);
             if (start-tag & opened-element?)
-              format-out("!!! (start)  %s (%s)\n", start-tag, 
real-name(start-tag));
+              format-out("!!! (start)  %s\n", start-tag);
               // should be closed later
               push-last(tag-queue, start-tag);
               format-out("!!! now at depth: %d\n", size(tag-queue));
-              // dispatch();
+              // dispatch  
+              let element = make(<element>, name: as(<string>, start-tag));
+              for (attribute in attributes)
+                add-attribute(element, attribute);
+              end for;
+              if (current-element)
+                add-element(current-element, element);
+              end if;
+              current-element := element;
+              format-out("!!! (current element) %=\n", current-element);
+              if (current-element.name = #"stream:stream" & ~ stream-running?)
+                stream-running? := #t;
+                //!!! do something
+                current-element := #f;
+              end if;
+              // cleanup
               parser-buffer := "";
               parsing-tag? := #f;
               read-next();
             elseif (start-tag & ~ opened-element?)
-              format-out("!!! (empty)  %s (%s)\n", start-tag, 
real-name(start-tag));
-              // dispatch();
+              format-out("!!! (empty)  %s\n", start-tag);
+              // dispatch
+
+            
+              // cleanup
               parser-buffer := "";
               parsing-tag? := #f;
               read-next();
@@ -72,13 +94,27 @@
             // could be the end tag of an element
             let (index, end-tag, opened-element?) = 
scan-end-tag(parser-buffer);
             if (end-tag)
-              format-out("!!! (end)  %s (%s)\n", end-tag, real-name(end-tag));
+              format-out("!!! (end)  %s\n", end-tag);
               // should close the last started tag
               if (as(<symbol>, end-tag) = last(tag-queue))
-                format-out("!!! (successful end)  %s (%s)\n", end-tag, 
real-name(end-tag));
+                format-out("!!! (successful end)  %s\n", end-tag);
                 pop-last(tag-queue);  
                 format-out("!!! now at depth: %d\n", size(tag-queue));
-                // dispatch();
+                // dispatch
+                if (end-tag = "stream:stream" & ~ current-element)
+                  stream-running? := #f;
+                  //!!! shutdown
+                else
+                  format-out("!!! (-) %=\n", current-element);
+                  format-out("!!! (+) %=\n", current-element.element-parent);
+                  if (~ current-element.element-parent)
+                    format-out("!!! (X) %=\n", current-element);
+                    //!!! do something!!!
+                  end if;
+                  //@listener.receive wird ausgeführt wenn @current keinen 
parent hat
+                  current-element := current-element.element-parent;
+                end if;
+                // cleanup
                 parser-buffer := "";
                 parsing-tag? := #f;
                 read-next();
-- 
Gd-chatter mailing list
Gd-chatter@xxxxxxxxxxxxxxxx
https://www.gwydiondylan.org/mailman/listinfo/gd-chatter
Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
Search:
Java, servers, webhosting, windows, cisco ...
more...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe