XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] Generating XML from XSD

Hello,

The purpose is testing an XML processor for correctness and being able to "fuzz" instances is a good way, in my opinion, to test. This can also be a good way to test security.

It is clear that this is something that blows up quickly. I think it is also clear that the code can end up to be complicated.

To look at this problem as a combinatorial problem and use a tool that fits for the job, e.g., Haskell, might be a good approach.

Shlomo.

-----Original Message-----
From: Anthony B. Coates (XML-Dev) [mailto:abcoatesecure-xmldev@yahoo.co.uk] 
Sent: δ 28 ιεπι 2007 23:53
To: xml-dev@lists.xml.org
Subject: Re: [xml-dev] Generating XML from XSD

It isn't clear what your criteria are.  Is it that you want (for example)  
a command-line tool, rather than a GUI tool?

I worked on a big project where we generated almost 500 Schemas off a  
shared repository of data types.  We used Schema "compiler" to generate  
Java for each of these Schemas.  We were then asked to provide complete  
(or near complete) test coverage for all of that Java code, for something  
like a million lines of Java code.

To do that, we needed a complete set of regression test examples.  They  
didn't have to make business sense, as they were only for coverage  
purposes.  One of my team wrote an instance generator that created the  
minimum number of instances needed to test the alternatives.  This meant  
examining the choices and optionalities in each Schema.  So, if a Schema  
contains two choice contructs, each with 3 choices, then you need 3  
examples to test all paths, not 5 or 6, since you can change each choice  
in each example.  We only tested minimum and maximum cardinalities, and  
for "unbounded" we used "2" as a representative cardinality value.

It was a complex piece of code.  Then for each example, we created  
equivalent Java code that created the same examples via the Java API.   
That Java code was about 200 megabytes.  We broke pretty much every  
built-in limit in the Java compiler and run-time trying to get that code  
to compile and run, and had to re-engineer a couple of times to work  
around that.

To handle patterns, as we didn't have more than one or two dozen to worry  
about, the example generation code contained an enumeration of the  
different patterns, and some strings which were known to satisfy the  
patterns. It was an error if the Schemas has a pattern that wasn't in the  
enumerated list.

I want to make the point that this isn't a simple problem, it can blow up  
very quickly into something intractable or near-intractable, and so it is  
very important to be crystal clear about what your exact needs and use  
cases are.  In my case, there wasn't a suitable tool; whether there is a  
suitable tool for you depends on what your key needs are (and I don't know  
 from what has been written to date).

Cheers, Tony.

On Thu, 28 Jun 2007 18:51:32 +0100, Shlomo Yona <S.Yona@F5.com> wrote:

> Hello,
>
> Isn't there any alternative other than XML Spy and oXygen for this  
> functionality?
>
> Shlomo.
>
>
> -----Original Message-----
> From: Anthony B. Coates (XML-Dev)  
> [mailto:abcoatesecure-xmldev@yahoo.co.uk]
> Sent: γ 27 ιεπι 2007 20:20
> To: xml-dev@lists.xml.org
> Subject: Re: [xml-dev] Generating XML from XSD
>
> It's already been mentioned that tools like XML Spy and oXygen have some
> capability to produce XML instances to match a Schema.  However, my own
> experience (mostly with users who had XML Spy) is that the tool often
> generated invalid instances, and the users then assumed that there was an
> error in the Schema that they had been given.
>
> In particular, I'm not sure if any tool will reliably generate valid
> instances if there are pattern restrictions in a Schema.  This may well  
> be
> an intractable problem, to generate a valid string match a pattern for  
> any
> arbitrary pattern.  Certainly it isn't a trivial problem.  It does mean,
> however, that you should never expect an XML instance generator to fully
> valid XML.  It may need editing to make it valid.
>
> Cheers, Tony.
>
> On Wed, 27 Jun 2007 06:55:46 +0100, Sagar Surana  
> <sagar.surana@amdocs.com>
> wrote:
>
>> Hi,
>>
>>   I want some kind of API's which can help generate a random XML based
>> on XSD.
>>
>>
>>
>>
>> Can someone please help me regarding the same.
>>
>>
>>
>>
>> Keep Smiling,
>>
>> Sagar Surana



-- 
Anthony B. Coates
Senior Partner
Miley Watts LLP
Experts In Data
UK: +44 (20) 8816 7700, US: +1 (239) 344 7700
Mobile/Cell: +44 (79) 0543 9026
Data standards participant: genericode, ISO 20022 (ISO 15022 XML),  
UN/CEFACT, MDDL, FpML, UBL.
http://www.mileywatts.com/

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS