Marvin XML documentation

User 953c0d67b0

08-11-2005 22:06:50

Hello, this is my first post on the forums, so I guess I should "intro".





I'm a grad student at the Univ. of Kentucky, working with Grossman


and Finkel as a software developer.





I am trying to find detailed documentation on Marvin XML Document


formats. So far all I've found is:


http://www.chemaxon.com/marvin/doc/user/mrv-doc.html





which only gives basic information. In particular, I need to know


more about the <MTextBox> and <MPoint> tags. The only information


on the above document is:





<MTextBox> - text object


<MPoint> - represents a location in space





(not real helpful for a beginner!!)





Can someone point me to more detailed documentation?? I'll be doing


alot more with XML/CML in the near future.





Thanks,


Kevin

ChemAxon 7c2d26e5cf

09-11-2005 15:19:01

Which information do you need exactly? What would you like to do?

User 953c0d67b0

09-11-2005 23:30:02

I'm writing a program that produces an XML document.





By drawing in Marvin Sketch and looking at the XML source, I've


been able to create a little of my own documentation (enough for now).





but for example, for a text box, the referenced document only has:





<MTextBox> - a text box





and that's all...no other description . By playing with Marvin, I've


discovered how to actually make one!!





<MTextBox>


<Field name="text"> + </Field>


<MPoint x="9.5" y="9.70000057220459" />


<MPoint x="10.5" y="9.70000057220459" />


<MPoint x="10.5" y="8.70000057220459" />


<MPoint x="9.5" y="8.70000057220459" />


</MTextBox>





But this syntax isn't in the document...my original question was


"is there more detailed documentation on XML that would have shown


me how to do the above" instead of discovering it. Such a document


would help me understand the "capabilities" of XML, and might give


me ideas on better ways to do things other than what I can discover


by playing.





I'm OK for now though, but if such a document exists, I would


appreciate seeing it!!





Thanks,


Kevin





PS: I've also seen something like [CDATA * *] in the <field>


container, but am very unsure about that.

ChemAxon 7c2d26e5cf

10-11-2005 16:16:36

The Marvin Document format is under documented since we did not expect anyone would like to modify the source code manually.


<MTextBox> supports the following tags:


<Field name="text">The text </Field> - Text field.


<MPoint x="x1" y="y1" [z="z1"] /> - Top left corner.


<MPoint x="x2" y="y2" [z="z2"] /> - Top right corner.


<MPoint x="x3" y="y3" [z="z3"] /> - Bottom right corner.


<MPoint x="x4" y="y4" [z="z4"] /> - Bottom left corner.





If you want to type multiple lines you have embed it in a [CDATA[]]


