User 953c0d67b0
27-02-2006 20:22:05
Why would Molecule::getDocument() return null????
The following code demonstrates what's happening.
Strange that when given the FIRST xml example, getDocument() returns null.
But it doesn't with the second xml example (only difference...I added a
Rectangle to the drawing!!!). [ in Marvin, I just drew a Carbon Atom,
and CH4 appeared as usual. Just drew a rectangle around that for the
second XML]
public void test(String xmlString) {
System.out.println(xmlString); // looks good
MolImporter importer = new MolImporter();
Molecule aMolecule = importer.importMol(xmlString);
System.out.println(aMolecule.getAtomCount()); // prints "1"
// all seems well up to this point!
MDocument mDoc = aMolecule.getDocument();
if (mDoc == null)
System.out.println("MDocument is empty!!!!");
// mDoc is NULL with first xml given below, is NOT NULL with 2nd!
}
THIS IS THE XML GIVEN TO THE METHOD: (getDocument() returns NULL)
<?xml version="1.0" encoding="Cp1252" ?>
<MDocument>
<MChemicalStruct>
<molecule molID="m1">
<atomArray
atomID="a1"
elementType="C"
x2="-5.483333110809326"
y2="0.46666666865348816"
/>
<bondArray>
</bondArray>
</molecule>
</MChemicalStruct>
</MDocument>
XML2: getDocument() does NOT return NULL
<?xml version="1.0" encoding="Cp1252" ?>
<MDocument>
<MChemicalStruct>
<molecule molID="m1">
<atomArray
atomID="a1"
elementType="C"
x2="-5.483333110809326"
y2="0.46666666865348816"
/>
<bondArray>
</bondArray>
</molecule>
</MChemicalStruct>
<MRectangle>
<MPoint x="-7.233333110809326" y="1.8666666746139526" />
<MPoint x="-3.2666666507720947" y="1.8666666746139526" />
<MPoint x="-3.2666666507720947" y="-1.1083333492279053" />
<MPoint x="-7.233333110809326" y="-1.1083333492279053" />
</MRectangle>
</MDocument>
The following code demonstrates what's happening.
Strange that when given the FIRST xml example, getDocument() returns null.
But it doesn't with the second xml example (only difference...I added a
Rectangle to the drawing!!!). [ in Marvin, I just drew a Carbon Atom,
and CH4 appeared as usual. Just drew a rectangle around that for the
second XML]
public void test(String xmlString) {
System.out.println(xmlString); // looks good
MolImporter importer = new MolImporter();
Molecule aMolecule = importer.importMol(xmlString);
System.out.println(aMolecule.getAtomCount()); // prints "1"
// all seems well up to this point!
MDocument mDoc = aMolecule.getDocument();
if (mDoc == null)
System.out.println("MDocument is empty!!!!");
// mDoc is NULL with first xml given below, is NOT NULL with 2nd!
}
THIS IS THE XML GIVEN TO THE METHOD: (getDocument() returns NULL)
<?xml version="1.0" encoding="Cp1252" ?>
<MDocument>
<MChemicalStruct>
<molecule molID="m1">
<atomArray
atomID="a1"
elementType="C"
x2="-5.483333110809326"
y2="0.46666666865348816"
/>
<bondArray>
</bondArray>
</molecule>
</MChemicalStruct>
</MDocument>
XML2: getDocument() does NOT return NULL
<?xml version="1.0" encoding="Cp1252" ?>
<MDocument>
<MChemicalStruct>
<molecule molID="m1">
<atomArray
atomID="a1"
elementType="C"
x2="-5.483333110809326"
y2="0.46666666865348816"
/>
<bondArray>
</bondArray>
</molecule>
</MChemicalStruct>
<MRectangle>
<MPoint x="-7.233333110809326" y="1.8666666746139526" />
<MPoint x="-3.2666666507720947" y="1.8666666746139526" />
<MPoint x="-3.2666666507720947" y="-1.1083333492279053" />
<MPoint x="-7.233333110809326" y="-1.1083333492279053" />
</MRectangle>
</MDocument>