On Wed, Dec 14, 2005 at 09:54:27PM +0100, Stephane Bortzmeyer <[EMAIL PROTECTED]> wrote a message of 42 lines which said:
> I'm currently bitten by what seems to be a bug in libxml2. Emacs' > nxml-mode accepts my XML files but libxml2 claims: Here are a few files to help reproduce the problem: - the RelaxNG schema (in both formats) - two test files: test.xml fails with the message I gave and test-ok.xml (which has only one occurrence of the <code> element) validates - a Makefile if you use Unix The results: % xmllint --noout --relaxng schema.rng test-ok.xml test-ok.xml validates % xmllint --noout --relaxng schema.rng test.xml test.xml:2: element para: Relax-NG validity error : Expecting an element got text Relax-NG validity error : Extra element text in interleave test.xml:2: element para: Relax-NG validity error : Element para failed to validate content test.xml fails to validate ------------------------ Yahoo! Groups Sponsor --------------------~--> Most low income homes are not online. Make a difference this holiday season! http://us.click.yahoo.com/5UeCyC/BWHMAA/TtwFAA/2U_rlB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/rng-users/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
start = content
content = element content {mixed {element para {inlines* & code*}+}}
inlines = link* & emphasis* & text*
code = element code {text}
emphasis = element emphasis {text}
link = element link {text}
<?xml version="1.0" encoding="UTF-8"?> <grammar xmlns="http://relaxng.org/ns/structure/1.0"> <start> <ref name="content"/> </start> <define name="content"> <element name="content"> <mixed> <oneOrMore> <element name="para"> <interleave> <zeroOrMore> <ref name="inlines"/> </zeroOrMore> <zeroOrMore> <ref name="code"/> </zeroOrMore> </interleave> </element> </oneOrMore> </mixed> </element> </define> <define name="inlines"> <interleave> <zeroOrMore> <ref name="link"/> </zeroOrMore> <zeroOrMore> <ref name="emphasis"/> </zeroOrMore> <zeroOrMore> <text/> </zeroOrMore> </interleave> </define> <define name="code"> <element name="code"> <text/> </element> </define> <define name="emphasis"> <element name="emphasis"> <text/> </element> </define> <define name="link"> <element name="link"> <text/> </element> </define> </grammar>
test.xml
Description: application/xml
test-ok.xml
Description: application/xml
TRANG=trang
XMLLINT=xmllint
XMLLINTARGS=--noout --relaxng schema.rng
all: test
%.rng: %.rnc
${TRANG} -I rnc -O rng $< $@
test: test.xml schema.rng
${XMLLINT} ${XMLLINTARGS} $<
