XML Format help

XML Format help

am 03.04.2008 02:59:32 von Damodhar

I want to determinate if a xml is well-format and valid before export
it to
database.

how can i find if the xml feed is well formated one??

Re: XML Format help

am 03.04.2008 12:42:19 von Dikkie Dik

Damodhar wrote:
> I want to determinate if a xml is well-format and valid before export
> it to
> database.
>
> how can i find if the xml feed is well formated one??
If you have the XML in a file, use an XML parser or editor with such a
parser. For instance, "XML Copy Editor" (see
http://xml-copy-editor.sourceforge.net/).

Best regards.

Re: XML Format help

am 03.04.2008 14:10:17 von Jeff North

On Wed, 2 Apr 2008 17:59:32 -0700 (PDT), in comp.lang.php Damodhar


wrote:

>| I want to determinate if a xml is well-format and valid before export
>| it to
>| database.
>|
>| how can i find if the xml feed is well formated one??

Open the xml file with your web browser (IE or Firefox).
-- ------------------------------------------------------------ -
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
-- ------------------------------------------------------------ -

Re: XML Format help

am 03.04.2008 14:14:48 von George Maicovschi

If it's an automatic task then just try this:

libxml_internal_errors(true);
$parsed_xml=simplexml_load_string($xml) //or
simplexml_load_file($path) if the xml is in a file
if ($parsed_xml)
//xml is valid, do your thing
else
//xml not valid