프로젝트
GitHub에서 보기
nullivex/lib-array2xml
소개
lalit.org에 감사를 전하는 Array2XML 변환 라이브러리입니다.
개발 도구측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originallib-array2xml
Array2XML conversion library credit to lalit.org
Usage
//create XML
$xml = Array2XML::createXML('root_node_name', $php_array);
echo $xml->saveXML();
//create Array
$array = XML2Array::createArray($xml);
print_r($array);
Array2XML
@xml example:
// Build the array that should be transformed into a XML object.
$array = [
'title' => 'A title',
'body' => [
'@xml' => '<html><body><p>The content for the news item</p></body></html>',
],
];
// Use the Array2XML object to transform it.
$xml = Array2XML::createXML('news', $array);
echo $xml->saveXML();
This will result in the following.
<?xml version="1.0" encoding="UTF-8"?>
<news>
<title>A title</title>
<body>
<html>
<body>
<p>The content for the news item</p>
</body>
</html>
</body>
</news>
Reference
More complete references can be found here http://www.lalit.org/lab/convert-xml-to-array-in-php-xml2array/ http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes/
Changelog
1.0.0
- Add ability for callbacks during processing to check status.
0.5.1
- Fix fata error when the array passed is empty fixed by pull request #6
0.5.0
- add second parameter to XML2Array::createArray for DOMDocument::load, e.g: LIBXML_NOCDATA
- change method visibility from private to protected for overloading
- Merge pull request #5 to add child xml
- Merge pull request #4 to change method visibility and add second parameter for load.
0.1.0
- Initial Release
관련 프로젝트 살펴보기
불러오는 중…