[jdev] Driving/Routing directions via XMPP

Richard Dobson richard at dobson-i.net
Tue Aug 17 11:13:08 CDT 2004

> On Wed, 18 Aug 2004 00:10, you wrote:
>> I don't see how your suggestion of child elements actually solves 
>> anything
>> what is the evil user crafted the following:
>>     <src>
>>         <street>4555 Main Street</street>
>>         <jid>bob at jabber.org</jid>
>>     </src>
>> You still don't know anymore than the original about which one should be
>> used,
> And yet, this stanza immediately fails my trivially-written XML schema, 
> and
> gets bounced back to the evil user before my application even has to smell
> it.

Yes but how many actually use this now, I havent heard of any clients or 
servers for that matter that actually validate every stanza they receive 
against an XML schema so this doesnt really help in the real world, in the 
real world code would have to be written to decide what to do rather than it 
being able to be handled by a schema. There is also another major problem 
with using schema validation in that it would effectively prevent 
extensibility if the schema was written the way you suggest which IMO is a 
rather bad thing, unless a method is created to specify where to download 
the appropriate schema from before processing the stanza which presents even 
more problems to performance in having to wait for the schema to download 
before you can process the stanza. Overall schemas are unlikely to be really 
all that useful in the real world where issues of performance and 
scalability are top priorities, certainly in a online service that is being 
accessed by possibly millions of people.

>> all it does is make it slightly more difficult to process and adds
>> unnecessary extra bytes.
> Maybe, if you still use the classic W3C DOM to manipulate all XML.  The 
> rest
> of the world have already discovered better APIs for this, such as XPath. 
> In
> XPath, selecting an attribute is the same as selecting an element, only 
> one
> character longer ("@street" versus "street".)

Also as far as XPath goes I don't think many people are using it at this 
moment in time (due to having to roll their own xml libraries and such to 
process the xmpp xml stream) so in the vast majority of cases it is not just 
a matter of a single character and will involve a lot more than that. Also I 
don't think XPath will help if you as much as you suggest as if you have 
more than one possible option you will need to still iterate through the 
elements that are there, which means you are doing effectively the same 
amount of code as you would have using DOM, its either that or you use XPath 
to check for all the possible options to find which ones do not return null, 
which seems a rather messy way to me, and will probably be more code than 
just iterating through the elements if you have more than a few options.

Your suggestions are interesting but you really do need to think more about 
real world applicability rather than theoretical best case scenarios.


More information about the JDev mailing list