XML File Problem

lefenzy

Senior member
Nov 30, 2004
231
4
81
I'm having trouble understanding the syntax of a .dtd file.

The problem is that I have a hotkeys.xml file that I've put some new entries in. It's a little long, but see after the break for what lines I put in.
Code:
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE Objects SYSTEM "hotkeys.dtd">

<Objects>

	<Object type="Atom">

		<Commands>

			<Command id="LABELTEXT" description="Sets the Label for the Atoms text"/>
			<Command id="SPROUT" description="Addition of Bonds to an Atom"/>
			<Command id="CHARGE" description="Changes the charge of an Atom"/>
			<Command id="FREE_SITE" description="Increment/Decrement Free Sites of an Atom"/>
			<Command id="UPTO_SITE" description="Increment/Decrement the UpTo number of substituents of an Atom"/>
			<Command id="EXACT_SITE" description="Increment/Decrement the number of substituents of an Atom"/>
			<Command id="ATOMNUMBER" description="Show/Hide the Atom Numbers"/>
			<Command id="ATTACHMENTPOINT" description="Sets the Value of the Attachment Point"/>

		</Commands>

		<Hotkeys>

			<Hotkey key="a" command="LABELTEXT" value="A" description="Atom Labeling"/>
			<Hotkey key="A" command="LABELTEXT" value="Ac" description="Atom Labeling"/>
			<Hotkey key="b" command="LABELTEXT" value="Br" description="Atom Labeling"/>
			<Hotkey key="B" command="LABELTEXT" value="B" description="Atom Labeling"/>
			<Hotkey key="c" command="LABELTEXT" value="C" description="Atom Labeling"/>
			<Hotkey key="C" command="LABELTEXT" value="Cl" description="Atom Labeling"/>
			<Hotkey key="d" command="LABELTEXT" value="D" description="Atom Labeling"/>
			<Hotkey key="e" command="LABELTEXT" value="Et" description="Atom Labeling"/>
			<Hotkey key="E" command="LABELTEXT" value="COOCH3" description="Atom Labeling"/>
			<Hotkey key="f" command="LABELTEXT" value="F" description="Atom Labeling"/>
			<Hotkey key="h" command="LABELTEXT" value="H" description="Atom Labeling"/>
			<Hotkey key="i" command="LABELTEXT" value="I" description="Atom Labeling"/>
			<Hotkey key="k" command="LABELTEXT" value="K" description="Atom Labeling"/>
			<Hotkey key="l" command="LABELTEXT" value="Cl" description="Atom Labeling"/>
			<Hotkey key="m" command="LABELTEXT" value="Me" description="Atom Labeling"/>
			<Hotkey key="n" command="LABELTEXT" value="N" description="Atom Labeling"/>
			<Hotkey key="N" command="LABELTEXT" value="Na" description="Atom Labeling"/>
			<Hotkey key="o" command="LABELTEXT" value="O" description="Atom Labeling"/>
			<Hotkey key="p" command="LABELTEXT" value="P" description="Atom Labeling"/>
			<Hotkey key="P" command="LABELTEXT" value="Ph" description="Atom Labeling"/>
			<Hotkey key="q" command="LABELTEXT" value="Q" description="Atom Labeling"/>
			<Hotkey key="r" command="LABELTEXT" value="R" description="Atom Labeling"/>
			<Hotkey key="s" command="LABELTEXT" value="S" description="Atom Labeling"/>
			<Hotkey key="S" command="LABELTEXT" value="Si" description="Atom Labeling"/>
			<Hotkey key="t" command="LABELTEXT" value="TMS" description="Atom Labeling"/>
			<Hotkey key="T" command="LABELTEXT" value="OTs" description="Atom Labeling"/>
			<Hotkey key="x" command="LABELTEXT" value="X" description="Atom Labeling"/>
			<Hotkey key="1" command="LABELTEXT" value="n-Bu" description="Atom Labeling"/>
			<Hotkey key="2" command="LABELTEXT" value="s-Bu" description="Atom Labeling"/>
			<Hotkey key="3" command="LABELTEXT" value="t-Bu" description="Atom Labeling"/>
			<Hotkey key="4" command="LABELTEXT" value="Ph" description="Atom Labeling"/>
			<Hotkey key="5" command="LABELTEXT" value="Ac" description="Atom Labeling"/>
			<Hotkey key="6" command="LABELTEXT" value="CH2OH" description="Atom Labeling"/>			
			<Hotkey key="!" command="LABELTEXT" value="?" description="Atom Labeling"/>

			<Hotkey key="8" command="SPROUT" value="3" description="Adds three bonds to the atom"/>
			<Hotkey key="9" command="SPROUT" value="2" description="Adds two bonds to the atom"/>
			<Hotkey key="0" command="SPROUT" value="1" description="Adds a bonds to the atom"/>			
			<Hotkey key=">" command="SPROUT" value="?" description="Adds bonds to the atom and new atom labels"/>

			<Hotkey key="." command="ATTACHMENTPOINT" value="True" description="Adds an attachment point"/>
			<Hotkey key="&apos;" command="ATOMNUMBER" value="True" description="Shows Atom Numbers"/>
			<Hotkey key="-" command="CHARGE" value="-" description="Decrement the charge of an atom"/>
			<Hotkey key="+" command="CHARGE" value="+" description="Increments the charge of an atom"/>

		</Hotkeys>

	</Object>

	<Object type="Bond">

		<Commands>

			<Command id="BONDORDER" description="Sets the Bond Order"/>
			<Command id="BONDDISPLAY" description="Sets the Bond Display"/>
			<Command id="BONDPOSITION" description="Sets the Position of Bonds"/>
			<Command id="BONDDOUBLEPOSITION" description="Sets the Alignment for Double Bonds"/>
			<Command id="FUSERING" description="Fuses a ring to a bond"/>

		</Commands>

		<Hotkeys>

			<Hotkey key="f" command="BONDPOSITION" value="FRONT" description="Displays the bond in the front"/>
			<Hotkey key="l" command="BONDDOUBLEPOSITION" value="LEFT" description="Align Double Bonds to the Left"/>
			<Hotkey key="r" command="BONDDOUBLEPOSITION" value="RIGHT" description="Align Double Bonds to the Right"/>
			<Hotkey key="c" command="BONDDOUBLEPOSITION" value="CENTER" description="Align Double Bonds Centered"/>
			<Hotkey key="1" command="BONDORDER" value="1" description="Set Bond to Single"/>
			<Hotkey key="2" command="BONDORDER" value="2" description="Set Bond to Double"/>
			<Hotkey key="3" command="BONDORDER" value="3" description="Set Bond to Triple"/>
			<Hotkey key="4" command="BONDORDER" value="4" description="Set Bond to Quadriple"/>
			<Hotkey key="5" command="FUSERING" value="5" description="Fuse 5 membered ring"/>
			<Hotkey key="6" command="FUSERING" value="6" description="Fuse 6 membered ring"/>
			<Hotkey key="7" command="FUSERING" value="7" description="Fuse 7 membered ring"/>
			<Hotkey key="8" command="FUSERING" value="8" description="Fuse 8 membered ring"/>
			<Hotkey key="9" command="FUSERING" value="9" description="Fuse chair cyclohexane"/>
			<Hotkey key="0" command="FUSERING" value="10" description="Fuse chair cyclohexane"/>
			<Hotkey key="d" command="BONDDISPLAY" value="DASHED" description="Display a Bond as Dashed"/>
			<Hotkey key="H" command="BONDDISPLAY" value="HASHED" description="Display a Bond as Hashed"/>
			<Hotkey key="h" command="BONDDISPLAY" value="HASHEDWEDGED" description="Display a Bond as HashWedged"/>
			<Hotkey key="b" command="BONDDISPLAY" value="BOLD" description="Display a Bond as Bold"/>
			<Hotkey key="w" command="BONDDISPLAY" value="WEDGED" description="Display a Bond as Wedged"/>
			<Hotkey key="y" command="BONDDISPLAY" value="WAVY" description="Display a Bond as Wavy"/>

		</Hotkeys>

	</Object>

	<Object type="Generic">

		<Commands>

			<Command id="DIALOG" description="Display a Dialog"/>
			<Command id="TOOLMODE" description="Changes the Current Tool"/>

		</Commands>

		<Hotkeys>
			<Hotkey key="a" command="TOOLMODE" value="TEXT" description="Text"/>            
			<Hotkey key="v" command="TOOLMODE" value="MARQUEE" description="select"/>
			<Hotkey key="r" command="TOOLMODE" value="ARROW" description="arrow"/>            
            <Hotkey key="e" command="TOOLMODE" value="ERASER" description="erase"/>            
            <Hotkey key="c" command="TOOLMODE" value="ACYCLICCHAIN" description="chain tool"/>
            <Hotkey key="1" command="TOOLMODE" value="SOLIDBOND" description="bond?"/>            
            <Hotkey key="3" command="TOOLMODE" value="CYCLOPROPANE" description="bond?"/>            
            <Hotkey key="5" command="TOOLMODE" value="CYCLOPENTANE" description="bond?"/>            
            <Hotkey key="%" command="TOOLMODE" value="CYCLOPENTADIENE" description="bond?"/>            
            <Hotkey key="^" command="TOOLMODE" value="BENZENE" description="bond?"/>            
            <Hotkey key="6" command="TOOLMODE" value="CYCLOHEXANE" description="bond?"/>            
            <Hotkey key="q" command="TOOLMODE" value="ARC" description="arc"/>
			<Hotkey key="=" command="DIALOG" value="CHOOSENICKNAME" description="Display a dialog to choose a Nickname"/>
			<Hotkey key="/" command="DIALOG" value="PROPERTIES" description="Displays the Properties Dialog"/>
			<Hotkey key="?" command="DIALOG" value="PROPERTIES" description="Displays the Properties Dialog"/>			
		</Hotkeys>

	</Object>


	<Object type="AA1">

		<Commands>

			<Command id="AA1" description="Sets the Label for the single letter Amino Acids"/>

		</Commands>

		<Hotkeys>
			<Hotkey key="a" command="AA1" value="A" description="Ala"/>
			<Hotkey key="r" command="AA1" value="R" description="Arg"/>
			<Hotkey key="n" command="AA1" value="N" description="Asn"/>
			<Hotkey key="d" command="AA1" value="D" description="Asp"/>
			<Hotkey key="b" command="AA1" value="B" description="Asx"/>
			<Hotkey key="c" command="AA1" value="C" description="Cys"/>
			<Hotkey key="q" command="AA1" value="Q" description="Gln"/>
			<Hotkey key="e" command="AA1" value="E" description="Glu"/>
			<Hotkey key="g" command="AA1" value="G" description="Gly"/>
			<Hotkey key="z" command="AA1" value="Z" description="Glx"/>
			<Hotkey key="h" command="AA1" value="H" description="His"/>
			<Hotkey key="i" command="AA1" value="I" description="Ile"/>
			<Hotkey key="l" command="AA1" value="L" description="Leu"/>
			<Hotkey key="k" command="AA1" value="K" description="Lys"/>
			<Hotkey key="m" command="AA1" value="M" description="Met"/>
			<Hotkey key="f" command="AA1" value="F" description="Phe"/>
			<Hotkey key="p" command="AA1" value="P" description="Pro"/>
			<Hotkey key="o" command="AA1" value="O" description="Pyl"/>
			<Hotkey key="s" command="AA1" value="S" description="Ser"/>
			<Hotkey key="t" command="AA1" value="T" description="Thr"/>
			<Hotkey key="u" command="AA1" value="U" description="Sec"/>
			<Hotkey key="w" command="AA1" value="W" description="Trp"/>
			<Hotkey key="y" command="AA1" value="Y" description="Tyr"/>
			<Hotkey key="v" command="AA1" value="V" description="Val"/>
			<Hotkey key="x" command="AA1" value="X" description="Xaa"/>
		</Hotkeys>

	</Object>

	<Object type="DNA">

		<Commands>
			<Command id="DNA" description="Sets the Label for the DNA sequence"/>

		</Commands>
		<Hotkeys>
			<Hotkey key="a" command="DNA" description="DNAA" value="A"/>
			<Hotkey key="c" command="DNA" description="DNAC" value="C"/>
			<Hotkey key="g" command="DNA" description="DNAG" value="G"/>
			<Hotkey key="t" command="DNA" description="DNAT" value="T"/>
			<Hotkey key="r" command="DNA" description="DNAA,DNAG" value="R"/>
			<Hotkey key="y" command="DNA" description="DNAC,DNAT" value="Y"/>
			<Hotkey key="s" command="DNA" description="DNAG,DNAC" value="S"/>
			<Hotkey key="w" command="DNA" description="DNAA,DNAT" value="W"/>
			<Hotkey key="k" command="DNA" description="DNAG,DNAT" value="K"/>
			<Hotkey key="m" command="DNA" description="DNAA,DNAC" value="M"/>
			<Hotkey key="b" command="DNA" description="DNAC,DNAG,DNAT" value="B"/>
			<Hotkey key="d" command="DNA" description="DNAA,DNAG,DNAT" value="D"/>
			<Hotkey key="h" command="DNA" description="DNAA,DNAC,DNAT" value="H"/>
			<Hotkey key="v" command="DNA" description="DNAT,DNAC,DNAG" value="V"/>
			<Hotkey key="n" command="DNA" description="DNAA,DNAC,DNAG,DNAT" value="N"/>
		</Hotkeys>

	</Object>

	<Object type="RNA">

		<Commands>

			<Command id="RNA" description="Sets the Label for the RNA sequence"/>

		</Commands>
		<Hotkeys>
			<Hotkey key="a" command="RNA" description="RNAA" value="A"/>
			<Hotkey key="c" command="RNA" description="RNAC" value="C"/>
			<Hotkey key="g" command="RNA" description="RNAG" value="G"/>
			<Hotkey key="u" command="RNA" description="RNAU" value="U"/>
			<Hotkey key="r" command="RNA" description="RNAA,RNAG" value="R"/>
			<Hotkey key="y" command="RNA" description="RNAC,RNAU" value="Y"/>
			<Hotkey key="s" command="RNA" description="RNAG,RNAC" value="S"/>
			<Hotkey key="w" command="RNA" description="RNAA,RNAU" value="W"/>
			<Hotkey key="k" command="RNA" description="RNAG,RNAU" value="K"/>
			<Hotkey key="m" command="RNA" description="RNAA,RNAC" value="M"/>
			<Hotkey key="b" command="RNA" description="RNAC,RNAG,RNAU" value="B"/>
			<Hotkey key="d" command="RNA" description="RNAA,RNAG,RNAU" value="D"/>
			<Hotkey key="h" command="RNA" description="RNAA,RNAC,RNAU" value="H"/>
			<Hotkey key="v" command="RNA" description="RNAU,RNAC,RNAG" value="V"/>
			<Hotkey key="n" command="RNA" description="RNAA,RNAC,RNAG,RNAU" value="N"/>
		</Hotkeys>

	</Object>

