-
Hi, <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>OnDemand</key>
<true/>
</dict>
</plist> This is my code: $arrayToXml = new ArrayToXml(
[
'dict' => ['key' => 'OnDemand', 'true' => []]
],
[
'rootElementName' => 'plist',
'_attributes' => [
'version' => '1.0'
]
],
true,
'UTF-8'
);
$arrayToXml->addProcessingInstruction('DOCTYPE', 'plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"');
$result = $arrayToXml->toXml(); But the $result is <?xml version="1.0" encoding="UTF-8"?>
<?DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>OnDemand</key>
<true/>
</dict>
</plist> How to replace |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
I found an array to plist tool and solve the problem. |
Beta Was this translation helpful? Give feedback.
-
Does anyone know how to solve this within this package, without using the "array to plist tool"? |
Beta Was this translation helpful? Give feedback.
-
Anyone able to solve this within this package, without using the "array to plist tool"? |
Beta Was this translation helpful? Give feedback.
-
Thanks!!!
D
From: James Fenwick ***@***.***>
Date: Thursday, September 21, 2023 at 11:05 AM
To: spatie/array-to-xml ***@***.***>
Cc: Dion Wickander ***@***.***>, Comment ***@***.***>
Subject: Re: [spatie/array-to-xml] How to add <!DOCTYPE> tag? (Discussion #212)
You can access the DOMDocument via ArrayToXml::toDom() then add a DOMDocumentType child.
$arrayToXml = new ArrayToXml(/* ... */);
$dom = $arrayToXml->toDom();
$docType = (new DOMImplementation())->createDocumentType(
'plist',
'-//Apple Computer//DTD PLIST 1.0//EN',
'http://www.apple.com/DTDs/PropertyList-1.0.dtd'
);
$dom->insertBefore($docType, $dom->documentElement);
$result = $arrayToXml->toXml();
—
Reply to this email directly, view it on GitHub<#212 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AQGIMGYVJTRXLNNJWTSNHSDX3RQSXANCNFSM6AAAAAAVNB6CEU>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
I found an array to plist tool and solve the problem.