[oXygen-user] RNC-DTD problem
George Cristian Bina
Tue Apr 27 08:12:13 CDT 2004
Hi Xavier,
The only way you mixed content can be specified in a DTD is like:
<!ELEMENT element (#PCDATA|child1|child2|child3)*>
In words that will be zero or more #text or child1 or child2 or child3 (and
so on).
> default namespace = ""
>
> start =
> element Vertices {
> (text
> | element Vertex {
> (text
> | element Data {
> attribute Constant { text },
> attribute Name { text },
> attribute Vector { text }
> })+
> })+
> }
The problem with this is that the model is one or more instead of zero or
more. If you change the + to * then the conversion should work.
> default namespace = ""
>
> start =
> element Vertices {
> text,
> element Vertex {
> text,
> element Data {
> attribute Constant { text },
> attribute Name { text },
> attribute Vector { text }
> }
> }
> }
In this case you have a sequence model, a text node followed by an element
in both cases. This is not supported by DTDs, so changing , (group) to |
(choice) will make the conversion work.
default namespace = ""
start =
element Vertices {
text |
element Vertex {
text |
element Data {
attribute Constant { text },
attribute Name { text },
attribute Vector { text }
}
}
}
will give you:
<?xml encoding="UTF-8"?>
<!ELEMENT Vertices (#PCDATA|Vertex)*>
<!ATTLIST Vertices
xmlns CDATA #FIXED ''>
<!ELEMENT Vertex (#PCDATA|Data)*>
<!ATTLIST Vertex
xmlns CDATA #FIXED ''>
<!ELEMENT Data EMPTY>
<!ATTLIST Data
xmlns CDATA #FIXED ''
Constant CDATA #REQUIRED
Name CDATA #REQUIRED
Vector CDATA #REQUIRED>
Best Regards,
George
-------------------------------------------------------------
George Cristian Bina mailto:
<oXygen/> XML Editor - http://www.oxygenxml.com/
More information about the oXygen-user
mailing list