Relax NG Compact Question
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 107
- Joined: Mon Jul 30, 2007 11:31 pm
- Location: College Park, MD, United States
Relax NG Compact Question
Hello,
I'm new to RelaxNG, and I love both the normal and the compact version. I'm using the compact version for now because it's…well, compact!
I'm working on a schema that defines 2 elements: course, and courses (for grouping multiple course elements).
Here are my design goals:
Here's what I've got so far:
I'm getting an error both for the "externalRef" on courses/@dept and for a "reference to undefined pattern 'courses'". I'm not sure what that means, since this error exists right in the middle of specifying the courses pattern itself.
As you can see I haven't gotten around to the restrictions involved with @dept. I don't know how to proceed with this, but I would like to solve the other errors first if possible.
Does anybody know how to satisfy these conditions?
I'm new to RelaxNG, and I love both the normal and the compact version. I'm using the compact version for now because it's…well, compact!
I'm working on a schema that defines 2 elements: course, and courses (for grouping multiple course elements).
Here are my design goals:
- This schema should be able to "mix in" well with other schemas. it is one component of a project I'm working on. This project uses several schemas. This is simply the one I am currently focused on.
- For the purposes of this schema, Courses will serve as the start element. However, in an XML document that uses this schema AND other schemas, Courses may not necessarily be the root element.
- Courses should be recursive.
- The @dept attribute…
- Is a required attribute of Course elements
- Is an optional attribute of Courses elements. If specified on a Courses element:
- no further Courses elements can be nested within
- All contained Course elements are now forbidden to specify their own @dept (it should be considered inherited from the container)
- The @dept value should contain an IDREF an element specified elsewhere.
- Course elements can specify all of their values locally, or they may reference an already-declared Course element. If this referenced Course doesn't specify all of its attributes, then the "calling" Course can "fill these values in" if desired.
Here's what I've got so far:
Code: Select all
namespace rng = "http://relaxng.org/ns/structure/1.0"
datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
start = element courses {
(
attribute dept {externalRef},
course+
) | courses*
}
course = element course {
course.attlist
}
course.attlist =
attribute dept {xsd:string},
attribute number {xsd:string},
attribute credits {xsd:nonNegativeInteger{} },
attribute grade {xsd:string{ minLength="1" maxLength="2"} }?,
attribute title {xsd:string}?,
attribute description {xsd:string}?
As you can see I haven't gotten around to the restrictions involved with @dept. I don't know how to proceed with this, but I would like to solve the other errors first if possible.
Does anybody know how to satisfy these conditions?
-- Zearin
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service