Re: [xml] Parsing Invalid XML Document



On Wed, Jul 20, 2005 at 01:31:10PM -0000, SATISH  KUMAR wrote:
  
HI,

I am using xmlParseFile() function for parsing an XML Document, i am giving a wellformed and Invalid XML 
Document(which is not compliant to a given DTD) as an input.
     
xmlParseFile() function is returning xmlDocPtr even though the XML Document is not valid.

  Because the document is well-formed. So the data can be interpreted by the
user application. Validation is an optional feature, you need to turn it
on at the parser level, it will still give back a document, but you will
get validation errors. This behaviour is directly derived from the W3C 
Recommendation defining XML, see well-formedness , fatal error, and
validity constraints definitions in the spec.

I need clarification why xmlParseFile() function returns xmlDocPtr even when the XML Document is not Valid, 
any reason why this is made like this.

  Answer: read the spec !
    http://www.w3.org/TR/REC-xml/

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]