I have written a script that parses an XML document and inserts the data into a Drupal website via Drupal's node_save function.
The problem is, every record that is created has an invisible character at the beginning of the title.
Here is the XML parsing script:
$xml=simplexml_load_file('list.xml') or die ('error: cannot find file.');
foreach ( $xml->output_catalog_shelflist as $entry )
{
if(!db_connect2()) {
echo "Cannot connect!";
}
$target_string1 = $entry->marc->marc_field[1];
$slashpos = strpos($target_string1, '/');
if ( $slashpos !== false )
{
$string1 = substr($target_string1, 0, $slashpos);
} else {
$string1 = $target_string1;
}
$title = str_replace(',', '', $string1);
// Author
$target_string2 = $entry->marc->marc_field[0];
$author = str_replace(',', '', $target_string2);
$author = str_replace('.', '', $author);
I'm having trouble figuring out how to troubleshoot this. Is there something above that is creating this character and/or how can I strip it out? thanks
spivey