</Objects>

In particular, all that I did is under <Object type=Generic> -> <Hotkeys>. I've stuck in all the lines with command="TOOLMODE"

I was then disappointed to find out that none of these new hotkeys worked in the program, ChemDraw 13. So I double clicked the hotkeys.xml file, opened it in a browser, and noticed that my inserted lines didn't appear in the browser!

Hmm I said, that hotkeys.dtd file that's sitting in the same directory looks suspicious. So I open that up, and I see the following..

Code:
<!ELEMENT Command EMPTY> 
        <!ATTLIST Command id (BONDDISPLAY | BONDORDER | CHARGE | DIALOG |  LABELTEXT | FUSERING | AA1 | DNA | RNA) #REQUIRED description CDATA #REQUIRED > 
	<!ELEMENT Commands (Command+)> 
		<!ELEMENT Hotkey EMPTY> 
			<!ATTLIST Hotkey key CDATA #REQUIRED command (BONDDISPLAY | BONDORDER | CHARGE | DIALOG |  LABELTEXT | FUSERING | AA1 | DNA | RNA) #REQUIRED value CDATA #REQUIRED description CDATA #REQUIRED > 
		<!ELEMENT Hotkeys (Hotkey+)> 
	<!ELEMENT Object (Commands, Hotkeys)> 
		<!ATTLIST Object type (Atom | Bond | AA1 | DNA | RNA | Generic) #REQUIRED > 
