[Typo3-dev] Writing a DTD for T3DataStructure simply not possible

Kasper Skårhøj kasper2005 at typo3.com
Wed Feb 16 08:44:08 CET 2005


Hi Sven, and others.


It is true that the main requirement to the XML was that it could EASILY
be round-trip converted: XML<->PHP-array and that it does well.

However there is some flexibility in the xml2array function that means
that a data structure can look different but STILL be the same when
parsed. Example


<field_content ....>


could instead be 

<myfield index="field_content" ...>


(try yourself!)


Internally xml2array will look for the attribute "index" and if that is
found it doesn't care two seconds more about the tag name!



This principle means that data structures CAN be DTD made and backwards
compatible.

However it doesn't help much of course it the XML that TYPO3 writes
doesn't respect this. So what we want is to look at how to configure
array2xml() to output DTD verifyable XML.

At the time of making TemplaVoila array2xml didn't support advanced
configuration but recently it does. A good example is the new export
format in XML where I would claim it is DTD verifiable - at least no
TAGs are variable (but certain attributes are required).

The key to solving this problem is to create a configuration array like
the one used for the import/export.

If anyone finds this interesting all you need to do is study for a few
hours on the configuration array of the XML export, play with it and
make it work kfor data structures - backwards compabilitity is there
already!


- kasper









On Tue, 2005-02-15 at 16:37, Sven Wilhelm wrote:
> Hi,
> 
> I'm working with TV on some definded projects.
> During this work I had the wish for a DTD or Schema for T3DataStructure, 
> because with such one it would be possible to easily generate such a 
> structure with an external DTD-aware XML-Editor.
> 
> Also Kasper asked in one of the Docs of the Documentation area that one 
> could write such an DTD.
> 
> After analysing a little bit the T3DataStructure I say that it is simply 
> not possible to write a DTD because of the dynamic use of element names.
> 
> An example is the use of field_xxx for element names. If you have 20 
> Structures you can believe that you need 20 DTD to be valid this way.
> This is an example where an element name was choosen where an attribute 
> is definitly the right thing.
> 
> One way for optimization would be something like an RFC for the 
> T3DataStructure.
> 
> * Where do you want to use the structure?
> * What elements do you think you need for that (could be possible an
>    oo-model that will be transfered to a DTD)?
>    The oo-model has the sence that the model could be reviewed in several
>    step before implementing anything.
> * What attributes are necessary for the elements?
> 
> Building a DTD from that way and use it in a specified implementation (TV).
> 
> -----------------------------------------------
> Example snapshot of a T3DataStructure:
> 
>              <field_content type="array">
>                  <tx_templavoila type="array">
>                      <title>Welcome Content Area</title>
>                      <description>[Here you can map the 
> content]</description>
>                      <sample_data type="array">
>                          <numIndex index="0">Some content, content, 
> content</numIndex>
>                      </sample_data>
>                      <eType>ce</eType>
>                      <TypoScript>
> 	10= RECORDS
> 	10.source.current=1
> 	10.tables = tt_content
> 							</TypoScript>
>                  </tx_templavoila>
>                  <TCEforms type="array">
>                      <config type="array">
>                          <type>group</type>
>                          <internal_type>db</internal_type>
>                          <allowed>tt_content</allowed>
>                          <size>5</size>
>                          <maxitems>200</maxitems>
>                          <minitems>0</minitems>
>                          <multiple>1</multiple>
>                          <show_thumbs>1</show_thumbs>
>                      </config>
>                      <label>Welcome Content Area</label>
>                  </TCEforms>
>              </field_content>
>             <field_news_latest type="array">
>             .
>             .
>             .
>              </field_news_latest>
> -----------------------------------------------
> 
> Greets Sven
> _______________________________________________
> Typo3-dev mailing list
> Typo3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
-- 
- kasper

*******************
Happy new year! - My email address is now: 

		kasper2005 at typo3.com 







More information about the TYPO3-dev mailing list