class Xml2Csv
Located in /XmlToCsv.class.php (line 51)
the character to use as CSV delimiter. Only 1 character.
the character to use to enclose items in the CSV . Only 1 character.
the filename used for the newly created CSV, if $output is set to 'file'
set if the CSV header line should appear in the output
indicate FROM which entry to begin to export the data. This can be used if you want to export only some items from the XML, not all of them.
Defaults to. If used together with $importTo, you can set an interval for selecting specific items from the XML
indicate TO which entry to export the data. This can be used if you want to export only some items from the XML, not all of them Defaults to 999999999. If used together with $importFrom, you can set an interval for selecting specific items from the XML
XPath expression to determine the Item nodes (=CSV rows) for the export Defaults to the 2nd child node in the XML
This key=>value paired array can be used to map XML nodes to CSV fields. By default all exported XML nodes are mapped to CSV fields with the same name.
Example:
This XML would mapped to the CSV like this:
node1,node2 Text1,Text2
If you wand to map the nodes to different fields, you have to pass a mapping to $map:
This would then result in the follwing CSV export:
csv1,csv2 Text1,Text2
output type:
set if only the selected fields (defined in $map) should appear in the output. If FALSE - all fields will be put out
the URL to the XML file (local or remote). If $xml is filled, then $url is ignored
the XML string, can be used to directly input the XML. If this is filled, the $url param is ignored
automaticaly convert XML from the specified URL and return as CSV string
automaticaly convert XML from the specified XML string and return as CSV string
The class constructor.
This is the function which does the whole magic conversion.
Basically all that is needed is the XML source. With no other parameters, it automatically converts the XML to CSV. All previously set up paramtere are used to extend the default functionality.
convert XML to CSV with a mapping setup - only the mapped fields will be exported.
If $mapping is empty, the previously set parameters and mapping is used. If no mapping was set, the function returns the result as $this->autoConvert()
method used to set more paramters at once
Documentation generated on Fri, 15 Mar 2013 00:30:47 +0100 by phpDocumentor 1.4.2