DAoC XML

S

syri

Guest
hands up who thought it was a whine about xml not being updated ;)

I'm wondering if anyone can tell me of a good place to find out how to show the xml data for a guild. Basically, i'd like to do a members section for the kotl website, based on the xml data from the servers, but i haven't a clue where to start.
Any hints/guides/tutorials would be greatly appreciated, thanks :)
 
B

Breni

Guest
You can download a PHP script here. That's what I've used on our guild site, as a sort of temporary measure until I can figure out how to display more of what I want :)

All you need is your Guild number and server from Goa's servers.xml file.
 
K

Kaomond

Guest
Where and what did you put into the php script to get it to work even that much? i'm a total noob at this hehe
 
B

Breni

Guest
Ah yes, that's a good one :)

Go to line 145 and replace it with this (should be the line beginning with

function parse() { :

function parse() {

$this->xml_parser = xml_parser_create();
@xml_set_object($this->xml_parser, $this);
// use case-folding so we are sure to find the tag in $map_array
xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, true);

xml_set_element_handler($this->xml_parser, "startElement", "endElement");
xml_set_character_data_handler($this->xml_parser, "characterData");
//xml_set_processing_instruction_handler($this->xml_parser, "PIHandler");

if (!($fp = fopen($this->xml_file, "r"))) {
die("could not open XML input");
}
while ($data = fread($fp, 4096)) {
if (!xml_parse($this->xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($this->xml_parser)),
xml_get_current_line_number($this->xml_parser)));
}
}
}
 
S

syri

Guest
got it working now.
Kaomond: i downloaded it from the site Breni linked to, and just changed the xml file that it gets it's data from

now i just need to make it fit in with the rest of the site :)

how hard would it be to have a seperate database listing players mains and alts, so that the xml page will group everyone's alts under their main?
 
S

syri

Guest
Originally posted by Breni
Ah yes, that's a good one :)

Go to line 145 and replace it with this (should be the line beginning with

function parse() { :

function parse() {

$this->xml_parser = xml_parser_create();
@xml_set_object($this->xml_parser, $this);
// use case-folding so we are sure to find the tag in $map_array
xml_parser_set_option($this->xml_parser, XML_OPTION_CASE_FOLDING, true);

xml_set_element_handler($this->xml_parser, "startElement", "endElement");
xml_set_character_data_handler($this->xml_parser, "characterData");
//xml_set_processing_instruction_handler($this->xml_parser, "PIHandler");

if (!($fp = fopen($this->xml_file, "r"))) {
die("could not open XML input");
}
while ($data = fread($fp, 4096)) {
if (!xml_parse($this->xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($this->xml_parser)),
xml_get_current_line_number($this->xml_parser)));
}
}
}
i changed
Code:
xml_set_object($this->xml_parser, &$this);
to this
Code:
xml_set_object($this->xml_parser, $this);
and it worked
 
B

Breni

Guest
Now you're asking :)

To be honest, you could probably use the XML output to populate a MySQL or PostgreSQL database, but it's beyond me how to do that, to be honest.

Still, it's not a bad idea - anyone got a clue? :p
 
G

glenfiddich

Guest
heh thanks for using my scripts :)

you may indeed get a reference error on line 145 as you said, but the way i wrote the code i more standard that way. ;(

drop me a PM with your site URL so i can link to it from our script users' listing :)
 
G

glenfiddich

Guest
unless you want to see some trending (char. progress) then try and avoid inserting your XML parsing results into a database for one very good reason:

script execution time ! :D

Depending on your server performance and whether you have access to the PHP config file (php.ini), you will notice that the parsing process alone is a resource hog...

Add to that the number of INSERT queries (one per char.) that you would need to run and you have a good idea of how much stress you're putting on your host's server.

So unless you run your guild site on your own machine, i'd advise against it...
 
U

Urme the Legend

Guest
Main and alt chars:
http://www.urme.com/fellowship/members.php

Click on a member and get their alt chars etc ;) Working great.. but it's alot of work behind it.. all members have register their characters on the website. And then it's just pure programming to link it together :)
 
N

-Nxs-

Guest
Check out http://order.intrusion.org/

it has an excelent PostNuke module for the guild roster, much better layouts and sorting that the others posted so far, I guess with a little knowhow you can make it a standalone page. I tweeked the code to work with the EURO servers, but cant give out the URL for this as the new guild website where this is hosted is still being tested.
 
G

glenfiddich

Guest
both parsers are functional and useful, it's all a matter of how you integrate it into your site... and the PostNuke code is old (2002), in the way that it is no longer updated and no longer reflects the changes in the XML structure, not 100% anyway.

dont get me wrong, Nuke is a great out-of the box solution to build a community portal. I chose to build everything from scratch :)
 
G

Gizmoduck

Guest
I know all this is written in PHP, does anyone ever made something the same in ASP?

If so, could you PM me? or write a link to it here

Thanks.

Gizmo
 
G

glenfiddich

Guest
Gizmo,

someone posted on how to do this in ASP early this year, you may want to search the forums.

