You are here

function xmlentities in Taxonomy import/export via XML 7

Same name and namespace in other branches
  1. 6.2 taxonomy_xml.module \xmlentities()
  2. 6 taxonomy_xml.module \xmlentities()

Safer entity encoding.

htmlentities doesn't actually encode strings to anything XML-safe. This is a slightly laborious emulation that does decimal entities not fancy character ones. Taken from http://nz.php.net/manual/en/function.htmlentities.php

As such, it's screwing things up for non-English taxonomies.

5 calls to xmlentities()
taxonomy_xml_add_terms_as_tcs in formats/tcs_format.inc
Given a list of terms, append definitions of them to the passed DOM container
taxonomy_xml_rdfs_add_terms in ./rdfs_format.inc
Given a list of terms, append definitions of them to the passed DOM container
taxonomy_xml_rdfs_add_vocab in ./rdfs_format.inc
Create a vocabulary definition (just the def, not its terms) and insert it into the given document element.
taxonomy_xml_rdf_add_vocab in formats/rdf_format.inc
Create a vocabulary definition (just the def, not its terms) and insert it into the given document element.
taxonomy_xml_rdf_document in ./rdf_utils.inc
Set up an RDF document preamble.

File

./taxonomy_xml.module, line 1010
Make it possible to import and export taxonomies as XML documents.

Code

function xmlentities($str) {

  #return $str;

  # @todo still has a problem with &?
  return preg_replace('/[^\\x00-\\x25\\x27-\\x7F]/e', '"&#".ord("$0").";"', $str);

  #return preg_replace('/[^\x00-\x7F]/e', '"@#".ord("$0").";"', $str);
}