in reply to Quick check for XML DTD or Schema
Well, my gut reaction would be to open the file and read in the first few lines and see if any of them match a regex. But that assumes that what you are looking for would always be near the start of the file.
On a more general note, anytime I hear a question that begins with "Is it possible to do ..." my immediate response is always "Yes! Just give me enough time and money." If I can't do it myself, I can hire the people who can. Do you want faster than light travel? Do you want anti-gravity? Just give me enough time and money.
Update: Here is a very crude approach that might work. (Please note that this is basic logic, NOT working code!)
open file for reading; $found_dtd = 0; while not end of file { next unless string has pattern known to be after DTD or schema if line matches DTD or schema regex { $found_dtd = 1; last; } } return $found_dtd;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Quick check for XML DTD or Schema
by ron800 (Novice) on Nov 06, 2014 at 12:10 UTC | |
by boftx (Deacon) on Nov 06, 2014 at 16:58 UTC |