WordPress at a glance
function is not described

WP_oEmbed::_parse_xml_body() private WP 3.6.0

Serves as a helper function for parsing an XML response body.

{} It's a method of the class: WP_oEmbed{}

No Hooks.

Return

stdClass/false.

Usage

// private - for code of main (parent) class only
$result = $this->_parse_xml_body( $response_body );
$response_body(string) (required)

Changelog

Since 3.6.0 Introduced.

Code of WP_oEmbed::_parse_xml_body() WP 5.5.1

<?php
private function _parse_xml_body( $response_body ) {
	if ( ! function_exists( 'simplexml_import_dom' ) || ! class_exists( 'DOMDocument', false ) ) {
		return false;
	}

	$dom     = new DOMDocument;
	$success = $dom->loadXML( $response_body );
	if ( ! $success ) {
		return false;
	}

	if ( isset( $dom->doctype ) ) {
		return false;
	}

	foreach ( $dom->childNodes as $child ) {
		if ( XML_DOCUMENT_TYPE_NODE === $child->nodeType ) {
			return false;
		}
	}

	$xml = simplexml_import_dom( $dom );
	if ( ! $xml ) {
		return false;
	}

	$return = new stdClass;
	foreach ( $xml as $key => $value ) {
		$return->$key = (string) $value;
	}

	return $return;
}