Skip to content

Instantly share code, notes, and snippets.

View sirolad's full-sized avatar
🏠
Working from home

Surajudeen Akande sirolad

🏠
Working from home
View GitHub Profile
@sirolad
sirolad / DomValidator.php
Last active March 22, 2017 22:29
A class to validate xml using DomDocument
<?php
class DOMValidator
{
/**
* @var string
*/
protected $feedSchema = __DIR__ . '/sample.xsd';
/**
@sirolad
sirolad / sample.xsd
Created March 22, 2017 20:20
Sample Russian Doll XSD design
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="catalog">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:dateTime" name="buildtime"/>
<xs:element name="book" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="author"/>
<xs:element type="xs:string" name="title"/>
@sirolad
sirolad / sample.xml
Created March 22, 2017 20:14
Sample Well-formed Xml file
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<buildtime>2002-05-30T09:30:10.5</buildtime>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications