[jdev] help

andy_e at 163.com andy_e at 163.com
Sun Jun 18 11:03:00 CDT 2006


jdev-request,您好!

	

======= 2006-05-19 14:31:33 您在来信中写道:=======

>
>Send jdev mailing list submissions to
>	jdev at jabber.org
>
>To subscribe or unsubscribe via the World Wide Web, visit
>	http://mail.jabber.org/mailman/listinfo/jdev
>or, via email, send a message with subject or body 'help' to
>	jdev-request at jabber.org
>
>You can reach the person managing the list at
>	jdev-owner at jabber.org
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of jdev digest..."
>
>
>Today's Topics:
>
>   1. Re: VTD-XML version 1.6 (crackeur at comcast.net)
>   2. Re: VTD-XML version 1.6 (Trejkaz)
>   3. Using JSO for component development (Christian Cantrell)
>   4. Re: Using JSO for component development (Mridul Muralidharan)
>   5. Re: VTD-XML version 1.6 (crackeur at comcast.net)
>   6. Re: VTD-XML version 1.6 (Robert B Quattlebaum, Jr.)
>   7. Re: VTD-XML version 1.6 (Alexander Gnauck)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Fri, 19 May 2006 00:44:17 +0000
>From: crackeur at comcast.net
>Subject: Re: [jdev] VTD-XML version 1.6
>To: Jabber software development list <jdev at jabber.org>
>Message-ID:
>	<051920060044.27600.446D14E100056BE400006BD022007636929D9A0A050C0E9D0C at comcast.net>
>	
>Content-Type: text/plain; charset="us-ascii"
>
>if by streaming you are referring to SAX parsing, I am reasonably comfortable,
>SAX will be obselete because of a multitude of issues...
>
>I wrote an article on java world entitle simplify XML processing with VTD-XML
>
>-------------- Original message -------------- 
>From: Ralph Meijer <jabber.org at ralphm.ik.nu> 
>
>> On Thu, May 18, 2006 at 09:56:04AM +0200, Michal vorner Vaner wrote: 
>> > On Thu, May 18, 2006 at 09:18:52AM +0200, Ralph Meijer wrote: 
>> > > On Thu, May 18, 2006 at 12:10:41AM -0700, Jimmy Zhang wrote: 
>> > > > The other issue, the way I understand Jabberd, it is a router, how can 
>> > > > one not waiting for the entire document to arrive before routing the 
>> > > > message? 
>> > > > Also what kind of performance jabberd is performing? Do it have to 
>> > > > occasionally modify XML data? 
>> > > 
>> > > Jabber works using direct childs of the root element as the unit of 
>> > > communication, not the whole document. Entities basically open a TCP 
>> > > connection and then during the whole session (which may last days or 
>> > > even longer) two XML documents are being exchanged. One in each 
>> > > direction. 
>> > > 
>> > As I have seen, most jabber libraries have SAX parser to split it into 
>> > the stanzas (these child elements) and there is something like semi-dom 
>> > something to take care of each one. And I guess there will not be much 
>> > difference in the parsers, if it is already split up and built to some 
>> > kind of tree, or joined to gether and passed to any special parser to 
>> > parse it again. And anyway, these pars are rather small - usually few 
>> > bytes. 
>> 
>> Sure. Jimmy didn't seem to understand how XML Streams work, so I gave a 
>> small overview. The point is that he send a message that appears to be 
>> targetted at the larger XML community and someone asking if this stuff 
>> actually works for Jabber. It looked like spam to me initially, too. 
>> 
>> -- 
>> Groetjes, 
>> 
>> ralphm 
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: https://www.jabber.org/jdev/attachments/20060519/119853c5/attachment-0001.html
>
>------------------------------
>
>Message: 2
>Date: Fri, 19 May 2006 11:02:36 +1000
>From: Trejkaz <trejkaz at trypticon.org>
>Subject: Re: [jdev] VTD-XML version 1.6
>To: Jabber software development list <jdev at jabber.org>
>Message-ID: <A4E3DFE8-A83E-4C39-B04A-D27FB422BDCF at trypticon.org>
>Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>
>On 19/05/2006, at 10:42 AM, crackeur at comcast.net wrote:
>
>> Yes, every apps pretty much do that using DOM and SAX?
>> but DOM is the in-memory representation, not what gets sent on
>> the wire? When you route, you have wait for the message to arrive..
>> because in general the app logic depends on data that could reside
>> any where in the XML message....
>>
>> What do jabber put on the wire? It got to be XML right?
>
>Yes, it's one giant XML document.  The start of the document is sent  
>right after you connect, and the end of the document is sent right  
>before you disconnect.
>
>This doesn't cover what happens when you use StartTLS though, it  
>becomes invalid XML at that point.
>TX
>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.4.3 (Darwin)
>
>iD8DBQFEbRkvuMe8iwN+6nMRAijXAJ4/ezq6rD3/NXFRMXLxLy8ormw4VACdGBFS
>COZyylsKvDSqU7LFXY33uYc=
>=rLzc
>-----END PGP SIGNATURE-----
>
>
>------------------------------
>
>Message: 3
>Date: Thu, 18 May 2006 18:16:51 -0700
>From: Christian Cantrell <christiancantrell at mac.com>
>Subject: [jdev] Using JSO for component development
>To: jdev at jabber.org
>Message-ID: <FBDFEB68-E8B6-4DE2-A314-09E87C5AF71D at mac.com>
>Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
>I'm using JSO to build a component, and I'm finding it more than a  
>little confusing.  I've posted to the JSO list, but it's pretty  
>quiet, so I thought I'd try my luck here.
>
>Using JSO, I'm able to connect to my server, listen for specific  
>packets, and return packets successfully.  The part I don't  
>understand is how you continuously listen for packets.  In all the  
>example code I've found, the authors have set up an infinite loop  
>inside of which they call Stream.process() to process new incoming  
>packets, and also keep checking a Queue for new packets to send out.   
>This technique works fine, but it seems odd to me, and is quite  
>resource intensive on my development machine.  Can someone explain:
>
>1. Why is it done this way?
>2. Is there another way to do it?  It seems that I should simply be  
>able to call a method that blocks until the packets I need come in  
>rather than having to process packets in a tight infinite loop.
>
>I'm also wondering if anyone can recommend any other Java XMPP  
>libraries I can use to build an external XMPP component if I can't  
>get JSO to work like I want it to.
>
>Thanks,
>Christian
>
>
>------------------------------
>
>Message: 4
>Date: Fri, 19 May 2006 07:30:30 +0530
>From: Mridul Muralidharan <mridul at sun.com>
>Subject: Re: [jdev] Using JSO for component development
>To: Jabber software development list <jdev at jabber.org>
>Message-ID: <446D26BE.4090505 at sun.com>
>Content-Type: text/plain; format=flowed; charset=ISO-8859-1
>
>Christian Cantrell wrote:
>
>> I'm using JSO to build a component, and I'm finding it more than a  
>> little confusing.  I've posted to the JSO list, but it's pretty  
>> quiet, so I thought I'd try my luck here.
>>
>> Using JSO, I'm able to connect to my server, listen for specific  
>> packets, and return packets successfully.  The part I don't  
>> understand is how you continuously listen for packets.  In all the  
>> example code I've found, the authors have set up an infinite loop  
>> inside of which they call Stream.process() to process new incoming  
>> packets, and also keep checking a Queue for new packets to send out.   
>> This technique works fine, but it seems odd to me, and is quite  
>> resource intensive on my development machine.  Can someone explain:
>>
>> 1. Why is it done this way?
>> 2. Is there another way to do it?  It seems that I should simply be  
>> able to call a method that blocks until the packets I need come in  
>> rather than having to process packets in a tight infinite loop.
>>
>> I'm also wondering if anyone can recommend any other Java XMPP  
>> libraries I can use to build an external XMPP component if I can't  
>> get JSO to work like I want it to.
>>
>> Thanks,
>> Christian
>
>
>
>Hi Christian,
>
>  One solution for this would be to invoke stream.process() when you are 
>sure there is some data available.
>Like , if you are using some producer-consumer model , or if you are 
>using java's nio package.
>With the former , it becomes as simple as just triggering a 
>stream.process() as soon as you have produced some data.
>With the latter , you will need to use async io and register your 
>channel with a selector for read events - which will get notified when 
>there is data available to be read.
>
>With your current approach , if your underlying socket is blocking 
>socket , then you need to worry about cpu usage in an infinite loop - it 
>will block until there is data available : with caveat that you will 
>have one thread per component session.
>If you use nio , the only advantage is that you will be able to listen 
>for read events from multiple streams simultaneously.
>
>Not sure if I am answering your question properly enough ...
>
>Regards,
>Mridul
>
>
>------------------------------
>
>Message: 5
>Date: Fri, 19 May 2006 03:11:40 +0000
>From: crackeur at comcast.net
>Subject: Re: [jdev] VTD-XML version 1.6
>To: Jabber software development list <jdev at jabber.org>
>Message-ID:
>	<051920060311.2495.446D376C0009E354000009BF22135396539D9A0A050C0E9D0C at comcast.net>
>	
>Content-Type: text/plain; charset="us-ascii"
>
>
>you confused me even more...
>I thought IM apps exchange xml messages (usually small), 
>why do they exchange huge XML docs? It sounds not just bad, but unnecessary...
>-------------- Original message -------------- 
>From: Trejkaz <trejkaz at trypticon.org> 
>
>> -----BEGIN PGP SIGNED MESSAGE----- 
>> Hash: SHA1 
>> 
>> 
>> On 19/05/2006, at 10:42 AM, crackeur at comcast.net wrote: 
>> 
>> > Yes, every apps pretty much do that using DOM and SAX? 
>> > but DOM is the in-memory representation, not what gets sent on 
>> > the wire? When you route, you have wait for the message to arrive.. 
>> > because in general the app logic depends on data that could reside 
>> > any where in the XML message.... 
>> > 
>> > What do jabber put on the wire? It got to be XML right? 
>> 
>> Yes, it's one giant XML document. The start of the document is sent 
>> right after you connect, and the end of the document is sent right 
>> before you disconnect. 
>> 
>> This doesn't cover what happens when you use StartTLS though, it 
>> becomes invalid XML at that point. 
>> TX 
>> 
>> -----BEGIN PGP SIGNATURE----- 
>> Version: GnuPG v1.4.3 (Darwin) 
>> 
>> iD8DBQFEbRkvuMe8iwN+6nMRAijXAJ4/ezq6rD3/NXFRMXLxLy8ormw4VACdGBFS 
>> COZyylsKvDSqU7LFXY33uYc= 
>> =rLzc 
>> -----END PGP SIGNATURE----- 
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: https://www.jabber.org/jdev/attachments/20060519/8f704c6c/attachment-0001.htm
>
>------------------------------
>
>Message: 6
>Date: Thu, 18 May 2006 21:55:01 -0700
>From: "Robert B Quattlebaum, Jr." <darco at deepdarc.com>
>Subject: Re: [jdev] VTD-XML version 1.6
>To: Jabber software development list <jdev at jabber.org>
>Message-ID: <AE3768D3-CA2B-48A8-ABC0-0E204472E9E7 at deepdarc.com>
>Content-Type: text/plain; charset="us-ascii"
>
>
>On May 18, 2006, at 8:11 PM, crackeur at comcast.net wrote:
>> you confused me even more...
>> I thought IM apps exchange xml messages (usually small),
>> why do they exchange huge XML docs? It sounds not just bad, but  
>> unnecessary...
>
>You are misunderstanding. The entire connection itself is a well- 
>formed XML document. What you call "xml messages" in jabber are  
>called "stanzas", and are small XML fragments that get sent over the  
>wire.
>
>When I say that the entire connection itself is a well-formed XML  
>document, I mean that it must have a root element. Once the root  
>element is open, that's when stanzas are sent. When the connection is  
>closed, the root element is closed. Thus the entire connection is a  
>well-formed XML document.
>
>
>__________________
>Robert Quattlebaum
>Mobile: +1(650)223-4974
>Jabber: darco at deepdarc.com
>eMail:  darco at deepdarc.com
>www:    http://www.deepdarc.com/
>
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: https://www.jabber.org/jdev/attachments/20060518/60472b6c/attachment-0001.html
>
>------------------------------
>
>Message: 7
>Date: Fri, 19 May 2006 08:31:16 +0200
>From: Alexander Gnauck <gnauck at ag-software.de>
>Subject: [jdev] Re: VTD-XML version 1.6
>To: jdev at jabber.org
>Message-ID: <e4jonl$3i3$1 at sea.gmane.org>
>Content-Type: text/plain; charset=ISO-8859-15; format=flowed
>
>crackeur at comcast.net schrieb:
>>  
>> you confused me even more...
>> I thought IM apps exchange xml messages (usually small),
>
>let me explain XMPP with this small example of a session:
>
>the client connects, open the socket and the XML Document
>C->S: <?xml version="1.0"?>
>C->S: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" 
>xmlns="jabber:client" to="jabber.org" >
>
>server accepts the socket and opens the XML document
>S->C: <stream:stream xmlns='jabber:client' 
>xmlns:stream='http://etherx.jabber.org/streams' from='jabber.org' 
>id='596931'>
>
>the client starts to authenticate
>C->S: <iq type="get" to="jabber.org" id="auth_1" >
>	<query xmlns="jabber:iq:auth">
>		<username>alex</username>
>	</query>
></iq>
>
>S->C: <iq type="result" id="auth_1" >
>	<query xmlns="jabber:iq:auth">
>		<username>gnauck</username>
>		<password/>
>		<digest/>
>		<resource/>
>	</query>
>       </iq>
>
>C->S: <iq type="set" to="jabber.org" id="auth_2" >
>	<query xmlns="jabber:iq:auth">
>	 <username>gnauck</username>
>	 <password>secret</password>
>	 <resource>Psi</resource>
>	</query>
>       </iq>
>
>
>S->C: <iq type="result" id="auth_2" />
>
>C->S: <message type="chat" to="romeo at jabber.org" >	
>	<body>Test</body>
>      </message>
>
>Client closes the connection, which means it closes the XML Document
>C->S: </stream:stream>
>
>Server is closing the XML Doc too
>S->C: </stream:stream>
>
>you see we have 2 complete XML Documents. The client doc and the server 
>doc. Our messages, also called stanzas are the 1st level child elements 
>of the document. If you see the stanzas as a single xml doc and not in 
>the context of the whole document you loose the namespace of the 
>stanzas, and your software is not namespace correct. This is why parsing 
>XMPP XML is a bit tricky and the most out of the box parsers don't work 
>very well without modifying them. My exapmple shows the old jabber style 
>authentication. It gets even more complicated when using SASL, START-TLS 
>and other stuff which resets the stream and opens the document again.
>
> > why do they exchange huge XML docs? It sounds not just bad, but
> > unnecessary...
>
>i don' think so. Because of this XMPP is a very clean and solid 
>protocol. Clean, simple, powerful, extensible.....
>
>Alex
>
>
>
>------------------------------
>
>_______________________________________________
>jdev mailing list
>jdev at jabber.org
>http://mail.jabber.org/mailman/listinfo/jdev
>
>
>End of jdev Digest, Vol 28, Issue 15
>************************************
>

= = = = = = = = = = = = = = = = = = = =
			

        致
礼!
 
				 
        andy_e
        andy_e at 163.com
          2006-06-19



More information about the JDev mailing list