mIRC Home    About    Download    Register    News    Help

Print Thread
#1378 12/12/02 09:07 PM
Joined: Dec 2002
Posts: 1
C
Mostly harmless
OP Offline
Mostly harmless
C
Joined: Dec 2002
Posts: 1
I was thinking about this and see no reason for this not to be possible, why not embed some sort of XML parser, i know there is already ini config files support which could be used to store info but an XML parser would be much better. let me know what you think grin

thanks
-rock


"If you can't beat your computer at chess, try kickboxing."
-Anon.

#1379 12/12/02 11:21 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
I'm one of those people who hates XML even though I know it is gonna be used more and more so I don't like the idea personally. But as I said XML is being used more and more, so I guess it is a good idea. If Khaled doesn't wanna add it I'm sure it would be relatively easy to do with a dll.

#1380 12/12/02 11:37 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
How would it work though? I would imagine the code to access a subnode several levels deep would look horrible in any format based on mIRC's scripting syntax. In my opinion XML is something which requires more advanced programming concepts than mIRC scripting can provide to make comprehensive support. And with that in mind it would be pointless to make those additions simply for XML.

If you can think of a syntax which would work then by all means correct me, but as it is I can't see any implementation that wouldn't look pretty damn awful - then again, I don't have much of an imagination.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#1381 13/12/02 12:30 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
I'm not too familiar with XML but a simple 'slash syntax' for parent-child relations could work...

node/subnode/subsubnode/subsubsubnode

But like I say, not too familiar with XML so I could be totally wrong.

#1382 13/12/02 05:28 AM
Joined: Dec 2002
Posts: 66
Babel fish
Offline
Babel fish
Joined: Dec 2002
Posts: 66
Probably the majority of people who would want XML in mIRC don't see much multi-level nodes.

Most commonly XML (that people see) is single level based (I did say commonly) and that wouldn't be hard to make a parser with a simple loop an regex/gettok.

But for finite level nodes you'd just need to do some recursion and regex/gettok (I'd use regex) but with recursion (I know it's not *technically* possible without timers/dummy aliases calls) you could probably easily figure out how to make the hierarchy.

I don't personally think it would be very hard just take some logic and planning. But of course it wouldn't be as efficent as one in C/C++ like Khaled could provide ... but then again, there's no fun in that =P


- Linux System Administrator, Darktides Communications, LLC.
#1383 13/12/02 02:27 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
The problem with that being that the subnodes wouldn't necessarily be distuinguishable using text to identify them.
For example here's a simple XML file:

Code:
<library>
  <book>
    <title>The Big Book of mIRC</title>
    <author>K. Mardam-Bey</author>
    <review>
      <source>NY Times</source>
      <content>Wow, what a great book</content>
    </review>
    <review>
      <source>Arnie</source>
      <content>Moo!</content>
    </review>
  </book>
  <book>
    <title>Monopolising The Marketplace</title>
    <author>B. H. Gates</author>
    <review>
      <source>PC Buyer</source>
      <content>Blah blah blah...</content>
    </review>
  </book>
  <book>
    <title>XML For Dummies</title>
    <author>W. W. Web</author>
  </book>
</library>


Now, say you wanted to get Arnie's review of 'The Big Book of mIRC'.
Immediately you've got a problem in that all the children of 'library' are called 'book' - no simple text identifier available. With a language that had arrays etc. that wouldn't be a problem, it would simply be a case of referring to it as library/book[0] (assuming a 0-based array). With mIRC there's no such luck, using traditional mIRC syntax the way to identify that would be something like $xmlsub(library,book,1) - which doesn't look too bad.
So then we move on to getting the correct 'review' subnode, again there's more than one node of the same type, with the array-enabled language it's just a matter of library/book[0]/review[1], but what would that look like for mIRC? The previous $xmlsub usage is useless since it wouldn't return an object, just $true. How would be refer to it? I suppose it could simply use some syntax which resembled the array style, but then it wouldn't follow traditional mIRC syntaxing and could be misleading to a newcomer who might think he was dealing with actual arrays.

I'm not trying to put down the idea of XML functionality in mIRC, I use XML myself a fair bit in webdev, it just seems a bit of a stretch at the moment.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#1384 13/12/02 05:27 PM
Joined: Dec 2002
Posts: 66
Babel fish
Offline
Babel fish
Joined: Dec 2002
Posts: 66
You do have a good point... arrays would be so much easier to use as a method of storing things and mIRC don't provide them.



- Linux System Administrator, Darktides Communications, LLC.
#1385 14/12/02 03:11 AM
Joined: Dec 2002
Posts: 87
V
vcv Offline
Babel fish
Offline
Babel fish
V
Joined: Dec 2002
Posts: 87
Khaled is welcome to use the XML engine I am writing in C++ to offer support via scripting.

codemastr made a good sueggestion about using a path-style syntax to access the data.. which is exactly what my engine is going to use.

For example, let's take the xml data s_m posted.. to access <source>PC Buyer</source>, you would pass /library/book[1]/review/source to a function called..say... $getxmldata.

Or..in this casem, there is an undefined number of books in the library..so an iterator could be offered that could work similar to tokens..

Code:
var %child_count = $xml_child_count(/library)
var %i = 1
while (%i &lt;= %child_count) {
   echo -a $xml_get_data(/library/book[ $+ %i $+ ]/review/source)
}


or something along the lines. the details are a bit sketchy.. but i think its a nice idea.

#1386 14/12/02 07:13 AM
Joined: Dec 2002
Posts: 89
N
Babel fish
Offline
Babel fish
N
Joined: Dec 2002
Posts: 89
I guess you use the XML parser by Microsoft?


Sincerely,
Necroman, #mIRC @ Undernet
#1387 14/12/02 01:22 PM
Joined: Dec 2002
Posts: 339
F
Fjord artisan
Offline
Fjord artisan
F
Joined: Dec 2002
Posts: 339
Just by curiosity XML stands for?

#1388 14/12/02 01:26 PM
Joined: Dec 2002
Posts: 164
M
Vogon poet
Offline
Vogon poet
M
Joined: Dec 2002
Posts: 164
Extensible Markup Language (XML) - read about it http://www.w3.org/XML/


DALnet: #HelpDesk, #mIRC, #MISHScript - Undernet: #mIRC, #mIRC-Scripts
#1389 15/12/02 01:55 AM
Joined: Dec 2002
Posts: 87
V
vcv Offline
Babel fish
Offline
Babel fish
V
Joined: Dec 2002
Posts: 87
No, Necroman. It is/will be written from scratch, as is most of my stuff.

#1390 16/12/02 08:28 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Reinventing the wheel isn't always a good thing...

#1391 16/12/02 11:26 PM
Joined: Dec 2002
Posts: 87
V
vcv Offline
Babel fish
Offline
Babel fish
V
Joined: Dec 2002
Posts: 87
Of course not.. but I'd rather have my XML parser be stand-alone and not depend on MS's xml thing.

Take my xmenu dll for example.. I didn't need to do it..there is alternatives...menus already exist... but well, my menus are faster than the office xp/vs.net menus and look/behave the same.

#1392 19/12/02 04:04 AM
Joined: Dec 2002
Posts: 35
T
Ameglian cow
Offline
Ameglian cow
T
Joined: Dec 2002
Posts: 35
E-mail me your XML library, or a link to a website about it smile
(unless it commercial/proprietary, of couse)


Link Copied to Clipboard