woo-alipay/lib/alipay/aop/schema/ServiceSchemaWriter.php
2025-09-30 23:00:11 +08:00

36 lines
No EOL
1 KiB
PHP
Executable file

<?php
class ServiceSchemaWriter
{
/**
* @throws Exception
*/
public static function writeSchemaXmlString(array $attributesArr)
{
$dom = new DOMDocument('1.0', 'utf-8');
$root = $dom->createElement("serviceSchema");
foreach ($attributesArr as $attribute) {
if ($attribute instanceof XMLAttribute) {
$attribute->toValueElement($dom, $root);
}
}
$dom->appendChild($root);
return $dom->saveXML($dom->documentElement);
}
/**
* @throws Exception
*/
public static function writeFullchemaXmlString(array $attributesArr)
{
$dom = new DOMDocument('1.0', 'utf-8');
$root = $dom->createElement("serviceSchema");
foreach ($attributesArr as $attribute) {
if ($attribute instanceof XMLAttribute) {
$attribute->toElement($dom, $root);
}
}
$dom->appendChild($root);
return $dom->saveXML($dom->documentElement);
}
}