Otherwise, look up the XML page on the Herald at http://www.camelotherald.com/xml.php#NT

Note that if your ASP host offers ASP.NET, .NET has fairly extensive XML support and ready to use XML libraries/parsers.

But on the PHP side, look further down that page and you'll find me :) bwahahahaha
 
N

-Nxs-

Guest
Originally posted by glenfiddich
and the PostNuke code is old (2002), in the way that it is no longer updated and no longer reflects the changes in the XML structure, not 100% anyway.

You assume of corse that GOA keeps their XML up to date to, they are infact almost certainly still using the 2002 structure based on past history :)
 
G

glenfiddich

Guest
heh

well my parser is based on the US version, blame France Telecom if your Chronicles files are corrupted :)
 
J

Jessy

Guest
It seams we blame GOA for anything and everything :) so why not
 
X

Xmi

Guest
Originally posted by glenfiddich
heh thanks for using my scripts :)

you may indeed get a reference error on line 145 as you said, but the way i wrote the code i more standard that way. ;(

drop me a PM with your site URL so i can link to it from our script users' listing :)

We are using your PHP script glen, very useful thanks! We adopted it a little for our uses (i.e. changed the default order and applied a different font) but it has been a great learner script for our web admin (and my co-GM) Cerralin.

Also be nice to have an elegant way to list mains and alts - thanks for the URL Urme, we'll take a look at that site bit later...
 
G

glenfiddich

Guest
The main/alt listing is a great 'nice to have' feature, however the notion of 'main character' is not taken into account in the XML files and never will for two simple reasons :

account security and privacy laws

While you could put together some code to create a associative array of character IDs, Mythic would not let you do that as it would mean you would be able to track all characters (even if partially) for a given account on a given server. And that's a big privacy no-no.

So like Urme said, this is a voluntary process : players have to declare their mains/alts manually into a database or god know what else :(
 
X

Xmi

Guest
Well stated, especially your point re privacy.

At the moment we collect our data in game (by word of mouth), then we update our ALTS table manually, but this method is becoming more and more time consuming as we grow.

Urme's method of getting people to auto register their alts is looking more and more attractive.
 
T

Talifer

Guest
Originally posted by syri
got it working now.
Kaomond: i downloaded it from the site Breni linked to, and just changed the xml file that it gets it's data from

now i just need to make it fit in with the rest of the site :)

how hard would it be to have a seperate database listing players mains and alts, so that the xml page will group everyone's alts under their main?

I wrote a PHP parser from scratch and wanted the alt information aswell. I went for an embedded associative array of main => list of alts. Then as the parser picks up a character name it checks the array to see if it's a main or alt. This allows me not only to list mains and alts but to give player rp totals so you can see how many rps a person made last week and not just thier main chars, or guildies can see what RR they could be if they'd only played one char etc... ;)

Knights of Pendragon

It's still work in progress and there are hidden features that I won't go into (like hiding the alt listing to save space etc...)

Talifer

[edit: there: location, their: belongs to]
 
G

glenfiddich

Guest
err that info does not belong in the XML file, unless you make your own... if that's the case, could you share your file?
 
T

Talifer

Guest
It's just an embedded associative array

e.g.

$arrAlts["MainChar"] = array("AltOne", "AltTwo", "AltThree");

As I read each character in from the xml I do a quick check

isset($arrAlts[$strCharJustRead])

if this is true then this char is a main character, if not I can scan all mains and check if it is an alt (Not the most efficient solution I'll grant you, but it does the job and this is the first time I've looked at any PHP :))

Once you know the main and the alts it's easy to calculate total rps for a person (by adding it all up) and the rps this week.

The Duskwave stats are done in a similar way

$arrStats["CharName"] = 2378462;

It requires manually editing the file to add people's details, but it's not a huge leap to move this data to a seperate file and automate the process, I have no need at the moment.

I was just bored at work when I wrote the PHP ;)

Talifer
 
G

glenfiddich

Guest
Talifer,

I can guess how the sorting by main/alt is done :D

What i meant is: each player has to help you manually populate your array, because the Herald/Chronicles XML file does not provide that relationship information.
 
K

Kaomond

Guest
OK i think i have my guild php sorted now, only problem is the isp i use won't allow php, can anyone recomend a good free/very cheap host with php enabled? also the host needs to have browser upload as i have dificulty uploading ftp from my machine.
 
S

speshneeds

Guest
Originally posted by -Nxs-
Check out http://order.intrusion.org/

it has an excelent PostNuke module for the guild roster, much better layouts and sorting that the others posted so far, I guess with a little knowhow you can make it a standalone page. I tweeked the code to work with the EURO servers, but cant give out the URL for this as the new guild website where this is hosted is still being tested.

arf - gif phpnuke version :p
 

Users who are viewing this thread

Similar threads

C
Xml
Replies
3
Views
604
C
T
Replies
7
Views
554
Tumult
T
D
Replies
5
Views
562
Draupnir
D
N
Replies
3
Views
485
Brannor McThife
B
S
Replies
35
Views
2K
Rubric
R
Top Bottom