Re: [PHP] Parsing XML with DTD

2007-11-22 Thread Skip Evans

Hey Jochem  all,

Thanks much for this tip. I will check it out.

A little further reading looks like PEAR provides 
some XML and DTD capabilities? Anyone have any 
experience with this?


Also, the reason I asked about the DTD is that 
these XML files are really extensive, providing 
lots of varied info about literature, history, a 
whole ton of topics, so I thought parsing the DTD 
will be necessary to know what kinds of data I'm 
really looking at.


I'll check out Jochem's suggestion now, but would 
also like to hear if anyone has used PEAR, and 
also about the need for the DTD for big, 
complicated XML files.


Would it be helpful if I pasted one of the XML 
files to the list?


Thanks again!
Skip


Jochem Maas wrote:

Skip Evans wrote:

Hey all,

I've been asked if it's possible to parse XML files given a DTD file
that describes the elements within it, so I've been looking through the
docs at php.net.

So far I've found this:

http://us.php.net/manual/en/ref.xml.php

Which has some samples on, but nothing that I see will take a DTD file
and parse the XML accordingly.


use php5 and the DOM extension (not XML and not DOMXML):

http://us.php.net/manual/en/ref.dom.php


I'm thinking something like this is probably possible.

I'm still looking through the docs, but if anyone can point me in the
right direction would be appreciated.

Thanks!
Skip






--
Skip Evans
Big Sky Penguin, LLC
503 S Baldwin St, #1
Madison, WI 53703
608-250-2720
http://bigskypenguin.com
=-=-=-=-=-=-=-=-=-=
Check out PHPenguin, a lightweight and versatile
PHP/MySQL, AJAX  DHTML development framework.
http://phpenguin.bigskypenguin.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Parsing XML with DTD

2007-11-22 Thread Per Jessen
Skip Evans wrote:

 I've been asked if it's possible to parse XML files given a DTD file
 that describes the elements within it, 

Yes it is. 

 Which has some samples on, but nothing that I see
 will take a DTD file and parse the XML accordingly.
 I'm thinking something like this is probably possible.

You don't actually need to DTD to parse it, but it does help with the
syntax-check of the contents.


/Per Jessen, Zürich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Parsing XML with DTD

2007-11-22 Thread Jochem Maas
Skip Evans wrote:
 Hey all,
 
 I've been asked if it's possible to parse XML files given a DTD file
 that describes the elements within it, so I've been looking through the
 docs at php.net.
 
 So far I've found this:
 
 http://us.php.net/manual/en/ref.xml.php
 
 Which has some samples on, but nothing that I see will take a DTD file
 and parse the XML accordingly.

use php5 and the DOM extension (not XML and not DOMXML):

http://us.php.net/manual/en/ref.dom.php

 
 I'm thinking something like this is probably possible.
 
 I'm still looking through the docs, but if anyone can point me in the
 right direction would be appreciated.
 
 Thanks!
 Skip
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Parsing XML with DTD

2007-11-22 Thread Andrés Robinet
 -Original Message-
 From: Skip Evans [mailto:[EMAIL PROTECTED]
 Sent: Thursday, November 22, 2007 5:35 PM
 To: Jochem Maas
 Cc: PHP-General
 Subject: Re: [PHP] Parsing XML with DTD
 
 Hey Jochem  all,
 
 Thanks much for this tip. I will check it out.
 
 A little further reading looks like PEAR provides
 some XML and DTD capabilities? Anyone have any
 experience with this?
 
 Also, the reason I asked about the DTD is that
 these XML files are really extensive, providing
 lots of varied info about literature, history, a
 whole ton of topics, so I thought parsing the DTD
 will be necessary to know what kinds of data I'm
 really looking at.
 
 I'll check out Jochem's suggestion now, but would
 also like to hear if anyone has used PEAR, and
 also about the need for the DTD for big,
 complicated XML files.
 
 Would it be helpful if I pasted one of the XML
 files to the list?
 
 Thanks again!
 Skip
 
 
 Jochem Maas wrote:
  Skip Evans wrote:
  Hey all,
 
  I've been asked if it's possible to parse XML files given a DTD file
  that describes the elements within it, so I've been looking through
 the
  docs at php.net.
 
  So far I've found this:
 
  http://us.php.net/manual/en/ref.xml.php
 
  Which has some samples on, but nothing that I see will take a DTD
 file
  and parse the XML accordingly.
 
  use php5 and the DOM extension (not XML and not DOMXML):
 
  http://us.php.net/manual/en/ref.dom.php
 
  I'm thinking something like this is probably possible.
 
  I'm still looking through the docs, but if anyone can point me in
 the
  right direction would be appreciated.
 
  Thanks!
  Skip
 
 
 
 
 --
 Skip Evans
 Big Sky Penguin, LLC
 503 S Baldwin St, #1
 Madison, WI 53703
 608-250-2720
 http://bigskypenguin.com
 =-=-=-=-=-=-=-=-=-=
 Check out PHPenguin, a lightweight and versatile
 PHP/MySQL, AJAX  DHTML development framework.
 http://phpenguin.bigskypenguin.com/
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


I believe the DTD would only be helpful to you if you are validating the XML
stream yourself... If you only need to know what kind of data you are
looking at, you can just grab the doctype property for the DocumentElement
and compare it to a set of (known by you) predefined doctypes... After that,
you can implement a walk through the elements of the XML stream knowing what
you can expect about it. This will simplify your programming logic, unless
there are infinite doctypes for the data source in question.

For validation, you can use this
http://us.php.net/manual/en/function.dom-domdocument-validate.php (only if
you are interested in the document being well formed according to the DTD)

For identifying the DTD, check the DocumentElement doctype property and
the DOMDocumentType class http://us.php.net/manual/en/ref.dom.php.

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308
| TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE:
bestplace |  Web: bestplace.biz  | Web: seo-diy.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php