HTML and CSS Reference
In-Depth Information
Validating markup is more complicated for developers of dynamic web sites since markup validators generally
cannot deal with server-side scripts such as PHP. Checking the dynamically generated (X)HTML output, performing
corrections, and revalidating documents are all real challenges. This is one of the major reasons why dynamically
generated web pages are often invalid.
Validating XML
XML documents can be validated for conformance with a DTD, an XML schema, or the RELAX NG schema language.
Syntactic well-formedness is a basic requirement, but it does not guarantee XML validity, which has several
constraints, such as proper use of required and optional elements and attributes, correct document structure and
syntax, and properly applied data types.
Although XML validation and parsing are logically independent tasks, both are often performed by XML parsers.
Considering that even a single error can prevent the document from being parsed or its tree structure shown, XML
parsers of web browsers can always be used as basic XML validators.
XML validity is not required by all XML parsers but by the XML parsers that check the document against its
associated schema.
Batch validation of XML files can be performed by the xmlvalidate task of Apache Ant [7]. For example, the
target in Listing 14-1 validates the .xml files in the directory specified by the dir attribute. 4
Listing 14-1. Validating XML with xmlvalidate
<target name="validate-xml">
<xmlvalidate lenient="no">
<fileset dir="semweb/ont" includes="*.xml" />
<attribute name=" " value="true"/>
<attribute name=" " value="true"/>
<attribute name=" " value="true"/>
Validating RDF/XML
RDF documents written in the XML serialization format (RDF/XML) can be checked with the W3C RDF Validation
Service at [8]. Validations can be performed by URI or direct input. The Validator not only
checks the RDF code but also represents RDF triples (Figure 14-4 ).
4 Relative to the Ant build file.
Search WWH ::

Custom Search