[XML-SIG] Win32 and 4DOM
uche.ogbuji@fourthought.com
uche.ogbuji@fourthought.com
Thu, 30 Mar 2000 11:34:37 -0700
To elaborate on Lars's explanation, you seem to have neither PyExpat or
xmlproc XML parsers in your PYTHONPATH. It's falling back to xmllib which is
getting confused. I'll add a to-do list item to wrap a better exception in
such cases.
--Uche
> At the command prompt:
> C:\Program Files\Python\Ft\Dom\demo>python dom_from_xml_file.py
> addr_book1.xml
> SAXException caught: No parsers found
> Traceback (innermost last):
> File "dom_from_xml_file.py", line 20, in ?
> read_xml_from_file(sys.argv[1])
> File "dom_from_xml_file.py", line 13, in read_xml_from_file
> Ext.Print(xml_dom_object)
> NameError: xml_dom_object
>
> In the command-line Python interpreter:
> >>> from Ft.Dom import Ext
> >>> from Ft.Dom.Ext.Reader import Sax
> >>> dom = Sax.FromXmlFile("Ft\\dom\\demo\\addr_book1.xml")
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> File "Ft\Dom\Ext\Reader\Sax.py", line 155, in FromXmlFile
> rv =
> FromXmlStream(fp,ownerDocument,validate,keepAllWs,catName,saxHandlerClass)
> File "Ft\Dom\Ext\Reader\Sax.py", line 135, in FromXmlStream
> parser.parseFile(stream)
> File "C:\Program Files\Python\xml\sax\drivers\pylibs.py", line 32, in
> parseFile
> self.feed(buf)
> File "C:\Program Files\Python\xml\sax\drivers\drv_xmllib.py", line 68, in
> feed
> xmllib.XMLParser.feed(self,data)
> File "C:\Program Files\Python\Lib\xmllib.py", line 149, in feed
> self.goahead(0)
> File "C:\Program Files\Python\Lib\xmllib.py", line 240, in goahead
> k = self.parse_starttag(i)
> File "C:\Program Files\Python\Lib\xmllib.py", line 609, in parse_starttag
> self.finish_starttag(nstag, attrdict, method)
> File "C:\Program Files\Python\Lib\xmllib.py", line 646, in finish_starttag
> self.unknown_starttag(tagname, attrdict)
> File "C:\Program Files\Python\xml\sax\drivers\drv_xmllib.py", line 24, in
> unknown_starttag
> self.doc_handler.startElement(tag,saxutils.AttributeMap(attributes))
> File "Ft\Dom\Ext\Reader\Sax.py", line 71, in startElement
> self.__completeTextNode()
> File "Ft\Dom\Ext\Reader\Sax.py", line 51, in __completeTextNode
> self.__nodeStack[-1].appendChild(new_text)
> File "Ft\Dom\Document.py", line 223, in appendChild
> return Node.appendChild(self,newChild)
> File "Ft\Dom\Node.py", line 225, in appendChild
> self._4dom_validateNode(newChild)
> File "Ft\Dom\Node.py", line 300, in _4dom_validateNode
> raise DOMException(HIERARCHY_REQUEST_ERR)
> Ft.Dom.DOMException
>
> What is it I'm doing wrong? I'm using Python 1.5.2 and 4DOM 0.9.3.
>
> Thankful for any suggestions,
>
> Ludvig Svenonius
>
>
> _______________________________________________
> XML-SIG maillist - XML-SIG@python.org
> http://www.python.org/mailman/listinfo/xml-sig
>