From leon at stevens.org Fri Jun 3 22:50:54 2005 From: leon at stevens.org (Leon Stevens) Date: Fri, 3 Jun 2005 15:50:54 -0500 Subject: [XML-SIG] Excel (XML): how retrieve contents of cell Message-ID: <20050603205050.8BE35DB81@mf2.socket.net> 1. I'm comparatively new to Python, very new to XML 2. Running Python 2.3, with pyXML. 3. Using dom, and following example in "Python in a Nutshell", I've coded a successfully running parse of a worksheet. 4. How do I access the contents of a cell (say, C3) from the XML tree? The next question will then be to access the formula of that cell. I'm willing to read. What book(s)? Please, I need advice. Leon From tpherndon at optonline.net Sat Jun 4 00:49:35 2005 From: tpherndon at optonline.net (T. Peter Herndon) Date: Fri, 3 Jun 2005 18:49:35 -0400 Subject: [XML-SIG] Excel (XML): how retrieve contents of cell In-Reply-To: <20050603205050.8BE35DB81@mf2.socket.net> References: <20050603205050.8BE35DB81@mf2.socket.net> Message-ID: On Jun 3, 2005, at 4:50 PM, Leon Stevens wrote: > 1. I'm comparatively new to Python, very new to XML > 2. Running Python 2.3, with pyXML. > 3. Using dom, and following example in "Python in a Nutshell", I've > coded a > successfully running parse of a worksheet. > 4. How do I access the contents of a cell (say, C3) from the XML > tree? The > next question will then be to access the formula of that cell. > > I'm willing to read. What book(s)? > "Python Programming on Win32" by Hammond and Robinson, from O'Reilly. At least, if you don't need XML. Instead, use win32com automation to get the data directly from Excel. If using XML is a requirement, I defer to others' experience, but I think you might be using the wrong tool for the job. Also, I'd suggest Fredrik Lundh's ElementTree as a much friendlier XML toolkit. HTH, ---Peter Herndon From lace at jankratochvil.net Mon Jun 6 09:49:39 2005 From: lace at jankratochvil.net (Jan Kratochvil) Date: Mon, 6 Jun 2005 16:49:39 +0900 Subject: [XML-SIG] xbelnormalize: .xbel reformat for CVS sharing, diff(1)ing etc. Message-ID: <20050606074939.GA32148@kashome.dyn.jankratochvil.net> Hi, URL http://cvs.jankratochvil.net/viewcvs/*checkout*/nethome/bin/xbelnormalize?rev=HEAD for UNIX/Perl trivia xbelnormalize(1) to .xbel: * Reindent to a unified form. * Reencode to unified utf-8. * Strip any useless variable content (tested only with Galeon web browser). to prepare the file for convenient CVS commits/updates/CVS conflicts resolution. It is also possible to meaningfully diff(1) the resulting files (a requirement for CVS usage as a real versioning system). I did not found such simple and clear to use tool for .xbel, I did not find any tool for .xbel version management. Regards, Lace (not on the mailing list, if this address is a list) From stephane at sources.org Mon Jun 6 16:01:33 2005 From: stephane at sources.org (Stephane Bortzmeyer) Date: Mon, 6 Jun 2005 16:01:33 +0200 Subject: [XML-SIG] xbelnormalize: .xbel reformat for CVS sharing, diff(1)ing etc. In-Reply-To: <20050606074939.GA32148@kashome.dyn.jankratochvil.net> References: <20050606074939.GA32148@kashome.dyn.jankratochvil.net> Message-ID: <20050606140133.GA22799@sources.org> On Mon, Jun 06, 2005 at 04:49:39PM +0900, Jan Kratochvil wrote a message of 27 lines which said: > to prepare the file for convenient CVS commits/updates/CVS conflicts > resolution. > > It is also possible to meaningfully diff(1) the resulting files (a requirement > for CVS usage as a real versioning system). Another solution is to use a XML-aware diff such as xmldiff (http://www.logilab.org/projects/xmldiff). Some version control systems like Subversion (http://subversion.tigris.org/) can be told to use such a diff instead of their normal diff, thus making them able to process intelligently XML files. From lace at jankratochvil.net Mon Jun 6 16:15:26 2005 From: lace at jankratochvil.net (Jan Kratochvil) Date: Mon, 6 Jun 2005 23:15:26 +0900 Subject: [XML-SIG] xbelnormalize: .xbel reformat for CVS sharing, diff(1)ing etc. In-Reply-To: <20050606140133.GA22799@sources.org> References: <20050606074939.GA32148@kashome.dyn.jankratochvil.net> <20050606140133.GA22799@sources.org> Message-ID: <20050606141526.GA10463@kashome.dyn.jankratochvil.net> On Mon, 06 Jun 2005 23:01:33 +0900, Stephane Bortzmeyer wrote: ... > Another solution is to use a XML-aware diff such as xmldiff > (http://www.logilab.org/projects/xmldiff). Some version control > systems like Subversion (http://subversion.tigris.org/) can be told to > use such a diff instead of their normal diff, thus making them able to > process intelligently XML files. Thanks for info, in some cases it may be useful. It is still would not be IMO acceptable diffing of .xbel due the dynamic content (timestamps/folding/smth) which is not stipped out without xbelnormalize(1). And anyway I am still sticked with CVS as even subversion sucks... Regards, Lace From jontom at itasoftware.com Wed Jun 8 16:27:26 2005 From: jontom at itasoftware.com (JonTom Kittredge) Date: Wed, 8 Jun 2005 10:27:26 -0400 Subject: [XML-SIG] Using XML Namespaces in XPath Expressions from Python Message-ID: <17063.78.877780.443210@gargle.gargle.HOWL> I'm having trouble using PyXML to evaluate XPath expressions that include namespace references. Here is a sample Python snipped: #!/usr/bin/env pystart import sys import xml.dom.minidom from xml.xpath.Context import Context from xml.xpath import Evaluate from xml.xpath.NamespaceNode import NamespaceNode if __name__ == "__main__": sys.stderr.write("XPathTest: 18\n") inputDom = xml.dom.minidom.parse(open("xpathtest-input.xml")) sys.stderr.write("Node: %s\n" % (inputDom.documentElement)) outContext = Context(inputDom.documentElement) sys.stderr.write("NSes=%s\n" % (outContext.nss())) result = Evaluate("count(/dbq:Contract)", contextNode=inputDom.documentElement, context=outContext) sys.stderr.write("Eval xpath \"count(/dbq:Contract)\": %d\n" % result) Here is what xpathtest-input.xml looks like: Here is the output I get [xsl] zyp| xpathtest.py XPathTest: 18 Node: NSes={'xml': 'http://www.w3.org/XML/1998/namespace', u'dbq': u'http://dtd.itasoftware.com/Dubuque'} Traceback (most recent call last): File "xpathtest.py", line 22, in ? context=outContext) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/__init__.py", line 70, in Evaluate retval = parser.new().parse(expr).evaluate(con) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedExpr.py", line 179, in evaluate arg0 = self._arg0.evaluate(context) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedAbsoluteLocationPath.py", line 26, in evaluate rt = self._child.select(context) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedStep.py", line 32, in evaluate (node_set, reverse) = self._axis.select(context, self._nodeTest.match) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedAxisSpecifier.py", line 114, in select list(context.node.childNodes)) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedAxisSpecifier.py", line 112, in rt = filter(lambda node, test=nodeTest, context=context, pt=self.principalType: File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedNodeTest.py", line 168, in match self._prefix) xml.xpath.RuntimeException: Undefined namespace prefix: "dbq". exit status: 1 I can see from the output that the Context object I am passing to Evaluate() includes the DBQ namespace. But apparently that is not enough. Can anyone tell me what I am doing wrong? Yours, JonTom JT Kittredge ITA Software, Inc. Cambridge, Massachusetts From Uche.Ogbuji at fourthought.com Thu Jun 9 14:26:53 2005 From: Uche.Ogbuji at fourthought.com (Uche Ogbuji) Date: Thu, 09 Jun 2005 06:26:53 -0600 Subject: [XML-SIG] Using XML Namespaces in XPath Expressions from Python In-Reply-To: <17063.78.877780.443210@gargle.gargle.HOWL> References: <17063.78.877780.443210@gargle.gargle.HOWL> Message-ID: <1118320013.18729.163.camel@borgia> On Wed, 2005-06-08 at 10:27 -0400, JonTom Kittredge wrote: > I'm having trouble using PyXML to evaluate XPath expressions that > include namespace references. > > Here is a sample Python snipped: > > #!/usr/bin/env pystart > > import sys > import xml.dom.minidom > > from xml.xpath.Context import Context > from xml.xpath import Evaluate > from xml.xpath.NamespaceNode import NamespaceNode > > > if __name__ == "__main__": > sys.stderr.write("XPathTest: 18\n") > > inputDom = xml.dom.minidom.parse(open("xpathtest-input.xml")) > > sys.stderr.write("Node: %s\n" % (inputDom.documentElement)) > outContext = Context(inputDom.documentElement) Where are you passing in the NS mapping here? Did I miss a PyXML XPath update that defaults mappings to in-scope namespaces on the node passed in? > sys.stderr.write("NSes=%s\n" % (outContext.nss())) > > result = Evaluate("count(/dbq:Contract)", > contextNode=inputDom.documentElement, I think this line is your problem. It overrides the next (probably not sensible, which is why we reversed that priority in 4Suite ages ago). > context=outContext) -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://fourthought.com http://copia.ogbuji.net http://4Suite.org Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html XML Output with 4Suite & Amara - http://www.xml.com/pub/a/2005/04/20/py-xml.html Use XSLT to prepare XML for import into OpenOffice Calc - http://www.ibm.com/developerworks/xml/library/x-oocalc/ Schema standardization for top-down semantic transparency - http://www-128.ibm.com/developerworks/xml/library/x-think31.html From dreamingpython at 163.com Sun Jun 12 07:37:09 2005 From: dreamingpython at 163.com (ÒÊÃÉɽÈË) Date: Sun, 12 Jun 2005 13:37:09 +0800 Subject: [XML-SIG] can you tell me how to use stdin? Message-ID: In the PyXml module,there is an example like this: from xml.dom.ext.reader.Sax2 import FromXmlStream doc = FromXmlStream(sys.stdin) >From the example the argument of FromXmlStream is sys.stdin, but now i have a xml file namede "test.xml",how can i redirect the stdin to the file? For a long time,i have been confused about stdin , can you give me an example ? Thanks a bounch. From jontom at itasoftware.com Mon Jun 13 16:29:45 2005 From: jontom at itasoftware.com (JonTom Kittredge) Date: Mon, 13 Jun 2005 10:29:45 -0400 Subject: [XML-SIG] Using XML Namespaces in XPath Expressions from Python In-Reply-To: <1118320013.18729.163.camel@borgia> References: <17063.78.877780.443210@gargle.gargle.HOWL> <1118320013.18729.163.camel@borgia> Message-ID: <17069.39001.712729.906340@gargle.gargle.HOWL> Uche, Thanks for your response. My comments are below. On 2005-06-09 at 06:26, Uche Ogbuji wrote: > On Wed, 2005-06-08 at 10:27 -0400, JonTom Kittredge wrote: > > I'm having trouble using PyXML to evaluate XPath expressions that > > include namespace references. > > > > Here is a sample Python snipped: > > > > #!/usr/bin/env pystart > > > > import sys > > import xml.dom.minidom > > > > from xml.xpath.Context import Context > > from xml.xpath import Evaluate > > from xml.xpath.NamespaceNode import NamespaceNode > > > > > > if __name__ == "__main__": > > sys.stderr.write("XPathTest: 18\n") > > > > inputDom = xml.dom.minidom.parse(open("xpathtest-input.xml")) > > > > sys.stderr.write("Node: %s\n" % (inputDom.documentElement)) > > outContext = Context(inputDom.documentElement) > > Where are you passing in the NS mapping here? Did I miss a PyXML XPath > update that defaults mappings to in-scope namespaces on the node passed > in? That's the nub of my question. How do I pass namespace mappings into Evaluate()? The only thing I could see to try, from looking at the documentation, was to use the context argument. The Context object holds namespace objects, so I thought that that might be the way to pass in my definition. As you can see from the output, the Context I get from the document node already has the "dbq" namespace defined (since it appears in the input), before I call Evaluate(). However, it apparently gets reset during the call to Evaluate(). > > > sys.stderr.write("NSes=%s\n" % (outContext.nss())) > > > > result = Evaluate("count(/dbq:Contract)", > > contextNode=inputDom.documentElement, > > I think this line is your problem. It overrides the next (probably not > sensible, which is why we reversed that priority in 4Suite ages ago). > > > context=outContext) > OK. If I leave out that line and instead do the following: result = Evaluate("count(/dbq:Contract)", contextNode=inputDom.documentElement) I still get the following error: Node: Traceback (most recent call last): File "xpathtest-1.py", line 20, in ? contextNode=inputDom.documentElement) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/__init__.py", line 70, in Evaluate retval = parser.new().parse(expr).evaluate(con) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedExpr.py", line 179, in evaluate arg0 = self._arg0.evaluate(context) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedAbsoluteLocationPath.py", line 26, in evaluate rt = self._child.select(context) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedStep.py", line 32, in evaluate (node_set, reverse) = self._axis.select(context, self._nodeTest.match) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedAxisSpecifier.py", line 114, in select list(context.node.childNodes)) File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedAxisSpecifier.py", line 112, in rt = filter(lambda node, test=nodeTest, context=context, pt=self.principalType: File "/ita/python-2.2.2/lib/python2.2/site-packages/_xmlplus/xpath/ParsedNodeTest.py", line 168, in match self._prefix) xml.xpath.RuntimeException: Undefined namespace prefix: "dbq". Which me leaves my initial question: how do I use xml.xpath.Evaluate() on an XPath expression that refers to namespaces? > > -- > Uche Ogbuji Fourthought, Inc. > http://uche.ogbuji.net http://fourthought.com > http://copia.ogbuji.net http://4Suite.org > Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html > XML Output with 4Suite & Amara - http://www.xml.com/pub/a/2005/04/20/py-xml.html > Use XSLT to prepare XML for import into OpenOffice Calc - http://www.ibm.com/developerworks/xml/library/x-oocalc/ > Schema standardization for top-down semantic transparency - http://www-128.ibm.com/developerworks/xml/library/x-think31.html For completeness, here is my Python: import sys import traceback import xml.dom.minidom from xml.xpath.Context import Context from xml.xpath import Evaluate from xml.xpath.NamespaceNode import NamespaceNode sys.stderr.write("XPathTest: 1\n") inputDom = xml.dom.minidom.parse(open("xpathtest-input.xml")) sys.stderr.write("Node: %s\n" % (inputDom.documentElement)) result = Evaluate("count(/dbq:Contract)", contextNode=inputDom.documentElement) sys.stderr.write("Eval xpath \"count(/dbq:Contract)\": %d\n" % result) and here is my input: Yours, JonTom JT Kittredge ITA Software, Inc. Cambridge, Massachusetts From Uche.Ogbuji at fourthought.com Mon Jun 13 17:29:08 2005 From: Uche.Ogbuji at fourthought.com (Uche Ogbuji) Date: Mon, 13 Jun 2005 09:29:08 -0600 Subject: [XML-SIG] can you tell me how to use stdin? In-Reply-To: References: Message-ID: <1118676548.26958.33.camel@borgia> On Sun, 2005-06-12 at 13:37 +0800, ???????? wrote: > In the PyXml module,there is an example like this: > > from xml.dom.ext.reader.Sax2 import FromXmlStream > doc = FromXmlStream(sys.stdin) > >From the example the argument of FromXmlStream is sys.stdin, > but now i have a xml file namede "test.xml",how can i redirect the > stdin to the file? > > For a long time,i have been confused about stdin , can you give me > an example ? Thanks a bounch. Use xml.dom.minidom. Do not use xml.dom.ext.reader.*. dom = minidom.parse("test.xml") -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://fourthought.com http://copia.ogbuji.net http://4Suite.org Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html XML Output with 4Suite & Amara - http://www.xml.com/pub/a/2005/04/20/py-xml.html Use XSLT to prepare XML for import into OpenOffice Calc - http://www.ibm.com/developerworks/xml/library/x-oocalc/ Schema standardization for top-down semantic transparency - http://www-128.ibm.com/developerworks/xml/library/x-think31.html From uche.ogbuji at fourthought.com Mon Jun 13 17:33:26 2005 From: uche.ogbuji at fourthought.com (Uche Ogbuji) Date: Mon, 13 Jun 2005 09:33:26 -0600 Subject: [XML-SIG] Using XML Namespaces in XPath Expressions from Python In-Reply-To: <17069.39001.712729.906340@gargle.gargle.HOWL> References: <17063.78.877780.443210@gargle.gargle.HOWL> <1118320013.18729.163.camel@borgia> <17069.39001.712729.906340@gargle.gargle.HOWL> Message-ID: <1118676807.26958.38.camel@borgia> On Mon, 2005-06-13 at 10:29 -0400, JonTom Kittredge wrote: > Uche, Thanks for your response. My comments are below. > On 2005-06-09 at 06:26, Uche Ogbuji wrote: > > On Wed, 2005-06-08 at 10:27 -0400, JonTom Kittredge wrote: > > > I'm having trouble using PyXML to evaluate XPath expressions that > > > include namespace references. > > > > > > Here is a sample Python snipped: > > > > > > #!/usr/bin/env pystart > > > > > > import sys > > > import xml.dom.minidom > > > > > > from xml.xpath.Context import Context > > > from xml.xpath import Evaluate > > > from xml.xpath.NamespaceNode import NamespaceNode > > > > > > > > > if __name__ == "__main__": > > > sys.stderr.write("XPathTest: 18\n") > > > > > > inputDom = xml.dom.minidom.parse(open("xpathtest-input.xml")) > > > > > > sys.stderr.write("Node: %s\n" % (inputDom.documentElement)) > > > outContext = Context(inputDom.documentElement) > > > > Where are you passing in the NS mapping here? Did I miss a PyXML XPath > > update that defaults mappings to in-scope namespaces on the node passed > > in? > > That's the nub of my question. How do I pass namespace mappings into > Evaluate()? outContext = Context(inputDom.documentElement, processorNss={u'dbq': DBQNS}) > The only thing I could see to try, from looking at the documentation, > was to use the context argument. The Context object holds namespace > objects, so I thought that that might be the way to pass in my > definition. Yes, but you have to give it the namespace defs, as above. > As you can see from the output, the Context I get from the document > node already has the "dbq" namespace defined (since it appears in the > input), before I call Evaluate(). However, it apparently gets reset > during the call to Evaluate(). That's what's confusing me. I'm not sure why it automatically has that namespace at any point. Anyway, see if my suggestion helps. -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://fourthought.com http://copia.ogbuji.net http://4Suite.org Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html XML Output with 4Suite & Amara - http://www.xml.com/pub/a/2005/04/20/py-xml.html Use XSLT to prepare XML for import into OpenOffice Calc - http://www.ibm.com/developerworks/xml/library/x-oocalc/ Schema standardization for top-down semantic transparency - http://www-128.ibm.com/developerworks/xml/library/x-think31.html From swiftset at gmail.com Mon Jun 13 17:36:18 2005 From: swiftset at gmail.com (Alex Gittens) Date: Mon, 13 Jun 2005 08:36:18 -0700 Subject: [XML-SIG] not following DTDs Message-ID: I'm using SAX to load XBEL files, and I noticed that when my computer is not connected to the Internet, the script fails with an error about not being able to find the DTD that is referenced in the file. Is there some way to turn off searching for the DTD? Thanks, Alex -- ChapterZero: http://tangentspace.net/cz/ From uche.ogbuji at fourthought.com Tue Jun 14 16:08:12 2005 From: uche.ogbuji at fourthought.com (Uche Ogbuji) Date: Tue, 14 Jun 2005 08:08:12 -0600 Subject: [XML-SIG] ANN: Amara XML Toolkit 1.0b3 Message-ID: <1118758093.428.71.camel@borgia> ANN: Amara XML Toolkit 1.0b3 http://uche.ogbuji.net/tech/4Suite/amara ftp://ftp.4suite.org/pub/Amara/ Changes in this release: * Add xml_set_attribute method to elements, in order to allow adding attributes with namespaces or with illegal Python names * Update manual source for markdown, and extensive improvements to the manual (with much help from Jamie Norrish) * Add xml_doc facility for nodes [1] * Fix support for output parameters in xml() * Add support for rules to pushbind * Improve XSLT support for bindery objects (see demo/bindery/xslt.py) * Bug fixes [1] http://lists.fourthought.com/pipermail/4suite/2005-June/013671.html Amara XML Toolkit is a collection of Python tools for XML processing-- not just tools that happen to be written in Python, but tools built from the ground up to use Python idioms and take advantage of the many advantages of Python. Amara builds on 4Suite [http://4Suite.org], but whereas 4Suite focuses more on literal implementation of XML standards in Python, Amara focuses on Pythonic idiom. It provides tools you can trust to conform with XML standards without losing the familiar Python feel. The components of Amara are: * Bindery: data binding tool (a very Pythonic XML API) * Scimitar: implementation of the ISO Schematron schema language for XML; converts Schematron files to Python scripts * domtools: set of tools to augment Python DOMs * saxtools: set of tools to make SAX easier to use in Python * Flextyper: user-defined datatypes in Python for XML processing There's a lot in Amara, but here are highlights: Amara Bindery: XML as easy as py -------------------------------- Bindery turns an XML document into a tree of Python objects corresponding to the vocabulary used in the XML document, for maximum clarity. For example, the document What do you mean "bleh" But I was looking for argument Becomes a data structure such that you can write binding.monty.python.spam In order to get the value "eggs" or binding.monty.python[1] In order to get the value "But I was looking for argument". There are other such tools for Python, and what makes Anobind unique is that it's driven by a very declarative rules-based system for binding XML to the Python data. You can register rules that are triggered by XPattern expressions specialized binding behavior. It includes XPath support and supports mutation. Bindery is very efficient, using SAX to generate bindings. Scimitar: Schematron for Pytthon -------------------------------- Merged in from a separate project, Scimitar is an implementation of ISO Schematron that compiles a Schematron schema into a Python validator script. You typically use scimitar in two phases. Say you have a schematron schema schema1.stron and you want to validate multiple XML files against it, instance1.xml, instance2.xml, instance3.xml. First you run schema1.stron through the scimitar compiler script, scimitar.py: scimitar.py schema1.stron The generated file, schema1.py, can be used to validate XML instances: python schema1.py instance1.xml Which emits a validation report. Amara DOM Tools: giving DOM a more Pythonic face ------------------------------------------------ DOM came from the Java world, hardly the most Pythonic API possible. Some DOM-like implementations such as 4Suite's Domlettes mix in some Pythonic idiom. Amara DOM Tools goes even further. Amara DOM Tools feature pushdom, similar to xml.dom.pulldom, but easier to use. It also includes Python generator-based tools for DOM processing, and a function to return an XPath location for any DOM node. Amara SAX Tools: SAX without the brain explosion ------------------------------------------------ Tenorsax (amara.saxtools.tenorsax) is a framework for "linerarizing" SAX logic so that it flows more naturally, and needs a lot less state machine wizardry. License ------- Amara is open source, provided under the 4Suite variant of the Apache license. See the file COPYING for details. Installation ------------ Amara requires Python 2.3 or more recent and 4Suite 1.0b1 or more recent. Make sure these are installed, unpack Amara to a convenient location and run python setup.py install -- Uche Ogbuji Fourthought, Inc. http://uche.ogbuji.net http://fourthought.com http://copia.ogbuji.net http://4Suite.org Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html XML Output with 4Suite & Amara - http://www.xml.com/pub/a/2005/04/20/py-xml.html Use XSLT to prepare XML for import into OpenOffice Calc - http://www.ibm.com/developerworks/xml/library/x-oocalc/ Schema standardization for top-down semantic transparency - http://www-128.ibm.com/developerworks/xml/library/x-think31.html From jontom at itasoftware.com Tue Jun 14 18:29:11 2005 From: jontom at itasoftware.com (JonTom Kittredge) Date: Tue, 14 Jun 2005 12:29:11 -0400 Subject: [XML-SIG] Using XML Namespaces in XPath Expressions from Python In-Reply-To: <1118676807.26958.38.camel@borgia> References: <17063.78.877780.443210@gargle.gargle.HOWL> <1118320013.18729.163.camel@borgia> <17069.39001.712729.906340@gargle.gargle.HOWL> <1118676807.26958.38.camel@borgia> Message-ID: <17071.1495.185843.313780@gargle.gargle.HOWL> Uche, I have it working now. Thanks for your help! Yours, JonTom JT Kittredge ITA Software, Inc. Cambridge, Massachusetts On 2005-06-13 at 09:33, Uche Ogbuji wrote: > On Mon, 2005-06-13 at 10:29 -0400, JonTom Kittredge wrote: > > Uche, Thanks for your response. My comments are below. > > > On 2005-06-09 at 06:26, Uche Ogbuji wrote: > > > On Wed, 2005-06-08 at 10:27 -0400, JonTom Kittredge wrote: > > > > I'm having trouble using PyXML to evaluate XPath expressions that > > > > include namespace references. > > > > > > > > Here is a sample Python snipped: > > > > > > > > #!/usr/bin/env pystart > > > > > > > > import sys > > > > import xml.dom.minidom > > > > > > > > from xml.xpath.Context import Context > > > > from xml.xpath import Evaluate > > > > from xml.xpath.NamespaceNode import NamespaceNode > > > > > > > > > > > > if __name__ == "__main__": > > > > sys.stderr.write("XPathTest: 18\n") > > > > > > > > inputDom = xml.dom.minidom.parse(open("xpathtest-input.xml")) > > > > > > > > sys.stderr.write("Node: %s\n" % (inputDom.documentElement)) > > > > outContext = Context(inputDom.documentElement) > > > > > > Where are you passing in the NS mapping here? Did I miss a PyXML XPath > > > update that defaults mappings to in-scope namespaces on the node passed > > > in? > > > > That's the nub of my question. How do I pass namespace mappings into > > Evaluate()? > > outContext = Context(inputDom.documentElement, processorNss={u'dbq': > DBQNS}) > > > The only thing I could see to try, from looking at the documentation, > > was to use the context argument. The Context object holds namespace > > objects, so I thought that that might be the way to pass in my > > definition. > > Yes, but you have to give it the namespace defs, as above. > > > As you can see from the output, the Context I get from the document > > node already has the "dbq" namespace defined (since it appears in the > > input), before I call Evaluate(). However, it apparently gets reset > > during the call to Evaluate(). > > That's what's confusing me. I'm not sure why it automatically has that > namespace at any point. Anyway, see if my suggestion helps. > > > -- > Uche Ogbuji Fourthought, Inc. > http://uche.ogbuji.net http://fourthought.com > http://copia.ogbuji.net http://4Suite.org > Use CSS to display XML, part 2 - http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html > XML Output with 4Suite & Amara - http://www.xml.com/pub/a/2005/04/20/py-xml.html > Use XSLT to prepare XML for import into OpenOffice Calc - http://www.ibm.com/developerworks/xml/library/x-oocalc/ > Schema standardization for top-down semantic transparency - http://www-128.ibm.com/developerworks/xml/library/x-think31.html From dieter at handshake.de Tue Jun 14 19:14:39 2005 From: dieter at handshake.de (Dieter Maurer) Date: Tue, 14 Jun 2005 19:14:39 +0200 Subject: [XML-SIG] not following DTDs In-Reply-To: References: Message-ID: <17071.4223.533711.666196@gargle.gargle.HOWL> Alex Gittens wrote at 2005-6-13 08:36 -0700: >I'm using SAX to load XBEL files, and I noticed that when my computer >is not connected to the Internet, the script fails with an error about >not being able to find the DTD that is referenced in the file. Is >there some way to turn off searching for the DTD? from xml.sax.handler import feature_external_ges from xml.sax import make_parser parser= make_parser(); parser.setDTDHandler(None) parser.setFeature(feature_external_ges,0) -- Dieter From faassen at infrae.com Wed Jun 15 19:05:55 2005 From: faassen at infrae.com (Martijn Faassen) Date: Wed, 15 Jun 2005 19:05:55 +0200 Subject: [XML-SIG] lxml 0.7 released! Message-ID: <42B05FF3.4000701@infrae.com> Hey everybody, I've just released lxml 0.7. lxml is a Pythonic wrapper for libxml2 and libxslt. It aims at ease of use of the API for Python programmers and exposing the many libxml2 features. lxml implements the Python ElementTree API on top of libxml2. It extends this with support for XPath, XSLT, Relax NG, XML schema and more. lxml 0.7 is a release with quite a few new features and bug fixes, including XPath expression parameters, XInclude support, XMLSchema validation support, more namespace prefix support, better encoding support, and more. More information plus download can be found here: http://codespeak.net/lxml/ Regards, Martijn From urschel at midsouth.rr.com Fri Jun 17 20:02:45 2005 From: urschel at midsouth.rr.com (Danielle Urschel) Date: Fri, 17 Jun 2005 13:02:45 -0500 Subject: [XML-SIG] XBEL and hyperlink tagging Message-ID: <200506171758.j5HHwmYG006534@ms-smtp-03-eri0.ohiordc.rr.com> I'd like to get in touch with anyone from the XBEL group who has an interest in hyperlink tagging. I am chronically frustrated with managing my bookmarks and have tried hundreds, I'm sure, of solutions. Recently I tried del.icio.us and subsequently started reading a lot of blog banter about hyperlink tagging. After years of wishing for the right solution, I've decided to see if I can actually contribute something to a solution. I believe xml-based tags are the answer to managing link collections, and XBEL is a fine format, so I'm wondering if it can be expanded to accommodate a standard hyperlink tag. I'm including both a graphical and outline version of a brainstorm document I started last night. It's very rough and just the beginning of an idea. My goal is an open-source, standard hyperlink tag solution that is highly accessible to software developers, amateur coders and web site owners whose primary expertise is not programming. If no one in your group has any interest in this, I would greatly appreciate any input or advice anyone would share. I have no idea how things like standard tag formats are born. Thanks. Danielle Urschel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/xml-sig/attachments/20050617/e9021ca1/attachment-0001.htm -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: HyperlinkTaggingOutline.txt Url: http://mail.python.org/pipermail/xml-sig/attachments/20050617/e9021ca1/HyperlinkTaggingOutline-0001.txt -------------- next part -------------- A non-text attachment was scrubbed... Name: HyperlinkTaggingMap.pdf Type: application/pdf Size: 31809 bytes Desc: not available Url : http://mail.python.org/pipermail/xml-sig/attachments/20050617/e9021ca1/HyperlinkTaggingMap-0001.pdf From noreply at sourceforge.net Mon Jun 20 21:35:53 2005 From: noreply at sourceforge.net (SourceForge.net) Date: Mon, 20 Jun 2005 12:35:53 -0700 Subject: [XML-SIG] [ pyxml-Bugs-1224359 ] PyXML-0.8.4 won't compile in x86_64 Linux Message-ID: Bugs item #1224359, was opened at 2005-06-20 19:35 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=106473&aid=1224359&group_id=6473 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: drdreff (drdreff) Assigned to: Nobody/Anonymous (nobody) Summary: PyXML-0.8.4 won't compile in x86_64 Linux Initial Comment: Output: $ python setup.py build running build running build_py running build_ext building '_xmlplus.parsers.pyexpat' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -pipe -Wall -g -fPIC -DXML_NS=1 -DXML_DTD=1 -DBYTEORDER=1234 -DXML_CONTEXT_BYTES=1024 -Iextensions/expat/lib -I/usr/include/python2.4 -c extensions/expat/lib/xmlparse.c -o build/temp.linux-x86_64-2.4/extensions/expat/lib/xmlparse.o extensions/expat/lib/xmlparse.c:75:2: #error memmove does not exist on this platform, nor is a substitute available error: command 'gcc' failed with exit status 1 System Info: $ cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 15 model : 12 model name : AMD Athlon(tm) 64 Processor 3200+ stepping : 0 cpu MHz : 2200.162 cache size : 512 KB fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 pni syscall nx mmxext lm 3dnowext 3dnow bogomips : 4325.37 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: ts fid vid ttp $ cat /proc/version Linux version 2.6.11-6mdk (gb at kolmogorov.mandrakesoft.com) (gcc version 3.4.3 (Mandrakelinux 10.2 3.4.3-6mdk)) #1 Tue Mar 22 10:20:32 EST 2005 $ gcc -v Reading specs from /usr/lib/gcc/x86_64-mandrake-linux-gnu/3.4.3/specs Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --with-slibdir=/lib64 --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-__cxa_atexit --enable-clocale=gnu --disable-libunwind-exceptions --enable-languages=c,c++,ada,f77,objc,java --host=x86_64-mandrake-linux-gnu --with-system-zlib Thread model: posix gcc version 3.4.3 (Mandrakelinux 10.2 3.4.3-7mdk) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=106473&aid=1224359&group_id=6473 From info at resalsoftware.com Thu Jun 23 10:47:51 2005 From: info at resalsoftware.com (Luciano Lucente) Date: Thu, 23 Jun 2005 10:47:51 +0200 Subject: [XML-SIG] Errore su installazione librerie PyXML Message-ID: UntitledInstalling PyXML-0.8.2.tar.gz root at serverlinux:~# python -c "import xml.dom" Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.3/site-packages/_xmlplus/dom/__init__.py", line 237, in ? import MessageSource File "/usr/lib/python2.3/site-packages/_xmlplus/dom/MessageSource.py", line 22, in ? gettext.install('4Suite', locale_dir) File "/usr/lib/python2.3/gettext.py", line 428, in install translation(domain, localedir, fallback=True).install(unicode) File "/usr/lib/python2.3/gettext.py", line 416, in translation t = _translations.setdefault(key, class_(open(mofile, 'rb'))) File "/usr/lib/python2.3/gettext.py", line 176, in __init__ self._parse(fp) File "/usr/lib/python2.3/gettext.py", line 304, in _parse tmsg = unicode(tmsg, self._charset) LookupError: unknown encoding: CHARSET Caratteristiche tecniche: -Slackware 10.1 -Zope 2.8.0 Distinti saluti Resal Software Pescara -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/xml-sig/attachments/20050623/757d5284/attachment.htm From mike at skew.org Thu Jun 23 11:10:00 2005 From: mike at skew.org (Mike Brown) Date: Thu, 23 Jun 2005 03:10:00 -0600 (MDT) Subject: [XML-SIG] Errore su installazione librerie PyXML In-Reply-To: Message-ID: <200506230910.j5N9A0vT019117@chilled.skew.org> Luciano Lucente wrote: > UntitledInstalling PyXML-0.8.2.tar.gz Why are you using such an old version of PyXML? 0.8.2 dates back to January 2003. > LookupError: unknown encoding: CHARSET This was fixed in PyXML 0.8.3, released July 2003. Please use the current version of PyXML, 0.8.4, released in November 2004. From junkc at fh-trier.de Thu Jun 30 14:56:37 2005 From: junkc at fh-trier.de (Christian Junk) Date: Thu, 30 Jun 2005 14:56:37 +0200 Subject: [XML-SIG] XBEL and hyperlink tagging In-Reply-To: <200506171758.j5HHwmYG006534@ms-smtp-03-eri0.ohiordc.rr.com> References: <200506171758.j5HHwmYG006534@ms-smtp-03-eri0.ohiordc.rr.com> Message-ID: <200506301456.37833.junkc@fh-trier.de> Hi, Danielle! It's nice to see, that there are some people out there who still want to work on a standardised way to store and share hyperlinks. But the XBEL format isn't ready to the job! Months ago I proposed to resume the work on XBEL and perhaps make it a independent project. But at that time there wasn't enough interest. We should dare! Regards, Christian P.S.: Perhaps you like to take a look at the xml-sig archive to find the old discussion (dec 04 and jan 05) ... -- Christian Junk FH Trier, University of Applied Sciences Faculty of Design and Applied Computer Science http://christianjunk.webinternals.de http://xbel.webinternals.de From gvwilson at cs.utoronto.ca Thu Jun 30 18:19:14 2005 From: gvwilson at cs.utoronto.ca (Greg Wilson) Date: Thu, 30 Jun 2005 12:19:14 -0400 Subject: [XML-SIG] losing entities when parsing then texting Message-ID: This one must have come up several times before, but neither Google nor the Cookbook have given me an answer. I'm doing this: data = sys.stdin.read() doc = xml.dom.minidom.parseString(data) root = doc.documentElement ...add and modify some nodes... sys.stdout.write(root.toxml('utf-8')) A typical input looks like this: blah blah & blah blah&emdash;blah and my DTD, in its entirety, is: Problem is, all of the character entities are missing from my output: & and &emdash; disappear. Hunting around the web, it appears that I'm supposed to mess with ExternalEntityRefHandler, but I can't find any examples of how the pieces fit together. If anyone has one, I'd be grateful for a pointer... Thanks, Greg (gvwilson _a_t_ cs _dot_ utoronto _dot_ ca)