Skip to content

Commit 6e4d163

Browse files
committed
Documentation updates and improvements
1 parent cdb5b6d commit 6e4d163

File tree

17 files changed

+1360
-157
lines changed

17 files changed

+1360
-157
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/.idea/
22
/.gradle/
33
/build/
4+
/xmlresolver-cache/

README.md

Lines changed: 404 additions & 0 deletions
Large diffs are not rendered by default.

build.gradle

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ configurations.all {
3535
}
3636

3737
configurations {
38+
docbookImplementation {
39+
canBeResolved = true
40+
}
3841
standaloneClasspath.extendsFrom(testImplementation)
3942
}
4043

@@ -43,9 +46,11 @@ dependencies {
4346
[group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.13'],
4447
[group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.13'],
4548
[group: 'net.java.dev.msv', name: 'msv-core', version: '2013.6.1'],
46-
[group: 'org.xmlresolver', name: 'xmlresolver', version: "3.0.0-SNAPSHOT"],
47-
[group: 'org.xmlresolver', name: 'xmlresolver', version: "3.0.0-SNAPSHOT",
49+
[group: 'org.xmlresolver', name: 'xmlresolver', version: xmlresolverVersion],
50+
[group: 'org.xmlresolver', name: 'xmlresolver', version: xmlresolverVersion,
4851
classifier: 'data'],
52+
[group: 'org.xmlresolver', name: 'xmlresolver', version: xmlresolverVersion,
53+
classifier: 'apps'],
4954
[group: 'xml-apis', name: 'xml-apis', version: '1.4.01' ],
5055
[group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30' ],
5156
[group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30' ],
@@ -67,6 +72,19 @@ task setupDist() {
6772
}
6873
project.ext.runtimeClasspath = path.trim()
6974

75+
// HACK!
76+
configurations.docbookImplementation.resolve().each { dbpath ->
77+
if (dbpath.name.contains('docbook-xslTNG')
78+
|| dbpath.name.contains('schemas-docbook')) {
79+
doLast {
80+
copy {
81+
into { "${buildDir}/dist/docbook" }
82+
from dbpath
83+
}
84+
}
85+
}
86+
}
87+
7088
doLast {
7189
copy {
7290
into { "${buildDir}/dist/lib" }
@@ -99,7 +117,7 @@ task setupDist() {
99117
}
100118

101119
jar {
102-
archiveBaseName = "xmlresolver-sampleapp-${relVersion}"
120+
archiveBaseName = "sampleapp-${relVersion}"
103121
bnd ('Bundle-Vendor': 'Norman Walsh',
104122
'Bundle-Description': 'XML Resolver example application.',
105123
'Class-Path': "${project.ext.runtimeClasspath} lib",
@@ -110,14 +128,41 @@ jar {
110128
}
111129
jar.dependsOn setupDist
112130

113-
task copyJar(dependsOn: ["jar", "setupDist"], type: Copy) {
114-
into "${buildDir}/dist"
115-
from "${buildDir}/libs"
116-
include "*.jar"
131+
// Initially, I simply had the copyJar task copy the built jar
132+
// into the build/dist directory. But on the CI instance, this
133+
// always resulted in the files already in build/dist being
134+
// deleted. I couldn't reliably reproduce that on a Mac or
135+
// Linux, though I did think it happened once on my Linux test
136+
// rig. I'm punting and doing this instead, which seems to work.
137+
task copyJar(dependsOn: ["jar", "setupDist"]) {
138+
doLast {
139+
copy {
140+
into "${buildDir}/stage"
141+
from ("${buildDir}/dist") {
142+
exclude "lib/xmlresolver-${xmlresolverVersion}-apps.jar"
143+
}
144+
}
145+
}
146+
147+
doLast {
148+
copy {
149+
into "${buildDir}/stage"
150+
from ("${buildDir}/dist/lib") {
151+
include "xmlresolver-${xmlresolverVersion}-apps.jar"
152+
}
153+
}
154+
}
155+
156+
doLast {
157+
copy {
158+
into "${buildDir}/stage"
159+
from "${buildDir}/libs"
160+
}
161+
}
117162
}
118163

119164
task dist(dependsOn: ["copyJar", "setupDist"], type: Zip) {
120-
from("${buildDir}/dist")
165+
from "${buildDir}/stage"
121166
into 'xmlresolver-sampleapp-' + relVersion
122167
archiveFileName = "xmlresolver-sampleapp-${relVersion}.zip"
123168
}

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
relVersion=3.0.1beta2
2-
xmlresolverVersion=3.0.1beta2
1+
relVersion=3.0.1beta3
2+
xmlresolverVersion=3.0.1beta3-SNAPSHOT

schema/caterror.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
2+
3+
<system systemid="http://example.com/sample.dtd"
4+
uri="sample.dtd"/>
5+
6+
</catalog>

schema/sample/blocks.rnc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
default namespace = "http://xmlresolver.com/ns/sample"
2+
namespace xlink = "http://www.w3.org/1999/xlink"
3+
4+
p = element p { (text | em | link)* }
5+
6+
em = element em { (text | em | link)* }
7+
8+
link = element link {
9+
attribute xlink:href { text },
10+
text
11+
}

schema/sample/blocks.xsd

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://xmlresolver.com/ns/sample" xmlns:sample="http://xmlresolver.com/ns/sample" xmlns:xlink="http://www.w3.org/1999/xlink">
3+
<xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlink.xsd"/>
4+
<xs:element name="p">
5+
<xs:complexType mixed="true">
6+
<xs:choice minOccurs="0">
7+
<xs:element ref="sample:em"/>
8+
<xs:element ref="sample:link"/>
9+
</xs:choice>
10+
</xs:complexType>
11+
</xs:element>
12+
<xs:element name="em">
13+
<xs:complexType mixed="true">
14+
<xs:choice minOccurs="0">
15+
<xs:element ref="sample:em"/>
16+
<xs:element ref="sample:link"/>
17+
</xs:choice>
18+
</xs:complexType>
19+
</xs:element>
20+
<xs:element name="link">
21+
<xs:complexType mixed="true">
22+
<xs:attribute ref="xlink:href" use="required"/>
23+
</xs:complexType>
24+
</xs:element>
25+
</xs:schema>

schema/sample/catalog.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
2+
prefer="public">
3+
4+
<public publicId="-//Sample//DTD Simple 1.0//EN"
5+
uri="sample.dtd"/>
6+
7+
<system systemId="https://xmlresolver.org/ns/sample/sample.dtd"
8+
uri="sample.dtd"/>
9+
10+
<public publicId="-//Sample//DTD Simple Blocks 1.0//EN"
11+
uri="blocks.dtd"/>
12+
13+
<system systemId="https://xmlresolver.org/ns/sample/blocks.dtd"
14+
uri="sample.dtd"/>
15+
16+
<uri name="https://xmlresolver.org/ns/sample/sample.rng"
17+
uri="sample.rng"/>
18+
19+
<uri name="https://xmlresolver.org/ns/sample/blocks.rng"
20+
uri="blocks.rng"/>
21+
22+
<uri name="https://xmlresolver.org/ns/sample/sample.rnc"
23+
uri="sample.rnc"/>
24+
25+
<uri name="https://xmlresolver.org/ns/sample/blocks.rnc"
26+
uri="blocks.rnc"/>
27+
28+
<uri name="https://xmlresolver.org/ns/sample/sample.xsd"
29+
uri="sample.xsd"/>
30+
31+
<uri name="https://xmlresolver.org/ns/sample/blocks.xsd"
32+
uri="blocks.xsd"/>
33+
34+
<uri name="https://xmlresolver.org/ns/sample/xlink.xsd"
35+
uri="xlink.xsd"/>
36+
37+
<uri name="http://www.w3.org/2001/xml.xsd"
38+
uri="xml.xsd"/>
39+
40+
</catalog>

schema/sample/sample.rnc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
default namespace = "http://xmlresolver.com/ns/sample"
2+
namespace xlink = "http://www.w3.org/1999/xlink"
3+
namespace xsi = "http://www.w3.org/2001/XMLSchema-instance"
4+
5+
start = book | article
6+
7+
book = element book {
8+
attribute xsi:schemaLocation { text }?,
9+
title, (article+ | chapter+)
10+
}
11+
12+
article = element article { title?, p+ }
13+
chapter = element chapter { title, p+ }
14+
15+
title = element title { text }
16+
17+
include "https://xmlresolver.org/ns/sample/blocks.rnc"

schema/sample/sample.xsd

Lines changed: 23 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
2-
xmlns:ex="http://xmlresolver.org/ns/sample"
33
elementFormDefault="qualified"
4-
targetNamespace="http://xmlresolver.org/ns/sample">
4+
targetNamespace="http://xmlresolver.com/ns/sample"
5+
xmlns:sample="http://xmlresolver.com/ns/sample"
6+
xmlns:xlink="http://www.w3.org/1999/xlink">
7+
8+
<xs:include schemaLocation="https://xmlresolver.org/ns/sample/blocks.xsd"/>
59

610
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
711
schemaLocation="http://www.w3.org/2001/xml.xsd"/>
812

9-
<xs:attributeGroup name="common.attributes">
10-
<xs:attribute ref="xml:id"/>
11-
<xs:attribute ref="xml:lang"/>
12-
<xs:attribute ref="xml:base"/>
13-
</xs:attributeGroup>
14-
15-
<xs:group name="all.inlines">
16-
<xs:choice>
17-
<xs:group ref="ex:ubiq.inlines"/>
18-
<xs:group ref="ex:general.inlines"/>
19-
<xs:group ref="ex:domain.inlines"/>
20-
</xs:choice>
21-
</xs:group>
22-
23-
<xs:group name="ubiq.inlines">
24-
<xs:choice>
25-
<xs:element ref="ex:phrase"/>
26-
<xs:element ref="ex:superscript"/>
27-
<xs:element ref="ex:subscript"/>
28-
</xs:choice>
29-
</xs:group>
30-
31-
<xs:group name="general.inlines">
32-
<xs:choice>
33-
<xs:element ref="ex:abbrev"/>
34-
<xs:element ref="ex:emphasis"/>
35-
</xs:choice>
36-
</xs:group>
37-
38-
<xs:group name="domain.inlines">
39-
<xs:choice>
40-
<xs:element ref="ex:property"/>
41-
</xs:choice>
42-
</xs:group>
43-
44-
<xs:group name="all.blocks">
45-
<xs:choice>
46-
<xs:group ref="ex:para.blocks"/>
47-
<xs:group ref="ex:non-para.blocks"/>
48-
</xs:choice>
49-
</xs:group>
50-
51-
<xs:group name="para.blocks">
52-
<xs:choice>
53-
<xs:element ref="ex:p"/>
54-
</xs:choice>
55-
</xs:group>
56-
57-
<xs:group name="non-para.blocks">
58-
<xs:choice>
59-
<xs:element ref="ex:blockquote"/>
60-
</xs:choice>
61-
</xs:group>
62-
63-
<!-- ============================================================ -->
13+
<xs:import namespace="http://www.w3.org/1999/xlink"
14+
schemaLocation="https://www.w3.org/1999/xlink.xsd"/>
6415

65-
<xs:complexType name="inline.type" mixed="true">
66-
<xs:choice minOccurs="0" maxOccurs="unbounded">
67-
<xs:group ref="ex:all.inlines"/>
68-
</xs:choice>
69-
<xs:attribute name="role"/>
70-
<xs:attributeGroup ref="ex:common.attributes"/>
71-
</xs:complexType>
72-
73-
<xs:complexType name="para.type" mixed="true">
74-
<xs:choice minOccurs="0" maxOccurs="unbounded">
75-
<xs:group ref="ex:all.inlines"/>
76-
<xs:group ref="ex:non-para.blocks"/>
77-
</xs:choice>
78-
<xs:attribute name="role"/>
79-
<xs:attributeGroup ref="ex:common.attributes"/>
80-
</xs:complexType>
81-
82-
<!-- ============================================================ -->
83-
84-
<xs:element name="doc">
16+
<xs:element name="book">
8517
<xs:complexType>
8618
<xs:sequence>
87-
<xs:element ref="ex:title"/>
88-
<xs:element ref="ex:xsdextra" minOccurs="0" maxOccurs="1"/>
89-
<xs:group ref="ex:all.blocks" maxOccurs="unbounded"/>
19+
<xs:element ref="sample:title"/>
20+
<xs:choice>
21+
<xs:element maxOccurs="unbounded" ref="sample:article"/>
22+
<xs:element maxOccurs="unbounded" ref="sample:chapter"/>
23+
</xs:choice>
9024
</xs:sequence>
91-
<xs:attribute name="role"/>
92-
<xs:attributeGroup ref="ex:common.attributes"/>
9325
</xs:complexType>
9426
</xs:element>
95-
96-
<xs:element name="xsdextra">
27+
<xs:element name="article">
9728
<xs:complexType>
98-
<xs:complexContent>
99-
<xs:restriction base="xs:anyType"/>
100-
</xs:complexContent>
29+
<xs:sequence>
30+
<xs:element minOccurs="0" ref="sample:title"/>
31+
<xs:element maxOccurs="unbounded" ref="sample:p"/>
32+
</xs:sequence>
10133
</xs:complexType>
10234
</xs:element>
103-
104-
<xs:element name="title" type="ex:inline.type"/>
105-
<xs:element name="p" type="ex:para.type"/>
106-
107-
<xs:element name="blockquote">
35+
<xs:element name="chapter">
10836
<xs:complexType>
10937
<xs:sequence>
110-
<xs:element ref="ex:title" minOccurs="0"/>
111-
<xs:element ref="ex:p"/>
38+
<xs:element ref="sample:title"/>
39+
<xs:element maxOccurs="unbounded" ref="sample:p"/>
11240
</xs:sequence>
113-
<xs:attribute name="role"/>
114-
<xs:attributeGroup ref="ex:common.attributes"/>
11541
</xs:complexType>
11642
</xs:element>
117-
118-
<xs:element name="phrase" type="ex:inline.type"/>
119-
<xs:element name="emphasis" type="ex:inline.type"/>
120-
<xs:element name="superscript" type="ex:inline.type"/>
121-
<xs:element name="subscript" type="ex:inline.type"/>
122-
<xs:element name="abbrev" type="ex:inline.type"/>
123-
<xs:element name="property" type="ex:inline.type"/>
43+
<xs:element name="title" type="xs:string"/>
12444
</xs:schema>

0 commit comments

Comments
 (0)