Jos van den Oever wrote:
Yes, Pete, I think you're right. The initial time is the limiting factor.
1x: 2.1 secs
10x: 2.2 secs
100x: 3.5 secs
1000x: 5.8 secs
10000x: 24 secs
This initial is probably mostly initialization other then loading. The
program was run from eclipse which means the classes are already
mostly in memory. In addition I did all these test after each other.
But in toto, the overhead is not too bad and the initial time estimate
(counting) was exaggerated. Apparently, I can count quickly.

  

Even though you are in Eclipse does it not start a new JVM to run your program in? This new JVM then has to load all the classes you are using (and normal JVM startup isn't instant anyway).

Try adding a call to schema.testEclipseXSD() before your loop (and before the line "long j = ...") to cause the classes and other initialisation to happen before you  start timing.

Pete

Used code:
		long j = System.currentTimeMillis();
		for (int i=0; i<1; ++i) {
			schema.testEclipseXSD();
		}
		System.out.println(System.currentTimeMillis()-j);


On 6/24/05, Pete Hendry <[EMAIL PROTECTED]> wrote:
  
Startup time I would suggest with all the classes to load. Try putting
it in a loop and timing the last loop iteration only.

Pete

Bob Foster wrote:

    
Four seconds seems like a long time to make and save an 8-line schema.

Bob Foster


Jos van den Oever wrote:

      
Thanks for the tip, Nikhil.

I've managed to create a tiny XSD Schema with this standalone code:

    public void testEclipseXSD() {
        //Create the root XSDSchema object
        XSDSchema xsd = XSDFactory.eINSTANCE.createXSDSchema();
        xsd.setTargetNamespace("myNS");
        xsd.setSchemaForSchemaQNamePrefix("xsd");
        java.util.Map qNamePrefixToNamespaceMap = xsd
                .getQNamePrefixToNamespaceMap();

qNamePrefixToNamespaceMap.put(xsd.getSchemaForSchemaQNamePrefix(),
                XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);

        // add an element
        XSDComplexTypeDefinition complexType = XSDFactory.eINSTANCE
                .createXSDComplexTypeDefinition();
        complexType.setName("myElement");

complexType.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
        XSDSimpleTypeDefinition anonSimpleType = XSDFactory.eINSTANCE
                .createXSDSimpleTypeDefinition();
        complexType.setBaseTypeDefinition(xsd
                .resolveSimpleTypeDefinition("myParent"));
        complexType.setContent(anonSimpleType);
        xsd.getContents().add(complexType);
        xsd.updateElement();
        dom = xsd.getDocument();
        serialize(new OutputStreamWriter(System.out));
    }

The result of which is this:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="whatever" xmlns:Q1="whatever"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:complexType name="tst">
        <xsd:simpleContent>
            <xsd:extension base="Q1:parent"/>
        </xsd:simpleContent>
    </xsd:complexType>
</xsd:schema>

It's important to note that to get this to work you need to download a
complete archive from http://www.eclipse.org/xsd and put these jar
files in your classpath:
xsd_2.1.0.jar
emf.ecore_2.1.0.jar
emf.common_2.1.0.jar
which totals to about 1.5 Mb.

Running this function takes about 4 seconds in eclipse on a 2.6GHz
machine.

Cheers, Jos



On 6/23/05, Nikhil Dinesh <[EMAIL PROTECTED]> wrote:

        
Jos van den Oever wrote:


          
On Thursday 23 June 2005 18:38, Nikhil Dinesh wrote:



            
You might want to check the eclipse xsd apidocs at:

http://download.eclipse.org/tools/emf/xsd/2.1.0/javadoc/

I "think" it gives you the functionality you want.
-Nikhil


              
Hi Nikhil,

That looks nice, but can you use it standalone?
I have trouble creating a Schema instance.

Cheers, Jos


            
Hi Jos,

This, I'm not sure about having never used it. From past discussions on
the group, it
does seem possible (you might want to search for previous postings on
eclipse xsd), and
if memory serves there is considerable overlap between the xerces-j and
eclipse xsd developers, so
it might be best to wait until one of them responds...also Ive noticed
that messages with eclipse xsd
in the subject receive a flurry of responses, so you might consider
reposting ;).
          
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

      
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


    

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to