newtfire / digitProjectDesign-Hub

shared repo for DIGIT 400: Digital Project Design class at Penn State Erie, The Behrend College
Creative Commons Zero v1.0 Universal
12 stars 2 forks source link

Sample call-for-help: Help! My schema isn't working #9

Closed ebeshero closed 3 years ago

ebeshero commented 4 years ago

Try to explain what's wrong as clearly as you can. Include a code block:

My code isn't working. I tried [explain what you tried]. Show us some code

start = poem
poem = element poem {title, Sentence}
title = attribute title {"Ozymandias"}
# The words in blue are called "reserve words" in Relax NG. 
Sentence = element Sentence {n?, lin

My XML looks like

<xml>code</xml>

Do I need another repetition indicator? what am I missing? @ebeshero

JeremyF5737 commented 4 years ago

I am working on the RelaxNG portion of the assignment and am getting a syntax error when i am defining the elements for the poem element.

My RelaxNG code looks like this

start = xml xml = element xml {meta,poem}

hierarchy for the xml where meta and poem are inside of the xml tag

meta = element meta {title, author, publication, source} title = element title {text} author = attribute author {text} publication = element publication {title, pubPlace, date}

listing elements and attributes under the publication tab

title2 = element title {type, text} type = attribute type {"journal" | "book" | "log"} pubPlace = element pubPlace {text} date = element date {when, text} when = attribute when {"1818-01-11"} source = element source {ref, text}

listing all elements and attributes under source

ref = element ref {target} target = attribute target {"http://www.bl.uk/learning/timeline/item126940.html"}

everything in the meta tag has been assigned an element along with it's attributes

poem = element poem {1+}

listing everything inside of the poem tag

1 = element 1 {n, mixed { (person | place | fragment | object | MCandW)*} place = element place {text} person = element person {text} fragment = element fragment {text} object = element object {text} n = attribute n {xsd:integer}

In the Ozymandias script it shows that the <1's> are the only element that is listed under the poem, while the rest of the elements are listed within the 1's such as; place, person, fragment, object, n. I placed a + after the 1 because it indicates that there is atleast one or more. I would be extremely grateful if anyone could help me with this code.

ebeshero commented 4 years ago

@JeremyF5737 I think I see the problem! The element is not 1, but the lower case letter l (short for line)! Try changing that to the lower case letter l. There might be a rule in XML that an element can't be named for a number, so that might be generating the syntax error.

elmusfi commented 4 years ago

I am also getting a syntax error when defining elements in the poem element. I'll post my code:

start = xml xml = element xml {meta, poem}

meta = element meta {title, author, publication, source} title = element title {text} author = element author {text} publication = element publication {title, pubPlace, date} title2 = element title {"type", text} type = attribute type {"journal"} pubPlace = element pubPlace {text} date = element date {"when"} when = attribute when {xsd:date} source = element source {ref} ref = element ref {target} target = attribute target {text}

poem = element poem {l+} l = element l {"n", mixed { (person, place, fragment, object)* } person = element person {text} place = element place {text} fragment = element fragment {text} object = element object {text} n = attribute n {xsd:integer}

I made the text bold where I keep getting the error (at the person element). I'm just not sure what I'm doing wrong. All help appreciated!

ebeshero commented 4 years ago

@elmusfi This is a great exercise in trying to figure out the problem! oXygen is highlighting that line because something isn’t finished on the line before. This is really hard to see, but take a look at the mixed{ } syntax on the line before. Mixed syntax basically should make a new set of curly braces inside a schema rule, and Relax NG needs to see that both sets properly open and close, like this:

l = element l {n, mixed{.  .  .} }

You’re just missing a curly brace to finish out that line.

elmusfi commented 4 years ago

@ebeshero I added a curly brace and now the error is on the line above it for "group of "string" or "data" element"

ebeshero commented 4 years ago

Here's a sample of linking directly to a file I pushed to the repo: https://github.com/newtfire/digitProjectDesign-Hub/blob/master/Class-Examples/Relax-NG/ozyMeta/ozyMeta.xml