Hi Uli,
as far as I know the XML part of Castor this is not possible out of the
box. The only idea I have is to use Castor as schema reader like we do
with SourceGenerator but instead of generating source code write XML
tags directly to a serializer. Maybe you can use SourceGenerator as base
for your application. One thing I'm wondering about is how you want to
define the content for the XML.
Just my 0.02 cent
Ralf
Ulrich Freyer-Hirtz schrieb:
Hi Werner,
I'd like to generate all things "in memory". I understood, that it's possible
to write a batch or use an ANT Task to do generation, compilation and at least the usage,
but I would like to do that in my Java-Program. Another task is, that I would like to
work with changing or unknown Schemas. For those i'd like to generate an XML instance.
So, I don't know the class names and elemts at programming time. I wish, it would be
possible to write something like:
Schema schema = new Schema(fileName);
Iterator it = schema.getComponents();
while (it.hasNext())
{
Component c = getComponent();
// for the component and all it's childs
// generate xml-entry in result-file
// e.g. if xml-type is String:
// check length of the string from another source
// write <c.getName()>abcd</c.getName()>
}
Again, I can do that with generated and compiled sources for I know the name of
my root-element, but I'd like to integrate it in one program, that I can
deliver to the testers. They should generate their test XMLs as simple as
possible on their own.
Thanks for thinking about my problem and Happy Easter
uli
-----Ursprüngliche Nachricht-----
Von: Werner Guttmann [mailto:[EMAIL PROTECTED]
Gesendet: Do 13.04.2006 20:44
An: [email protected]
Cc:
Betreff: Re: [castor-user] Generating XML from Schema
Ulrich,
Is there any particular reason why you could not use the source
generator to generate Java classes from the XML Schema instance, and use
the generated object model to create the XML instance.
Regards
Werner
Ulrich Freyer-Hirtz wrote:
Hi,
for testing purposes we like to generate a xml Document from a given Schema and
fill them with special values depending on the schema.
With SchemaReader in could read in the Schema and here's my question:
How to generate a xml from that object ? With Castor or manual element for
element ?
How to set values and how to save in xml Format may be standard stuff of
Coastor..
Cheers
uli
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
------------------------------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------