<include> directive and sub descriptors in 0.6.5

please report bugs here

<include> directive and sub descriptors in 0.6.5

Postby bdickenson » Wed Apr 06, 2011 2:23 pm

Can you give more info on the process on using <include uri="foo.xml" /> to put descriptor logic in external files ?


Using v 0.6.5 I cannot seem to get this to work ...maven giving unsupported import type error

The doc in section 4.3.2 is sparse.

what are the required contents of the external file ? can foo be any valid text ? must /should it be a <generate>.....</generate> bracketing ? does it need full xml headers of any sort ?

I've tried a variety of obvious permutations here but can't seem to get this to function as doc'ed in section 4.3.2 in particular. Most obvious below but I've tried others.

THIS benerator.xml

<?xml version="1.0" encoding="UTF-8"?>
<setup xmlns="http://databene.org/benerator/0.6.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://databene.org/benerator/0.6.5 benerator-0.6.5.xsd"
defaultEncoding="Cp1252"
defaultDataset="US"
defaultLocale="en_US"
defaultLineSeparator="\r\n">

<import defaults="true"/>
<include uri= "foo.xml"/>

</setup>

and THIS foo.xml:

<generate type="Person" count="10" consumer="ConsoleExporter">
<id name="identifier" type="long" generator="new IncrementalIdGenerator(100)"/>
<attribute name="active" type="boolean" constant="true"/>
<attribute name="firstName" type="string" values="'Alice','Bob','Charly'"/>
<attribute name="rank" type="int" values="1,2,3,4,5,6"/>
<comment> Here we reach the critical part ...</comment>
<attribute name="salutation" type="string" pattern=" (Mr|Mrs)\. " />
<attribute name="postalCode" type="string" pattern="[1-9][0-9]{4}"/>
</generate>

or THIS foo.xml:

<setup xmlns="http://databene.org/benerator/0.6.5"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://databene.org/benerator/0.6.5 benerator-0.6.5.xsd"
defaultEncoding="Cp1252"
defaultDataset="US"
defaultLocale="en_US"
defaultLineSeparator="\r\n">

<import defaults="true"/>
<generate type="Person" count="10" consumer="ConsoleExporter">
<id name="identifier" type="long" generator="new IncrementalIdGenerator(100)"/>
<attribute name="active" type="boolean" constant="true"/>
<attribute name="firstName" type="string" values="'Alice','Bob','Charly'"/>
<attribute name="rank" type="int" values="1,2,3,4,5,6"/>
<comment> Here we reach the critical part ...</comment>
<attribute name="salutation" type="string" pattern=" (Mr|Mrs)\. " />
<attribute name="postalCode" type="string" pattern="[1-9][0-9]{4}"/>
</generate>

</setup>

Both fail.

Help please.
bdickenson
 
Posts: 2
Joined: Mon May 24, 2010 10:34 pm

Re: <include> directive and sub descriptors in 0.6.5

Postby Volker Bergmann » Tue Apr 19, 2011 8:31 am

Hi bdickenson,

the <include> statements determines the file type from its extension, so you need to have a .ben.xml suffix for including Benerator files:
Code: Select all
<include uri="foo.ben.xml" />


The content of this file must be the same as in any Benerator Descriptor file
Code: Select all
<setup...>
   <generate...>
   </generate>
</setup>


Regards,
Volker 'databene' Bergmann

Need faster response times? phone support? onsite support? training? custom extensions? immediate bug fixes? Support Benerator evolution by buying services from Volker Bergmann!
User avatar
Volker Bergmann
 
Posts: 654
Joined: Sat Nov 10, 2007 2:40 pm


Return to Benerator Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron