----- Original Message ----- From: "Aravind Subramanian" <[EMAIL PROTECTED]> > Hi, > > an application i am building can support tab-delimited text and xml > formats. But, i need to detect which format a particular file is in > (without relying on a file extension). > > Is there a way to use the dom4j libraries to quickly test if a > given file is xml formatted or not?
Its non-trivial. Using a MIME type or extension is probably easiest. I guess you could assume that an XML document should have an XML declaration in the first line. So the first non whitespace should be <?xml Though the declaration can be ommitted. Maybe just testing that the first non-white character is "<" then trying to parse it? James _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user
