[ create a new paste ] login | about

Link: http://codepad.org/RvAn76oj    [ raw code | output | fork ]

PHP, pasted on Jun 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

$xml = <<< XML
<Item>
    <Image
        source="http://upload.wikimedia.org/Vinberg.svg.png"
	width="50"
	height="41"/>
</Item>
XML;

$item = new SimpleXMLElement($xml);
echo $item->Image['source'];

foreach ($item->Image->attributes() as $attributeName => $attributeValue) {
    printf("\n%s => %s", $attributeName, $attributeValue);
}


Output:
1
2
3
4
http://upload.wikimedia.org/Vinberg.svg.png
source => http://upload.wikimedia.org/Vinberg.svg.png
width => 50
height => 41


Create a new paste based on this one


Comments: