Skip to content

Commit

Permalink
schema from class today
Browse files Browse the repository at this point in the history
  • Loading branch information
ebeshero committed Sep 20, 2024
1 parent db2736a commit 5fa4b84
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Class-Examples/Relax-NG/goodMorning/drbSchema-goodMorning.rnc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
start = xml
xml = element xml {source, poem}

source = element source {title, author, date }
title = element title {level, text}
level = attribute level {"book" | "inner" }
author = element author { text}
date = element date {when, empty }
# I am going to choose to use the reserve word
# even though you don't have to. Here is another
# way to write this:
# date = element date {when}
when = attribute when {xsd:date | xsd:gYear}

poem = element poem {title, lg+ }

lg = element lg {ln+}
ln = element ln {n, mixed{ (placeName | place | motif)* } }
placeName = element placeName {ref, text}
place = element place {ref, text}
motif = element motif {text}

n = attribute n {xsd:integer}
ref = attribute ref {"NYC-Harlem" | "NYC-Man" | text}










21 changes: 21 additions & 0 deletions Class-Examples/Relax-NG/goodMorning/goodMorning.rnc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
start = xml
xml = element xml {source, poem}
source = element source {title, author, date}
title = element title {level, text}
author = element author {text}
date = element date {when}
when = attribute when {xsd:date | xsd:gYearMonth | xsd:gYear}
level = attribute level {"inner" | "book"}


poem = element poem {title, lg*}
lg = element lg {ln+}
ln = element ln {n, mixed{(placeName | place | motif)*}}
n = attribute n {xsd:integer}

placeName = element placeName {ref, text}
place = element place {ref, text}
motif = element motif {text}
ref = attribute ref {"NYC-PennSt" | "NYC-Man" | "NYC-Harlem" | "NYC" | "Cuba" | "PR" | "Ha" | "Ja" | "Fla" | "La" | "Ga"| "NYC-Brook" | "NYC-Bronx"}


1 change: 1 addition & 0 deletions Class-Examples/Relax-NG/goodMorning/goodMorning.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ that your model didn't take into account. Either change your XML to match your s
or fix the schema so it properly defines your XML structure.
The goal? A green square in oXygen.
-->
<?xml-model href="drbSchema-goodMorning.rnc" type="application/relax-ng-compact-syntax"?>
<xml>
<source>
<title level="book">Montage of a Dream Deferred</title>
Expand Down

0 comments on commit 5fa4b84

Please sign in to comment.