[great-users] Reading XML file using Code Generator

Daniel Balasubramanian daniel at isis.vanderbilt.edu
Sat Apr 19 00:55:02 CDT 2008


Hi Brian,

How are you reading in the XML file?  Are you using some 3rd party library like xerces?  The error message that you said you are getting makes it sound like the code generator can't find the schema, or that it's using the wrong version of the schema.  Verify that the schema is in the path or correct directory so that the executable you got from the code generator can find it.  If you can't get it working, I'll be in ISIS on Monday and we can take a look at it together.

Hope this helps,
Daniel


-----Original Message-----
From: great-users-bounces at list.isis.vanderbilt.edu on behalf of Partridge, Brian R
Sent: Fri 4/18/2008 12:36 PM
To: great-users
Subject: [great-users] Reading XML file using Code Generator
 
Does anyone have any idea how to get the GReAT Code Generator to read the tags of a XML file? The GR engine works just fine, but when using the Code Generator I get the following error: 

Error during parsing: 'myXMLFile.xml'. Exception message is: 
Error at file 'C:\myXMLFile.xml', 
line 2, column 126. Message: Unknown element 'interfaceList'

I am working on adding data from an XML file to GME model using GReAT. The XML file was exported from a Excel spreadsheet so it is of the form:

<interfaceList> 
        <interface> 
                <name> 
                        A model name 
                </name> 
                <attribute> 
                          A model attribute 
                </attribute> 
        </interface> 
<interfaceList> 

Of course I made this XML file ready for GReAT-use by translating it into this form: 
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
<interfaceList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance> " xsi:noNamespaceSchemaLocation="MyXMLSchema.xsd"> 
        <interface name="A model  name" attribute="A model attribute" /> 
</interfaceList> 

Where "MyXMLSchema.xsd" is the name of the package that models the XML data in my UMLModelTransformer. 
I have my transform working pretty well, and am able to run it without error using the GR engine. However, I would like to run this transform using the Code Generator because it is "10 to 100X faster" than the GR engine. When I do this, my XML file cannot be read. Again, the GR engine reads the file just fine, but running it using Code Generator results in the Unkown element 'interafaceList' error.

I was getting this very same error when I was using the GRE engine, but changing the opening tag from:

<interfaceList>

to 

<interfaceList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MyXMLSchema.xsd"> 

solved this problem.  The error I get when using the Code Generator seems to indicate that I should modify this opening tag so that the file can be read. Any ideas would be appreciated.

Thanks,

Brian Partridge 
Intern 




More information about the great-users mailing list