By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,776 Members | 1,397 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,776 IT Pros & Developers. It's quick & easy.

Parsing XML?

P: n/a
Hi,

I have a slight problem with parsing XML:

If the tag was say - <Something ID="12"> - My parser is only retrieving
the 'Something' part, and discarding the 'ID="12"'.

Code:

function startElement($xml_parser, $name, $attrs) {
echo $name; //this is the part with the issue
}

function endElementStuff($xml_parser, $name) {
}

function charData($xml_parser, $data) {
echo $data;
}

$xml_parser = xml_parser_create();
$ml_set_element_handler($xml_parser, "startElement", "endElementStuff");
xml_set_character_data_handler($xml_parser, "charData");
xml_parse($xml_parser, $result, TRUE);
xml_parser_free($xml_parser);

Any ideas?

TIA.
--
Nick Webster
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <MP***********************@news.gradwell.net>,
ne**@not.for.mail.invalid says...

Never mind, that would be in $attrs :)

Regards.
--
Nick Webster
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.