[kepler-dev] NamedObj.exportMoML() now always generates the Header

Christopher Brooks cxh at eecs.berkeley.edu
Tue Feb 28 10:47:10 PST 2006


Hi Edward,

Your change:

2006-02-21 20:47  eal
	* ptolemy/kernel/util/NamedObj.java: Generate XML header even if
	the top-level is not an entity.

breaks a number of tests, which I'll go ahead and fix.

For example, kernel/test/Relation.tcl fails with:

==== Relation-16.0 Test exportMoML
==== Contents of test case:

    $r1 exportMoML

==== Result was:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE relation PUBLIC "-//UC Berkeley//DTD MoML 1//EN"
    "http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd">
<relation name="my relation" class="ptolemy.kernel.Relation">
</relation>

---- Result should have been:
<relation name="my relation" class="ptolemy.kernel.Relation">
</relation>


The diff of your change is below:

cxh at carson 93% cvs diff -r 1.311 -r1.312 NamedObj.java
Index: NamedObj.java
===================================================================
RCS file: /home/cvs/ptII/ptolemy/kernel/util/NamedObj.java,v
retrieving revision 1.311
retrieving revision 1.312
diff -r1.311 -r1.312
121c121
<  @version $Id: NamedObj.java,v 1.311 2006/02/16 13:34:43 cxh Exp $
---
>  @version $Id: NamedObj.java,v 1.312 2006/02/22 04:47:16 eal Exp $
810a811,812
>      *  In the above, "entity" may be replaced by "property" or "port"
>      *  if somehow a top-level property or port is exported.
846,852c848,859
<             if (_elementName.equals("entity")) {
<                 output.write("<?xml version=\"1.0\" standalone=\"no\"?>\n"
<                         + "<!DOCTYPE " + _elementName + " PUBLIC "
<                         + "\"-//UC Berkeley//DTD MoML 1//EN\"\n"
<                         + "    \"http://ptolemy.eecs.berkeley.edu"
<                         + "/xml/dtd/MoML_1.dtd\">\n");
<             }
---
>             // NOTE: Used to generate this only if the top-level
>             // was an entity, with the following test:
>             // if (_elementName.equals("entity")) {}
>             // However, this meant that when saving icons,
>             // they would not have the header information,
>             // and when opened, would open as a text file
>             // instead of in the icon editor.
>             output.write("<?xml version=\"1.0\" standalone=\"no\"?>\n"
>                     + "<!DOCTYPE " + _elementName + " PUBLIC "
>                     + "\"-//UC Berkeley//DTD MoML 1//EN\"\n"
>                     + "    \"http://ptolemy.eecs.berkeley.edu"
>                     + "/xml/dtd/MoML_1.dtd\">\n");
cxh at carson 94% 

I just wanted to make sure that we knew why the tests started failing.

_Christopher


More information about the Kepler-dev mailing list