How do I incorporate a controlled vocabulary into my RELAX rng schema?
November 17, 2009 11:03 AM   Subscribe

[xmlschema filter] So, I'm trying to create a RELAX ng schema and I can't get my custom controlled vocabulary to validate! I'm a total n00b and I've been puzzling over this for a while, so I apologize if my question doesn't even make sense.

So, I want to classify the documents I'm modeling according to the ICOM Vocabulary of Basic Terms for Cataloguing Costume. I could create an element that had a "choice" attribute and make a big list of terms as values: <value>dress</value><value>skirt</value> and so on.

But, the ICOM vocabulary is more complicated than. It breaks each garment down from general to specific, something like Library of Congress classifications. So, the final classification ends up being something like dress -- one piece -- additional optional pieces to complete the garment. And I'm having trouble expressing that hierarchy in XML in a way that validates. ( I get validation errors if I make children for values, or for making too many patterns, or for going straight from "start" to "value"...)

Help! Is there a way to make this work?

I know this question is pretty garbled. I'll be here at the computer all day if I need to clarify!
posted by thewrongparty to Computers & Internet (3 answers total) 1 user marked this as a favorite
Well, what exactly do you want to do with the schema once you have it? Do you want to just be able to define elements in your xml like <piece name="Top Hat" type="Men's Garments -- Accessories -- Headwear" />? Because if so, just define type as being a flat list of all the possible values: you're not going to be able to take advantage of the hierarchy in your xml so you don't need to model it.
posted by inkyz at 1:03 PM on November 17, 2009

I think you may be right, though it still sort of bothers me to flatten it out like that. Now that I think about it, I think this is what they end up doing in MODS with LOC categories.
posted by thewrongparty at 1:35 PM on November 17, 2009

Yeah, this is, IMHO, the biggest weakness in RelaxNG- it doesn't let you specify regular expressions for string validation, unlike, say, XML Schema. Another solution, of course, would be to specify the category in a more structured way, such as
<costume type="dress" pieces="1">
    <accessory name="necklace"/>

posted by gsteff at 2:18 PM on November 17, 2009

« Older Please help me come up with some great fundraising...   |   How does Indian stamp paper work? Newer »
This thread is closed to new comments.