RE: [PHP] Validating XML Issue
| From: | Alice Wei | Date: | Thu, 03 Sep 2009 16:52:11 +0000 |
| Subject: | RE: [PHP] Validating XML Issue | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297640@lists.php.net to get a copy of this message | ||
Hi,
Thanks for trying to help me out. I don't have a schema for my XML, but here is something
cool I found that worked for me: http://www.w3schools.com/PHP/func_xml_error_string.asp
Alice
> Date: Thu, 3 Sep 2009 07:42:00 -0700
> From: mattias@thorslund.us
> To: ajwei@alumni.iu.edu
> CC: php-general@lists.php.net
> Subject: Re: [PHP] Validating XML Issue
>
> I'd say your XML document is not "well formed", but validity depends on
> whether it conforms to the rules expressed in a schema.
>
> Mattias
>
> Alice Wei wrote:
> > Hi,
> >
> > This seems like a small problem that I have read from
> > http://us.php.net/manual/en/xmlreader.isvalid.php.
> > I have the code snippet here as follows:
> >
> > <?php
> > $xml = XMLReader::open('hello.xml');
> >
> > // You must to use it
> > $xml->setParserProperty(XMLReader::VALIDATE, true);
> >
> > if ($xml->isValid()) echo "true";
> > else echo "NOT";
> >
> > ?>
> >
> > Here is the contents of hello.xml:
> >
> > <greeting><hello>Hello</hello>
> >
> > Obviously, this is not a well formed XML file.
> >
> > However, whenever I run the PHP code, it returns true, how do I get it to validate it the
> > way it is supposed to be?
> >
> > Thanks for your help.
> >
> > Alice
> >
> >
> >
> >
> > _________________________________________________________________
> > Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar
> > Today!
> > http://get.live.com/toolbar/overview
> >
>
>
_________________________________________________________________
All-in-one security and maintenance for your PC. Get a free 90-day trial!
http://www.windowsonecare.com/purchase/trial.aspx?sc_cid=wl_wlmail