214 CHAPTER 6 DOCUMENT OBJECT MODEL (DOM)
214 CHAPTER 6 DOCUMENT OBJECT MODEL (DOM) added or removed. For now, I will let you think about this and possibly come up with the answer. Have no worries if you are unsure of why the code was written in this manner, because I answer this question in depth in the section Common Questions, Misconceptions, and Problems. Performing Validation Chapter 3 covered three methods of validating XML documents. You can use each of these methods with the DOM extension to perform validation. As shown in the previous chapter, you can invoke and perform validation using DTDs during parsing by using the LIBXML_DTDVALID constant with either of the load options. It is not always the case that a document would need to be validated at the time of being parsed, and the bigger issue is that only DTDs can currently be used, leaving XML Schemas and RELAX NG unaccounted for. The DOMDocument class implements the accessor methods to perform validation after an XML document has been loaded. Validating with DTDs You must load DTDs prior to trying to validate against them within the DOM extension. Loading a document with the LIBXML_DTDLOADparser option will load an external DTD but not perform validation at parse time. With a DOMDocumentobject instantiated and containing a loaded DTD, validation is as simple as calling the validate()method. This method returns TRUE or FALSE, indicating the validity state of the document. Errors and warnings from libxml can be issued from this method call and should be handled appropriately, either by using a user error handler, allowing the printing of the errors; by using error suppression; or by using the new error handling available in PHP 5.1. $dom = DOMDocument::loadXML(’ ]>
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Clan Web Hosting services