<!ELEMENT Objects (Object+)>

Conspicuously absent was TOOLMODE, so I inserted that in two places:

Code:
<!ELEMENT Command EMPTY> 
        <!ATTLIST Command id (BONDDISPLAY | BONDORDER | CHARGE | DIALOG | TOOLMODE | LABELTEXT | FUSERING | AA1 | DNA | RNA) #REQUIRED description CDATA #REQUIRED > 
	<!ELEMENT Commands (Command+)> 
		<!ELEMENT Hotkey EMPTY> 
			<!ATTLIST Hotkey key CDATA #REQUIRED command (BONDDISPLAY | BONDORDER | CHARGE | DIALOG | TOOLMODE | LABELTEXT | FUSERING | AA1 | DNA | RNA) #REQUIRED value CDATA #REQUIRED description CDATA #REQUIRED > 
		<!ELEMENT Hotkeys (Hotkey+)> 
	<!ELEMENT Object (Commands, Hotkeys)> 
		<!ATTLIST Object type (Atom | Bond | AA1 | DNA | RNA | Generic) #REQUIRED > 
<!ELEMENT Objects (Object+)>

But no dice, they still don't show up in the browser.

I do feel that if I can change the .dtd file to display it in the browser, that hotkeys will then work in the program I am trying to use.

Any help parsing and modifying the .dtd file? I have no experience in web development, so I don't understand what's going on in that file.

Btw, the program is ChemDraw Pro (13).
 

lefenzy

Senior member
Nov 30, 2004
231
4
81
Another troubling thing I don't understand about the .xml is that I make changes, refresh chrome/internet explorer, and the changes don't show up. This is as simple as editing the description field, and nothing happens to the document! How does refreshing not change things?