Re: Problems validating XML

Hello Martin,

On May 30, 2007, at 05:22 , Martin Duerst wrote:
> I can definitely submit a patch that goes into XML mode if an
> XML declaration is present.

Are you (still) working on this? If not, I am thinking of going ahead  
with an implementation based on the following regexp, using a test  
for it in the first line of the content:

/^<\?xml[\x20|\x9|\xD|\xA]+(version=("1.0"|"1.1"|'1.0'|'1.1')[\x20| 
\x9|\xD|\xA]+)?(encoding=("[A-Za-z][a-zA-Z0-9-_]+"|'[A-Za-z][a-zA- 
Z0-9-_]+')\x20|\x9|\xD|\xA]+)?(standalone=("yes"|"no"|'yes'|'no') 
[\x20|\x9|\xD|\xA]+)?[\x20|\x9|\xD|\xA]*\?>[\x20|\x9|\xD|\xA]*$/

It should match XML declarations as defined by XML 1.0 and 1.1 specs,  
and not be too greedy.

-- 
olivier

Received on Tuesday, 19 June 2007 17:24:11 UTC