valid xml file (document)

well formed xml documents. - a 'well formed' xml document has correct xml syntax.

the basic rules for creating well-formed xml.

  • your xml file must have a root element.
  • xml elements must have a closing tag.
  • all opening and closing tags must match.
  • you must enclose all attribute values in single or double quotation marks.
  • all tags must be nested correctly.
  • all entities must be declared.

look a well-formed xml document - valid xml file

                    <?xml version="1.0" encoding="utf-8" ? >
                       <title>java book </title>
                       <author>nick bore </author>
                       <pages> 1020 </pages>
                       <example>xml - valid xml file</example>

xml dtd(document type definition)

the purpose of a dtd is to define the structure of an xml document.if you want to study dtd, you go our dtd tutorial on our homepage.look a demo for dtd (how it define). define dtd to create valid xml file

           <!doctype book           
               <!element   book     (title,author,pages,example)>
               <!element   title    (#pcdata) >
               <!element   author   (#pcdata) >
               <!element   pages    (#pcdata) >
               <!element   example  (#pcdata) > ]>

valid xml documents

the doctype declaration in the example,is a reference to an external dtd file.

                    <?xml version="1.0" encoding="utf-8" ? >
                       <!doctype book system "book.dtd" >
                       <title>php book </title>
                       <author>xml  bore </author>
                       <pages> 1021 </pages>
                       <example> valid xml file </example>

xml schema

a schema: the second basic component in any xml's just a set of rules that say what can, and what can't, be in the various parts of an xml data file.

you use a schema to validate your data.if you want to study xml schema, you go our schema tutorial on our homepage.

            <xs:element   name='book' >
                        <xs:element      name ="title"          type="xs:string" />
                        <xs:element      name ="author"       type="xs:string" />
                        <xs:element      name ="pages"        type="xs:string" />
                        <xs:element      name ="examples"    type="xs:string" />