Pages

Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Tuesday, 29 October 2013

Difference between DTD and SCHEMA

DTD :
  • DTD support only two data type called PCDATA and CDATA.
  • DTD does not alow to describe custom datatype.
  • DTD does not support XML namingspace.
  • DTD document may not be an XML document.
  • DTD's may be internal or external.
  • You can include one DTD in xml document.
SCHEMA :
  • SCHEMA support built in data type as int, long, float, doubble, String, Date etc.
  • SCHEMA allow you to describe custom datatype.
  • SCHEMA must support XML namingspace.
  • SCHEMA document must be an XML document.
  • SCHEMA must be external always.
  • You can include multiple XSD's in xml document.

Difference between SAX parser and DOM parser ?

SAX Parser :
  • Sax is read only parser.
  • Sax follows event driven model.
  • Using Sax you can read the data sequentially.
  • Sax occupies very less memory because only one element information will be stored in the memory at a time.
DOM Parser :
  • Dom is read write parser.
  • Dom follows tree model.
  • Using Dom you can read the data randomly.
  • Dom occupies more memory because entire object graph and memory will be loaded in main memory at a time.