|
From: peter murray-r. <pm...@ca...> - 2006-03-11 11:04:00
|
At 12:55 09/03/2006, Tobias Helmus wrote:
>CMLBuilder builder = new CMLBuilder();
>CMLElement cmlElement = null;
>try {
> cmlElement = (CMLElement)builder.parseString(localResourceString);
>} catch (IOException e) {
> e.printStackTrace();
> setParsed(false);
> return false;
>}
I am baffled at present. I took your code - it is now in
org.xmlcml.cml.element.test.Standalone.main
and reads:
String localResourceString =
"" +
"<cml:molecule" +
" xmlns:cml='http://www.xml-cml.org/schema'" +
// " xsi:schemaLocation='http://www.xml-cml.org/schema
../../schema.xsd'" +
// " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+
" >" +
" <cml:atomArray atomID='a1 a2 a3 a4' " +
" elementType='C C O O' formalCharge='0 0 0 0' />" +
" <cml:bondArray atomRef1='a1 a2 a2' atomRef2='a2 a3 a4'" +
" order='1 2 1' />" +
"</cml:molecule>"+
"";
CMLBuilder builder = new CMLBuilder();
// builder.setParsed(false);
CMLElement cmlElement = null;
try {
cmlElement =
(CMLElement)builder.parseString(localResourceString);
} catch (Exception e) {
e.printStackTrace();
// return false;
}
cmlElement.debug();
I now ran this from a DOS window (completely outside Eclipse, etc.) ,
with a new classpath:
C:\Documents and Settings\pmr>echo %classpath%
C:\pmr\jumbo51\bin;C:\pmr\jumbo51\lib\xom-1.1b2.jar
and the command:
C:\Documents and Settings\pmr>java org.xmlcml.cml.element.test.Standalone 1
and got the output:
<?xml version="1.0" encoding="UTF-8"?>
<molecule xmlns="http://www.xml-cml.org/schema"
xmlns:cml="http://www.xml-cml.or
g/schema">
<atomArray atomID="a1 a2 a3 a4" elementType="C C O O"
formalCharge="0 0 0 0"/>
<bondArray atomRef1="a1 a2 a2" atomRef2="a2 a3 a4" order="1 2 1"/>
</molecule>
which is what is expected. Can you make sure you do not have anything
strange in the classpath?
P.
Peter Murray-Rust
Unilever Centre for Molecular Sciences Informatics
University of Cambridge,
Lensfield Road, Cambridge CB2 1EW, UK
+44-1223-763069
|