Re: PHP Bug/Error with XML Parsing Syntax??

From: Date: Mon, 13 Jun 2005 21:14:19 +0000
Subject: Re: PHP Bug/Error with XML Parsing Syntax??
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-216914@lists.php.net to get a copy of this message
On Mon, June 13, 2005 10:21 am, Scott Fletcher said: > I'm not sure what's wrong with PHP.. I ran the XML file through the > Mozilla > and it validate just fine. I get XML parse error but it gave no reason > for > the errors. > > The source code here is > [code] > $data = "<Message>Were changing</Message>"; > > $xml_parser = xml_parser_create('ISO-8859-1'); > xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 1); > xml_parse_into_struct($xml_parser, trim($data), $vals, $index); > > if (xml_error_string($xml_parser)) { > echo "<br>"; > echo "XML error in given source on <br>"; > echo "Line: ".xml_get_current_line_number($xml_parser)."<br>"; > echo "Column: ".xml_get_current_column_number($xml_parser)."<br>"; > echo "Reason: > ".xml_error_string(xml_get_error_code($xml_parser))."<br>"; > echo "<br>"; > echo "XML Data: ".$data; > echo "<br>"; > } > > xml_parser_free($xml_parser); > [/code] > > The Error output is ... > > [code] > XML error in given source on > Line: 1 > Column: 32 > Reason: <Message>Were changing</Message> > [/code] > > Anyone know?? I'm using PHP version 4.3.2 .... Thanks.... Wild Guess! Column 32 is the end of your data. Perhaps it wants a newline??? Or, perhaps, you need something like a doctype at the beginning? -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#216914) next »