design/validation.htm (132 lines of code) (raw):

<!-- $Id$ --> <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"> <link rel='stylesheet' type='text/css' href='css/site.css'> <link rel='stylesheet' type='text/css' href='css/diagram.css'> <style type='text/css'> .note { font-size: smaller } </style> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 9"> <meta name=Originator content="Microsoft Word 9"> <link rel=File-List href="./validation_files/filelist.xml"> <link rel=Edit-Time-Data href="./validation_files/editdata.mso"> <link rel=OLE-Object-Data href="./validation_files/oledata.mso"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--> <title>Validation</title> <!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>Jeffrey Rodriguez</o:Author> <o:Template>Normal</o:Template> <o:LastAuthor>Jeffrey Rodriguez</o:LastAuthor> <o:Revision>5</o:Revision> <o:TotalTime>421</o:TotalTime> <o:LastPrinted>2000-10-06T22:51:00Z</o:LastPrinted> <o:Created>2000-10-07T00:13:00Z</o:Created> <o:LastSaved>2000-10-07T02:27:00Z</o:LastSaved> <o:Pages>2</o:Pages> <o:Words>553</o:Words> <o:Characters>3155</o:Characters> <o:Company>IBM</o:Company> <o:Lines>26</o:Lines> <o:Paragraphs>6</o:Paragraphs> <o:CharactersWithSpaces>3874</o:CharactersWithSpaces> <o:Version>9.3821</o:Version> </o:DocumentProperties> </xml><![endif]--> <style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} h1 {mso-style-next:Normal; margin:0in; margin-bottom:.0001pt; line-height:200%; mso-pagination:widow-orphan; page-break-after:avoid; mso-outline-level:1; font-size:12.0pt; font-family:"Times New Roman"; mso-font-kerning:0pt; text-decoration:underline; text-underline:single;} h2 {mso-style-next:Normal; margin-top:0in; margin-right:0in; margin-bottom:0in; margin-left:.25in; margin-bottom:.0001pt; mso-pagination:widow-orphan; page-break-after:avoid; mso-outline-level:2; font-size:12.0pt; font-family:"Times New Roman"; font-weight:normal; text-decoration:underline; text-underline:single;} p.MsoCaption, li.MsoCaption, div.MsoCaption {mso-style-next:Normal; margin-top:6.0pt; margin-right:0in; margin-bottom:6.0pt; margin-left:0in; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; font-weight:bold;} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:919675701; mso-list-type:hybrid; mso-list-template-ids:-133154018 67698703 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> </style> <!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1027"/> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]--> </head> <body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'> <div class=Section1> <h1 style='line-height:normal'><span style='font-size:18.0pt;mso-bidi-font-size: 12.0pt'>Validation<o:p></o:p></span></h1> <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p> <p class=MsoNormal>The <i>Validator </i>is a component in this architecture since it implements the <i>Component</i> interface and any class that implements the Component Manager interface can manage it. E.g. a parser would configure the <i>components</i> that it needs through this interface by adhering to the guideline spelled out in the <a href="architecture.html#Configuration.SettingsManagement">Setting Management</a> section of this architecture overview.</p> <p class=MsoNormal>The <i>Component Manager</i> is in charge of setting up the following internal <i>Validator</i> fields: <i>SymbolTable, GrammarPool and ErrorFormatter.</i></p> <p class=MsoNormal>The Validator is universal since it is both a filter and a source of document events regardless of the other components connected to in the pipeline architecture. See figure 1. </p> <p class=MsoNormal align=center style='text-align:center'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p> <p class=MsoCaption align=center style='text-align:center'><img border=0 width=381 height=150 id="_x0000_i1025" src="images\pipeline.gif"></p> <p class=MsoCaption align=center style='text-align:center'>Figure <span style='mso-field-code:"SEQ Figure \\* ARABIC"'>1</span>- Pipeline Architecture - Sources &amp; Filters</p> <p class=MsoNormal><span style="mso-spacerun: yes">�</span></p> <p class=MsoNormal>The following is an outline of the validation process used by the Validator:</p> <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p> <ol style='margin-top:0in' start=1 type=1> <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list .5in'>The Validator uses the <i>Grammar pool</i> set by the Component Manager to acquire Grammars. See <a href="#_Grammar_pool_and">Grammar pool and Grammars</a> for more details</li> <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list .5in'>The Validator uses Grammar�s getter methods to gain access to Element, Attribute, Notation, and Entity declarations.</li> <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list .5in'>When a document event (through the Document Handler of the Validator) is received the respective declaration is obtained from the Grammar. </li> <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list .5in'>These declarations are used to validate content and content model. See <a href="#_Data_type_and">Data type and Content model validators</a>.</li> <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list .5in'>If no validation errors are caught or returned. Then we generate a document event using the registered Document handler of the next component in the pipeline.</li> <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list .5in'>If a validation error is caught or returned then the error information is formatted using the Error Formatter which in turn may call the Error Handler.</li> <li class=MsoNormal style='mso-list:l0 level1 lfo3;tab-stops:list .5in'>The Validator component reset method allows setting a new component manager.</li> </ol> <h2><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></h2> <h1 style='line-height:normal'><a name="_Data_type_and"></a><span style='font-size:18.0pt;mso-bidi-font-size:12.0pt'>Data type and Content model validators</span><span style='font-size:18.0pt;mso-bidi-font-size:12.0pt; font-weight:normal'><o:p></o:p></span></h1> <h2><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></h2> <h2>Datatype validators</h2> <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p> <p class=MsoNormal>Datatype Validators are based on the XML Schema Datatype draft. They are used by the Validator to validate attribute content in the case of a DTD or XML Schema grammars and to validate element content in the case of XML Schema grammars. Datatype validators implement the DatatypeValidator interface.<span style="mso-spacerun: yes">� </span></p> <p class=MsoNormal>The Validator uses a factory method than implements the DatatypeValidatorFactory to get datatypes instances.</p> <p class=MsoNormal>Datatype validator�s references are attached to the Element and Attribute declaration in the internal implementation of Grammars. See <a href="#_Grammar_pool_and">Grammar pools and Grammars</a> </p> <p class=MsoNormal><u><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></u></p> <h2>Content model validators</h2> <p class=MsoNormal><u><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></u></p> <p class=MsoNormal>Content model validators are used to check elements against the content model defined in an Element Declaration for those elements. Content model validators implement the ContentModelValidator interface.</p> <h1 style='line-height:normal'><a name="_Grammar_pool_and"></a><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></h1> <h1 style='line-height:normal'><span style='font-size:18.0pt;mso-bidi-font-size: 12.0pt'>Grammar pool and Grammars<o:p></o:p></span></h1> <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p> <p class=MsoNormal>A GrammarPool is a registry of Grammars. Grammars are keyed using a �grammar name� which could be a name space. Grammars are classes derived from the Grammar class. Grammars contain internal array structures, and public getter methods that can be used by the Validator to access grammar information. These getter methods provide access to different Declaration constructs. </p> <p class=MsoNormal>These Declaration constructs are: XMLElementDecl, XMLAttributeDecl, and XMLEntityDecl, and XMLNotationDecl. </p> <p class=MsoNormal>Other constructs available through the Grammars are: XMLSimpleType, ContentModelValidator, and DatatypeValidator.</p> <p class=MsoNormal>XMLSimpleType (Simple type) declarations are a special type of Element Declaration, which contains additional information beyond the one provided by XMLElementDecl such as data type validator references.<span style="mso-spacerun: yes">�� </span></p> <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p> <h1 style='line-height:normal'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></h1> <h1><span style='font-size:18.0pt;mso-bidi-font-size:12.0pt'>Internal Grammar Structures<o:p></o:p></span></h1> <p class=MsoNormal align=center style='text-align:center'> <img border=0 width=578 height=587 src="images\table.gif" > </p> <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p> <p class=MsoNormal><b><span style='color:silver'><a href="architecture.html">Bach to Architecture Overview</a></span></b></p> <p class=MsoNormal style='margin-left:.25in'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p> <p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p> </div> </body> </html>