Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By satvision83 on
I have set the REST server with the Services module.
Also I've installed the Services Views module, created a new view that outputs the desired fields into XML.
That's working fine.
How can I add XML schema to that output, so the XML will look like:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
.....
EDIT:
In the Services module in rest_server/includes/ServicesFormatter.inc on line 44 I can see this:
class ServicesXMLFormatter implements ServicesFormatterInterface {
public function render($data) {
$doc = new DOMDocument('1.0', 'utf-8');
$root = $doc->createElement('result');
$doc->appendChild($root);
$this->xml_recursive($doc, $root, $data);
return $doc->saveXML();
}
So, I guess $root = $doc->createElement('result');
has to be changed.
I've already tried to change into $root = $doc->createElement('http://www.w3.org/2001/XMLSchema', 'xs:schema');
, but it displayis XML Parsing Error: no element found.