|
Joined: Dec 2002
Posts: 1
Mostly harmless
|
OP
Mostly harmless
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 thanks -rock
"If you can't beat your computer at chess, try kickboxing." -Anon.
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
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.
|
|
|
|
Joined: Dec 2002
Posts: 66
Babel fish
|
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
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
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: <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.
|
|
|
|
Joined: Dec 2002
Posts: 66
Babel fish
|
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.
|
|
|
|
Joined: Dec 2002
Posts: 87
Babel fish
|
Babel fish
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..
var %child_count = $xml_child_count(/library)
var %i = 1
while (%i <= %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.
|
|
|
|
Joined: Dec 2002
Posts: 89
Babel fish
|
Babel fish
Joined: Dec 2002
Posts: 89 |
I guess you use the XML parser by Microsoft?
Sincerely, Necroman, #mIRC @ Undernet
|
|
|
|
Joined: Dec 2002
Posts: 339
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 339 |
Just by curiosity XML stands for?
|
|
|
|
Joined: Dec 2002
Posts: 164
Vogon poet
|
Vogon poet
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
|
|
|
|
Joined: Dec 2002
Posts: 87
Babel fish
|
Babel fish
Joined: Dec 2002
Posts: 87 |
No, Necroman. It is/will be written from scratch, as is most of my stuff.
|
|
|
|
Joined: Dec 2002
Posts: 2,809
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,809 |
Reinventing the wheel isn't always a good thing...
|
|
|
|
Joined: Dec 2002
Posts: 87
Babel fish
|
Babel fish
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.
|
|
|
|
Joined: Dec 2002
Posts: 35
Ameglian cow
|
Ameglian cow
Joined: Dec 2002
Posts: 35 |
E-mail me your XML library, or a link to a website about it (unless it commercial/proprietary, of couse)
|
|
|
|
|