Code:
<Field name="text"><![CDATA[This is the first line,


and that's the second one.]]></Field>

User 953c0d67b0

10-11-2005 22:59:29

THANKS! One last question: is there a way to set the COLOR of


the text in a TextBox??





Kevin

ChemAxon 7c2d26e5cf

11-11-2005 09:50:52

Yes, you can do it.


Select the textbox then take a right click to display its popup menu. Choose "Graphics properties" from the popup menu. On the displaying panel, you can set the text color.





In MRV format, the color is stored in the color attribute of <MTextBox>:


Code:
<MTextBox color="#ff0033">

User 953c0d67b0

12-11-2005 02:31:24

OK thanks...two more questions:





QUESTION 1:


I have the following:





<MTextBox>


<Field name="text"> * </Field>


etc.





The asterisk is supposed to look like a Lone Electron near an atom,


but it just looks like an asterisk. Is there anyway to put a bullet


there (ex: a unicode character, like a bullet \u2202)??





QUESTION 2:


I see Marvin's XML has <Molecule> </Molecule> container within


the <MChemicalStruct></MChemicalStruct> container. It seems to


imply that a ChemStruct may contain more than one Molecule container.





However, I am unable to get MarvinSketch to produce more than


one <Molecule> (by drawing more than one molecule on the screen).


It lumps all atoms on the screen into one <Molecule> container.





I tried manually adding a second molecule container (in edit/Source).


It imported without error, but Marvin seemed to ignore it. When I


did (edit/Source) again, the second <Molecule> was gone.





Does Marvin EVER produce or recognize more than one <Molecule>


container? If so, under what conditions?





Kevin





P.S. I am using Marvin at:


http://www.chemaxon.com/test/marvin/doc/dev/example-sketch1.1.html

ChemAxon 7c2d26e5cf

14-11-2005 14:52:57

1. Marvin can not display bullet character (\u2202) in text box. I am afraid you can not do this in current Marvin.





2. It seems that I have to explain the molecule hierarchy.


MarvinSketch can display only an MDocument (<MDocument>).


In an <MDocument>, chemical structures are defined between <MChemicalStruct> and </MChemicalStruct> tags. These structures will be handled together in Marvin.


The <molecule> tags contains the descriptions of the chemical structures.


Normally, <MChemicalStruct> includes only one <molecule> tag.


Code:
<?xml version="1.0" encoding="UTF-8" ?>


<MDocument>


  <MChemicalStruct>


    <molecule molID="m1">


    ...


    </molecule>


  </MChemicalStruct>


</MDocument>



But a molecule can contains R-groups whose definition is also stored at the same place. In this case, the R-group definition is defined in a separate <molecule> tag in the same <MChemicalStruct>. By the way, S-groups are also stored in separate <molecule> tags.


Code:
<?xml version="1.0" encoding="UTF-8" ?>


<MDocument>


  <MChemicalStruct>


    <molecule molID="m1">


      ...


    </molecule>


    <Rgroup rgroupID="1">


      <molecule molID="m2">


      ...


      </molecule>


    </Rgroup>


  </MChemicalStruct>


</MDocument>






If you try to load an MRV file in MarvinSketch that contains more than one <MDocument>, MarvinSketch will ask you which molecule you would like to load in.


To create an MRV file with multiple structures, save your new structure into an existing MRV file. Marvin will ask if you would like to append the new molecule to the end of the MRV file.





I don't think that hacking the MRV source is the best way to insert a new fragment into a molecule. I think you should use the Molecule API to do it:


Cgraph.fuse(Cgraph)


Code:
Molecule m1 = ...;


Molecule m2 = ...;


m1.fuse(m2)



The fuse method delete the structure from m2 and append it to m1.

User 953c0d67b0

14-11-2005 21:45:21

OK, thanks for the advice. The two questions asked applied to two


different projects I'm working on. In the first, I am WRITING an


XML document to be read by Marvin. In the second, I'm READING/


interpreting XML produced by Marvin [I'm not modifying XML then


giving it back to Marvin in either case].





I just wanted to make sure that (assuming no R- or S- groups) that


there is only one <Molecule> container within <MChemicalStruct>...


and you answered that!





Thanks again! (No new question)





Kevin

User 870ab5b546

15-11-2005 00:29:52

Tamas wrote:
1. Marvin can not display bullet character (\u2202) in text box. I am afraid you can not do this in current Marvin.


Hi Tamas,





That's not quite true. I can type a bullet character • in a textbox (option-8 on the Mac), and it appears just fine. But if I look at the source and then import it, it changes the bullet to a double-quote (").





Is there any reason why Marvin changes • to "? I can't think of any good reason for it. If not, please change it!





-- Bob

ChemAxon 7c2d26e5cf

15-11-2005 16:40:10

It is a character encoding problem at a non-standard (non-ASCII) character. When you see "?", it means that your operating system does not know that character. Your system and Java use different character encoding. Conversion of non-ASCII characters between different character sets are always problematical.


We have managed to solve this problem at file reading but it seems this problem still exists at MVR import from the Source window.





The attached file is "Cp1250" encoded (the default character set of Windows).


If you open it with Marvin, in Windows, the non-ASCII characters should be shown fine.


But this file will be displayed wrong in Linux because the default character set is differ on that platform.

User ef5e605ae6

18-11-2005 15:39:15

bobgr wrote:



That's not quite true. I can type a bullet character • in a textbox (option-8 on the Mac), and it appears just fine. But if I look at the source and then import it, it changes the bullet to a double-quote (").
.





I fixed this bug.


I also changed MRV import and export to use plain text only in the text box definition. \uXXXX unicode escapes are recognized and non-ASCII characters are always exported this way, thus the document's "encoding" attribute became superfluous (I hope).

User 953c0d67b0

15-12-2005 20:04:11

cspeter,





Would you explain the syntax of the "bugfix" you mention here?


I am simply trying to get a "bullet" to appear in Marvin. I tried:





<MTextBox>


<Field name="text"> • </Field>


<MPoint x="10.050000190734863" y="3.0" />


<MPoint x="12.050000190734863" y="3.0" />


<MPoint x="12.050000190734863" y="1.0" />


<MPoint x="10.050000190734863" y="1.0" />


</MTextBox>





(When I typed this note, there was a simple round bullet before </Field>,


not sure how it will display when you read this!!!)





When I import, it is displaying part of the XML on the marvin screen


as text...viewing the source gives:





<MTextBox>


<Field name="text"><![CDATA[ </Field>


<MPoint x=]]></Field>


<MPoint x="9.75" y="3.0" />


<MPoint x="11.75" y="3.0" />


<MPoint x="11.75" y="1.0" />


<MPoint x="9.75" y="1.0" />


</MTextBox>





Next I tried replacing the bullet with the unicode representation


you mentioned:


<MTextBox>


<Field name="text"> \u2022 </Field>


<MPoint x="10.050000190734863" y="3.0" />


<MPoint x="12.050000190734863" y="3.0" />


<MPoint x="12.050000190734863" y="1.0" />


<MPoint x="10.050000190734863" y="1.0" />


</MTextBox>





Here it just displays a "\" in marvin; when I view source I get:





<MTextBox>


<Field name="text"><![CDATA[\]]></Field>


<MPoint x="10.050000190734863" y="3.0" />


<MPoint x="12.050000190734863" y="3.0" />


<MPoint x="12.050000190734863" y="1.0" />


<MPoint x="10.050000190734863" y="1.0" />


</MTextBox>





EXACTLY what should put between <Field> </Field> to get Marvin


to display a bullet? (unicode 2022).





Thanks,


Kevin





P.S.


I am using Marvin at:


http://www.chemaxon.com/demosite/marvin/index.html





this version has the "latest and greatest" of Marvin, right???

User ef5e605ae6

16-12-2005 16:20:35

Kevin,





You should write \u2022 for the bullet. Unfortunately you cannot try it on the demo site because it contains Marvin 4.0.3. It was released before the bugfix.





Tamas! Please build a beta and put it on the demo site.





Peter

User 953c0d67b0

16-12-2005 16:51:39

Sounds great....one more question on this topic. Marvin Sketch will


recognized the \u2022 in the XML, but will the function to convert


XML to JPEG/PNG also recognize it? The XML my program produces


is being sent to the Image Converter.





Thanks,


Kevin

ChemAxon 7c2d26e5cf

17-12-2005 04:44:21

I have built a pre-release (4.0.4pre2). It is available from here:


http://www.chemaxon.com/test/marvin

User ef5e605ae6

19-12-2005 12:51:24

Yes, this new feature is documented, see the MTextBox section in http://www.chemaxon.com/test/marvin/doc/user/mrv-doc.html . All chemaxon programs that import MRV will recognize the unicode escapes in the text box contents.