Copy link to clipboard
Copied
Frame Maker 11 reports an error if an element name is declared more than once in XSD. However Dot.NET 4.0 validation with the same XSD is OK with such model and validates the different modeled elements with the same name (e.g. fett) correctly. We need the "double declaration of the same element" feature in Frame Maker 11 in a big migration project. We migrate SGML data to XML. How can we solve this?
Hint: we explicitly want to prohibit an endless recursive nesting of elements!
Sample XSD:
<xs:schema xmlns="http://tempuri.org/test-rekursion" xmlns:tr="http://tempuri.org/test-rekursion" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://tempuri.org/test-rekursion" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xs:group name="inlineBase"> <xs:choice> <xs:element name="sup" type="xs:string" /> <xs:element name="sub" type="xs:string" /> <xs:element name="keyword" type="xs:string" /> <xs:element name="inline-graphics" type="xs:string" /> </xs:choice> </xs:group> <xs:element name="paragraph"> <xs:complexType mixed="true"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:group ref="tr:inlineBase" /> <xs:element name="bold"> <xs:complexType mixed="true"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:group ref="tr:inlineBase" /> <xs:element name="italic"> <xs:complexType mixed="true"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:group ref="tr:inlineBase" /> </xs:choice> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> <xs:element name="italic"> <xs:complexType mixed="true"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:group ref="tr:inlineBase" /> <xs:element name="bold"> <xs:complexType mixed="true"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:group ref="tr:inlineBase" /> </xs:choice> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:choice> <xs:attribute name="autor" type="xs:string" /> </xs:complexType> </xs:element> </xs:schema>
Sample XML:
<paragraph xmlns="http://tempuri.org/test-rekursion" xsi:schemaLocation="http://tempuri.org/test-rekursion test-recursion2.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > Lorem ipsum <bold>dolor <italic>sit amet<sup>hoch 2</sup>, consetetur </italic>sadipscing elitr, sed diam nonumy eirmod</bold> tempor invidunt ut labore et <italic>dolore <bold>magna aliquyam<sup>hoch 3</sup> erat</bold>, sed diam voluptua</italic>. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. </paragraph>
Opening the XML in Frame Maker 11 results in following error:
XML Read Report Log Source Document: C:\Work\DOCS\120820-Base-Umstrukturierung\Bold-Italic-Test-2.xml XML Parser Messages (Document Prolog) Error at file C:\Users\t25681a\AppData\Local\Temp\FMTCCD7.tmp, line 18, char 17, Message: Element 'italic' has already been declared Error at line 19, char 15, Message: Element 'bold' has already been declared
Thanks a lot for any suggestions
Miro
Copy link to clipboard
Copied
Hi Miro,
I'm no power user of XML schema so I may not be able to provide a lot of help. Two observations though:
- If the parser used by FrameMaker (Xerces) doesn't like the construct, I think you have no choice but to change the construct. To my knowledge, there is nothing you can do to alter how the parser interprets your files. I don't know for sure, but if Xerces says it is wrong, dot.NET is probably wrong for not saying it's wrong
- Schema provides a reasonably flexible mechanism for declaring (naming) an <element> one time (e.g., <element name="fett">), the referencing that element throughout the schema (e.g., <element ref="fett">) Have you tried this approach, and if so, what were the limitations that made it unworkable? I'm curious because I think the prevention of endless recursion is a worthy effort.
Russ
Copy link to clipboard
Copied
Hi Russ,
hm, with "ref" i got only the unwanted endless recursion:
Sample XSD:
<xs:complexType name="inlineBase" mixed="true"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="sup" type="xs:string" /> <xs:element name="sub" type="xs:string" /> <xs:element name="keyword" type="xs:string" /> <xs:element name="inline-graphics" type="xs:string" /> <xs:element ref="bold" /> <xs:element ref="italic" /> </xs:choice> </xs:complexType> <xs:element name="bold" type="tr:inlineBase" /> <xs:element name="italic" type="tr:inlineBase" /> <xs:element name="paragraph" type="tr:inlineBase" />
Sample XML:
<paragraph xmlns="http://tempuri.org/test-rekursion" xsi:schemaLocation="http://tempuri.org/test-rekursion test-recursion1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > Lorem ipsum <bold>dolor <bold>1st nested bold</bold> it <italic>sit amet<bold>2nd nested bold</bold>, consetetur <italic>recursion</italic> et</italic>sadipscing elitr, sed diam nonumy eirmod</bold> tempor ... </paragraph>
Frame Maker is now satisfied, Dot.Net is satisfied, but I am not satisfied with the possible endless nesting of the elements....
Do you have or anybody has any idea how to prohibit the endless recursion, satisfy Frame Maker and provide the editor with a single element name for e.g. "bold" at the same time?
THNX!
Copy link to clipboard
Copied
Hi Miroslav,
I haven't done too much with XSD and FrameMaker, so you have to test following suggestions, to see if they will work with FrameMaker.
1. I don't like these kind of structures. If there is a need for such constructions I'll prefer one of following alternatives
1.a) Define three elements: bold, italic and bolditalic these elements only refer tr:inlinebase and are mixed content
1.b) Define one element "emphasis" and add one or two attribute to define weight (bold, regular) and style (italic, regular)
I'd prefer this approach... If you don't like it:
2. Try to define complexTypes directly below xs:schema and define the type of element
<xs:schema xmlns="http://tempuri.org/test-rekursion" xmlns:tr="http://tempuri.org/test-rekursion" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://tempuri.org/test-rekursion" xmlns:xs="http://www.w3.org/2001/XMLSchema" >>
<xs:group name="inlineBase">
<xs:choice>
<xs:element name="sup" type="xs:string" />
<xs:element name="sub" type="xs:string" />
<xs:element name="keyword" type="xs:string" />
<xs:element name="inline-graphics" type="xs:string" />
</xs:choice>
</xs:group>
<xs:element name="paragraph">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="tr:inlineBase" />
<xs:element name="bold" type="tr:boldTopLevel">
<xs:element name="italic" type="tr:italicTopLevel">
</xs:choice>
<xs:attribute name="autor" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:complexType mixed="true" name="boldTopLevel">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="tr:inlineBase" />
<xs:element name="italic" type="tr:emphapisLowLevel"/>
</xs:choice>
</xs:complexType>
<xs:complexType mixed="true" name="tr:italicTopLevel">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="tr:inlineBase" />
<xs:element name="bold" type="tr:emphapisLowLevel"/>
</xs:choice>
</xs:complexType>
<xs:complexType mixed="true" name="emphapisLowLevel">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="tr:inlineBase" />
</xs:choice>
</xs:complexType>
</xs:schema>
Bye Markus
Copy link to clipboard
Copied
Hi Mrakus,
1) yep, I do not like it much myself, but I try to solve this migration issue for migrating aprox 500.000! documents from SGML to XML world with a highly complex structure…
I try to introduce a better and simpler structuring on the way and I try not to introduce this new endless recursions, which were not possible in the old SGML world.
1.a) “bolditalic” way, or giving up the need to prohibit the endless recursion, could be one of the solution possibilities
1.b) “emphasis” in your proposal, is itself still endlessly recursive, isn’t it?
2) In this proposal point you defined both bold and italic twice, which in turn is an error according to Frame Maker 11…
But THNX a lot for brainstorming
Miro
Copy link to clipboard
Copied
1.b) “emphasis” in your proposal, is itself still endlessly recursive, isn’t it?
No emphasis defines if text ist bold, italic or bold and italic. It has no "italic" or "bold" element anymore. There are only sub and sup childs or text, so there's no recursion.
2) In this proposal point you defined both bold and italic twice, which in turn is an error according to Frame Maker 11…
Did you try it? I think I could remember (I'm not sure), that some processors have problems with these nested complexTypes; at least in former times. So I think perhaps this problem could be solved with that way, but I'm not sure, because I can't test it at the moment.
Markus
Copy link to clipboard
Copied
Hi Markus,
your suggestions do not help.
1.b) you can not express the following nesting with your XSD without cuting the nesting into "pieces", which in turn is not possible for other simmilarly behaving elements:
<bold>dolor <italic>sit amet</italic> sadipscing eirmod</bold> bla bla <italic>dolore <bold>magna aliquyam erat</bold>, sed diam</italic>
2) sorry, but "perhaps", "I'm not sure" and "I think" are not a real reasoning against tests, which I have done. Yes I did try and it brings errors as stated above. Just take my examples from above and try to define a non recursive modell with a single name for bold and italics.
Greetz
Miro
Copy link to clipboard
Copied
The internal subset is parsed first in and, if multiple declarations for an entity occur, the first declaration is used. Declarations in the internal subset override declarations in the external subset.
Copy link to clipboard
Copied
Thread moved to FrameMaker Structured Forum
Find more inspiration, events, and resources on the new Adobe Community
Explore Now