Closed ebeshero closed 3 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}
meta = element meta {title, author, publication, source} title = element title {text} author = attribute author {text} publication = element publication {title, pubPlace, date}
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}
ref = element ref {target} target = attribute target {"http://www.bl.uk/learning/timeline/item126940.html"}
poem = element poem {1+}
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.
@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.
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!
@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.
@ebeshero I added a curly brace and now the error is on the line above it for "group of "string" or "data" element"
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
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
My XML looks like
Do I need another repetition indicator? what am I missing? @ebeshero