might be obvious, but not to everyone ;-) ... when reading attributes from a node that has sub-nodes (and creating an output from this node), the output will be issued twice, once on the <ELEMENT> tag and once on the end tag </ELEMENT>. To avoid this, you can test on which part of the node you are using the property nodeType.
It'll be 1 for the element, 15 for the end element.
XMLReader::getAttribute
(PHP 5 >= 5.1.2)
XMLReader::getAttribute — دریافت مقدار ویژگی نامدار
Description
string
XMLReader::getAttribute
( string $name
)
بازگرداندن مقدار ویژگی نامدار یا رشته در صورتی که ویژگی وجود نداشته باشد یا در جز قرار نداشته باشد.
Parameters
- name
-
The name of the attribute.
Return Values
مقدار ویژگی یا رشته خالی در صورت نبود name ویژگی یا قرار نداشتن در جز.
See Also
- XMLReader::getAttributeNo() - دریافت مقدار ویژگی به وسیله index
- XMLReader::getAttributeNs() - دریافت مقدار ویژگی با استفاده از localname و URI
Gabi ¶
5 years ago
