[Kalzium] Problems with elements.xml

Henry de Valence hdevalence at gmail.com
Fri May 8 05:28:57 CEST 2009


I'm working on a little personal project (basically, a printed periodic table 
of the elements on some large A size, like A1 or A2) that involves the use of 
data on chemical elements. 

However when I try to use the XML file in either python, using pyxml, or in 
ruby, using xmlsimple, I get errors. 
When I try this python script:

import sys
from xml.dom.ext.reader import Sax2
from xml.dom.ext import *

reader = Sax2.Reader()
inputfile = open("elements.xml")
doc = reader.fromStream( inputfile )

PrettyPrint( doc, sys.stdout )

I get an "xml.dom.NamespaceErr: Invalid or illegal namespace operation", and 
when I try this ruby script:

require 'rubygems'
require 'xmlsimple'
data = XmlSimple.xml_in( 'elements.xml', { 'KeyAttr' => 'name' } ) #line 5
print data

I get this output: http://pastebin.ca/1415981

Also, running xmllint --valid gives:
elements.xml:15: validity error : Validation failed: no DTD found !
                     http://bibtexml.sf.net/       ../schemas/bibtexml.xsd"

Is this a problem with the XML file itself or am I just doing something wrong?

Thanks in advance,
Henry de Valence


More information about the Kalzium mailing list