Feed: ezcFeedTools
[ ]
[ Specifications ]
[ ]
[ ]
[ ]
[ ]
Class: ezcFeedTools
|
Utility class providing useful functions to manipulate XML files. [
source]
Method Summary
|
public static string |
deNormalizeName(
$name, $mappingArray )
Returns the name on which $attributeName is mapped in the $mappingArray flipped array, or $attributeName if a mapping does not exist for $attributeName. |
|
public static mixed |
getAttribute(
$node, $name )
Returns the value of attribute $name of the XML node $node, or null if the attribute is not found. |
|
public static array(string=>mixed) |
getAttributes(
$node )
Returns an array containing the names and values of the attributes of the XML node $node. |
|
public static DOMNode |
getNodeByAttribute(
$parent, $nodeName, $attribute, $value )
Returns a DOMNode child of $parent with name $nodeName and which has an attribute $attribute with the value $value. Returns null if no such node is found. |
|
public static string |
normalizeName(
$name, $mappingArray )
Returns the name on which $name is mapped in the $mappingArray array, or $name if a mapping does not exist for it. |
|
public static DateTime |
prepareDate(
$date )
Returns the provided $date (timestamp, string or DateTime object) as a DateTime object. |
Methods
deNormalizeName
string deNormalizeName(
string
$name, array(string=>string)
$mappingArray )
Returns the name on which $attributeName is mapped in the $mappingArray flipped array, or $attributeName if a mapping does not exist for $attributeName.
Parameters
| Name |
Type |
Description |
$name |
string |
The element name to denormalize |
$mappingArray |
array(string=>string) |
A mapping of attribute names to normalized names |
getAttribute
mixed getAttribute(
$node, string
$name )
Returns the value of attribute $name of the XML node $node, or null if the attribute is not found.
Parameters
| Name |
Type |
Description |
$node |
DOMNode |
The XML node |
$name |
string |
The name of the attribute to return its value |
getAttributes
array(string=>mixed) getAttributes(
$node )
Returns an array containing the names and values of the attributes of the XML node $node.
Parameters
| Name |
Type |
Description |
$node |
DOMNode |
The XML node |
getNodeByAttribute
DOMNode getNodeByAttribute(
$parent, string
$nodeName, string
$attribute, mixed
$value )
Returns a DOMNode child of $parent with name $nodeName and which has an attribute $attribute with the value $value. Returns null if no such node is found.
Parameters
| Name |
Type |
Description |
$parent |
DOMNode |
The XML parent node |
$nodeName |
string |
The node name to find |
$attribute |
string |
The attribute of the node |
$value |
mixed |
The value of the attribute |
normalizeName
string normalizeName(
string
$name,
$mappingArray )
Returns the name on which $name is mapped in the $mappingArray array, or $name if a mapping does not exist for it.
Parameters
| Name |
Type |
Description |
$name |
string |
The element name to normalize |
$mappingArray |
array(string=>string) |
A mapping of attribute names to normalized names |
prepareDate
DateTime prepareDate(
mixed
$date )
Returns the provided $date (timestamp, string or DateTime object) as a DateTime object.
It preserves the timezone if $date contained timezone information.
Parameters
| Name |
Type |
Description |
$date |
mixed |
A date specified as a timestamp, string or DateTime object |
Last updated: Mon, 05 May 2008