Skip to content

Commit 099aa31

Browse files
author
Sanders Kleinfeld
committed
Merge pull request #27 from oreillymedia/xmlschema
Bug fixes for MML and added support for SVG
2 parents 40528df + 7a4421f commit 099aa31

File tree

8 files changed

+3552
-8
lines changed

8 files changed

+3552
-8
lines changed

htmlbook.xsd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0"?>
2-
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" targetNamespace="http://www.w3.org/1999/xhtml" elementFormDefault="qualified" attributeFormDefault="unqualified">
2+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:svg="http://www.w3.org/2000/svg" targetNamespace="http://www.w3.org/1999/xhtml" elementFormDefault="qualified" attributeFormDefault="unqualified">
33

44
<xs:import namespace="http://www.w3.org/1998/Math/MathML" schemaLocation="mathml3/mathml3.xsd"/>
5+
<xs:import namespace="http://www.w3.org/2000/svg" schemaLocation="svg/SVG.xsd"/>
56

67
<xs:element name="html">
78
<xs:complexType>
@@ -1330,8 +1331,7 @@
13301331
<xs:element ref="ol"/>
13311332
<xs:element ref="p"/>
13321333
<xs:element ref="pre"/>
1333-
<!-- ToDo: Add separate schema for SVG ref here?
1334-
<xs:element ref="svg:svg"/> -->
1334+
<xs:element ref="svg:svg"/>
13351335
<xs:element ref="table"/>
13361336
<xs:element ref="ul"/>
13371337
<xs:element ref="video"/>

mathml3/README

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
W3C MathML XML Schema, via http://www.w3.org/Math/XMLSchema/
1+
W3C MathML XML Schema, via http://www.w3.org/Math/XMLSchema/
2+
3+
ORM Note: Some tiny tweaks made to annotation-xml content model (in mathml3-common.xsd) to ensure it was determinist;
4+
see https://github.com/oreillymedia/HTMLBook for file history

mathml3/mathml3-common.xsd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
</xs:element>
4242
<xs:complexType name="annotation-xml.model">
4343
<xs:choice minOccurs="0" maxOccurs="unbounded">
44-
<xs:group ref="m:MathExpression"/>
44+
<!-- ORM: removing ref="m:MathExpression", as it's redundant given the reference to m:anyElement, and violates determinist content model -->
4545
<xs:group ref="m:anyElement"/>
4646
</xs:choice>
4747
</xs:complexType>
4848
<xs:group name="anyElement">
4949
<xs:choice>
50-
<xs:any namespace="##other" processContents="skip"/>
51-
<xs:any namespace="##local" processContents="skip"/>
50+
<!-- ORM: switching namespace to "##any" to cover everything -->
51+
<xs:any namespace="##any" processContents="skip"/>
5252
</xs:choice>
5353
</xs:group>
5454
<xs:element name="annotation-xml">

samples/test_schema.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<?xml-model href="../htmlbook.xsd" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
21
<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
32
xsi:schemaLocation="http://www.w3.org/1999/xhtml ../htmlbook.xsd"
43
xmlns="http://www.w3.org/1999/xhtml">
@@ -97,8 +96,12 @@ <h5>Test</h5>
9796
<img src="image.png" id="an_image" lang="en"/>
9897
</figure>
9998

99+
<!-- Some embedded MML -->
100100
<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>2</mn> <mo>+</mo> <mn>2</mn> <mo>=</mo> <mn>4</mn></math>
101101

102+
<!-- Some embedded SVG -->
103+
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="200"><desc>SVG content goes here...</desc></svg>
104+
102105
<!-- Oh boy, let's do a couple tables -->
103106
<!-- No <tbody> -->
104107
<table border="" id="skeleton_of_a_table" accesskey="A a d">

svg/README

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
W3C SVG XML Schema, via http://www.w3.org/TR/2002/WD-SVG11-20020108/SVG.xsd
2+
(with local mods for validity by Sanders; see https://github.com/oreillymedia/HTMLBook for file history)
3+
4+
Dependencies also included:
5+
6+
xlink.xsd, via http://www.w3.org/1999/xlink.xsd
7+
xml.xsd, via http://www.w3.org/2001/xml.xsd

0 commit comments

Comments
 (0)