"""
Er, do you mean to generate a Relax NG (or possibly a DTD in fact) from
some XML file??
If you do mean this then just think of that how you could generate
grammar from some paragraphs of English text... Sorta non-trivial, if
possible at all, isn't it? :-)
"""
Very well put. However, for REL
"""
Er, do you mean to generate a Relax NG (or possibly a DTD in fact) from
some XML file??
If you do mean this then just think of that how you could generate
grammar from some paragraphs of English text... Sorta non-trivial, if
possible at all, isn't it? :-)
"""
Very well put. However, for REL
might want to be more specific.
What sort of output do you want from this discovery?
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.
arbitrary element I would know:
1) whether the element was in a document
2) where to find it (the chain of parents)
"""
This is easy to do in SAX. For some hints, see page 2 of my article:
http://www.xml.com/pub/a/2004/11/24/py-xml.html
--
Uche Ogbuji
oin([n.nodeName for n in e.xml_xpath(u'ancestor::*')])
paths.add(u'/' + path)
#Pretty-print output
for name in elems:
print name, '\n\t\t\t', '\n\t\t\t'.join(elems[name])
--
Uche Ogbuji Fourthought, Inc.
http://uche.
operworks/xml/library/x-xmptron/
It's XSLT rather than Python, but the good news is that XSLT is easy to
invoke from Python using tools such as 4Suite.
http://uche.ogbuji.net/tech/akara/nodes/2003-01-01/python-xslt
--
Uche Ogbuji Fourthought, Inc.
http://uche.og
(http://saxon.sourceforge.net/dtdgen.html), though as the original it
has several limitations on the accuracy of the inferred DTD. "
Ah. Cool. Got a link?
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://four
cument or
element object. Many short examples here:
http://copia.ogbuji.net/blog/2005-09-21/Dare_s_XLI
excerpt:
Adding a element as a child of the element'
contacts.xml_append_fragment('%s'%'206-555-0168'
http://uche.ogbuji.net/tech/4suite/amara
--
Uche Ogbuji
"How do I add a new attribute to the existing xml Document tree??? "
what do you mean by "using pyxml"? There are several pyxml modules.
Do you mean minidom? If so that comes with stock Python as well (hint:
element_node.setAttributeNS(ns, qnam
u have initial impressions based on that. If you have specific
outstanding questions, do ask. If not, I would just take a chance on
whatever your present leaning may be.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
writer.xmlFragment method to stitch
the inner subtrees to the outer shell. MarkupWriter operates in
streaming mode, so you would not be holding much XML in memory at all.
http://www.xml.com/pub/a/2005/04/20/py-xml.html
--
Uche Ogbuji Fourthought, Inc.
http:/
ou want to try a recent CVS
version, grab the snapshot:
ftp://ftp.fourthought.com/pub/cvs-snapshots/BisonGen-CVS.tar.gz (.zip
also available).
Also, you might want to ask BGen questions on the 4Suite mailing list,
where other BGen developers hang out.
http://lists.fourthought.com/pipermail/4sui
But as an alias, rather than a replacement for the current import.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.ne
l2/Python
lxml
generateDS.py
Good luck.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/
--
http://mail.pyth
"And80": "Is [the xml.xpath module] still part of the standard
library?"
Alan Kennedy: "No, it's not. Not sure if it ever was. "
It never was.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://four
=637355&group_id=6473&atid=106473
Different symptom, but also looks like a case of namespace ignorant
code.
Can anyone who's worked on minidom more recently let me know if I'm
just blind to something?
--
Uche Ogbuji Fourthought, Inc.
h
L documents that
aren't well-formed w.r.t. namespaces, I think.)
"""
Oh no. That only means that namespace declaration attributes are not
created in the DOM data structure. However, output has to fix up
namespaces in .namespaceURI properties as well as directly asserted
"
diosyncracies.
Andrew, for this reason I probably take the initiative to work up a
patch for the issue. I'll do what I can to get to it tomorrow. If you
help me with code review and maybe writing some tests, that would be a
huge help.
--
Uche Ogbuji
with you.
It's currently a bug. It needs to be fixed. However, I have no time
for this bewildering fight. If the consensus is to leave minidom the
way it is, I'll just wash my hands of the matter, but I'll be sure to
emphasize heavily to users that minidom is broken with res
ompleted their work until they also do:
element.setAttributeNS(xml.dom.XMLNS_NAMESPACE, None, "DAV:")
I'd love to hear how many actual minidom users would agree with you.
"""
Of course (FWIW) I meant
element.setAttributeNS(xml.dom.XMLNS_NAMESPACE, "xmlns", &
wildering, not XML namespaces (well, they
are confusing, but I have a good handle on all the nuances by now).
Again, no skin off my back here: I write and use tools that are XML
namespaces compliant. It doesn't hurt me that Minidom is not. I was
hoping to help, but again I
ere an option to make it
include namespaces?
"""
Getting back to the OP:
PyXML's xml.dom.ext.Print does get things right, and based on
discussion in this thread, the only way you can serialize correctly is
to use that add-on with minidom, or to
Sounds like generateDS is closest to what you want:
http://www.rexx.com/~dkuhlman/generateDS.html
If you can bind from instances only and don't need schema, see Amara
Bindery:
http://uche.ogbuji.net/tech/4Suite/amara/
Also consider Gnosis Utilities and ElementTree.
--
Uche O
Interesting discussion. My own thoughts:
http://www.oreillynet.com/pub/wlg/6224
http://www.oreillynet.com/pub/wlg/6225
Meanwhile, please don't make the mistake of bothering with XQuery.
It's despicable crap. And a huge impedance mismatch with Python.
--Uche
--
http://mail.python.org/mailman/l
#x27;s a stretch to call it a bug. You
problem is that you're mixing namespaced documents with the
non-namespace DOM API. That means trouble and such odd quirks every
time.
Use getAttributeNS, createElementNS, setAttributeNS, etc. rather than
getAttribute, createElement, setAttribute, etc.
d has its own instance, there are no state clashes.
Therefore, you should be creating at least one processor object per
thread.
Note: the 4Suite server is a multi-threaded architecture that uses
4XSLT heavily using processor-per-thread.
--
Uche OgbujiFourthought
Just for completeness I wanted to mention that yes, you can use 4Suite
to parse WSDL and get method signature information, but I do agree that
it's better to do this at a higher level, if you can. WHy reinvent
that wheel?
SOAPpy has a decent WSDL class.
--
Uche O
to
do this?
--
Uche OgbujiFourthought, Inc.
http://uche.ogbuji.nethttp://4Suite.orghttp://fourthought.com
Use CSS to display XML -
http://www.ibm.com/developerworks/edu/x-dw-x-xmlcss-i.html
Introducing the Amara XML Toolkit -
http://www.xml.com/pub/a/
Patrick Maupin wrote:
"""
Dennis Bieber wrote:
> Off hand, I'd consider the non-binary nature to be because the
> internet protocols are mostly designed for text, not binary.
A document at http://www.w3.org/TR/REC-xml/ lists "the design goals for
XML".
One of the listed goals is "XML documents sh
"I was wondering about the differences with the referred libs and
servers.
Since the documentation isn't so thorough(and a bit because of my
laziness), I thought I'd make request for usage accounts etc. stating
the pros and cons of the aforementioned. Any notes would be
appreciated."
RDFLib is a t
"I'm looking for a library that can search through an XML document
tree,
locate an element by attribute (ideally this can be done through
XPath), and insert an element (as its child).
Simple? Yes? ...but the code I've seen so far which does this uses
'nested for loops' for trees which are relative
"I am looking for an xml-object mapping tool ('XML Data Binding-design
time product') where I can define the mapping rules in 'binding files'
and the parser is generated automatically.
Similar to the solution of Dave Kuhlman
(http://www.rexx.com/~dkuhlman/ generateDS.html) where the mapping is
def
or existing object models"))
Answered:
http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/a63d0ad3fd23cb37/6ad0223c5b8f9946?lnk=st&q=python+xml&rnum=3&hl=en
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net
> Is PyXML now part of the Python distribution, or is it still an add-on?
Parts of PyXML have been migrated into Python core since Python 2.0,
but there is still also a standalone PyXML package.,.
See:
http://www.xml.com/pub/a/2002/09/25/py.html
--
Uche
http://copia.ogbuji.net
--
http://mail
> The problem is that when the sax handler raises an exception,
I can't see how to find out why. What I want to do is for
DodgyErrorHandler to do something different depending on
where we are in the course of parsing. Is there anyway
to get that information back from xml.sax (or indeed from
any oth
"""
I'm confused, I want to read/write XML files but I don't really
understand
what library to use.
I've used DOM-based libraries in other languages, is PyXML the library
to
use?
"""
There are many options (some say too many):
http://www.xml.com/pub/a/2004/10/13/py-xml.html
Try out Amara Binder
Who says 4Suite is buggy? Do they have any evidence to back that up?
We have a huge test suite, and though 4Suite is by no means the fastest
option, it's quite reliable for XSLT.
The XSLT processor in PyXML is just a very old version of 4XSLT.
--Uche
--
http://mail.python.org/mailman/listinfo/
Xalan is certainly faster, but it is almost certainly not more
compliant than 4Suite. Xalan actually has a bit of a reputation among
XSLT processors in its carelessness with compliance. But I suppoose in
order to settle these counter-claims, one of us will have to come up
with specific compliance
This is a good way to kick off a tussle among interested parties, but
hinestly, at this point, most packages work fine. In my opinion your
rade-off right now is raw speed (e.g. libxslt) versus flexibility (e.g.
4Suite). All are bug-free enough that you'd have to be doing somethign
*very* exotic t
Actually, most of the compliant problems I can remember off-head with
respect to Xalan have been regarding EXSLT 1.0, not base XSLT 1.0.
Sorry for any misconstruction.
--Uche
--
http://mail.python.org/mailman/listinfo/python-list
I suggest using minidom or pxdom [1] rather than 4DOM. If you insist
on using 4DOM, xml.dom.ext.Print(node) or xml.dom.ext.PrettyPrint(node)
does what you want.
--Uche
--
http://mail.python.org/mailman/listinfo/python-list
I suggest using minidom or pxdom [1] rather than 4DOM. If you insist
on using 4DOM, xml.dom.ext.Print(node) or xml.dom.ext.PrettyPrint(node)
does what you want.
[1] http://www.doxdesk.com/software/py/pxdom.html
--Uche
--
http://mail.python.org/mailman/listinfo/python-list
Steve Holden:
"I don't know what news reader you are using, but I wonder if I could
ask
you to retain just a little more context in your posts. If they were
personal emails I would probably be able to follow the thread, but in a
newsgroup it's always helpful when I see a comment such as your above
ld more examples
hurt). See also my Akara page on Python/SAX
http://uche.ogbuji.net/tech/akara/nodes/2003-01-01/sax
I have a lot on SAX in recent installments of my column:
http://www.xml.com/pub/au/84
--
Uche OgbujiFourthought, Inc.
http://uche.ogbuji.net
est/spam.xml')
docfrag is now ready for processing using DOM methods.
--
Uche OgbujiFourthought, Inc.
http://uche.ogbuji.nethttp://4Suite.orghttp://fourthought.com
Use CSS to display XML -
http://www.ibm.com/developerworks/edu/x-dw-x-xmlc
g like this available or can somebody give me some
> example lines that creates and saves some XML data?
Start with:
http://www.xml.com/pub/a/2002/11/13/py-xml.html
then see:
http://www.xml.com/pub/a/2003/10/15/py-xml.html
Overall, there is a lot on DOM throughout the series:
http:
0989.html
I also provide a useful mix-in class for this purpose in Amara's
saxtools:
http://www.xml.com/pub/a/2005/01/19/amara.html
http://cvs.4suite.org/viewcvs/Amara/lib/saxtools.py?rev=1.9&view=markup
In the latter link see class namespace_mixin, which you should be
able
l/xml-sig/2005-March/011013.html
--
Uche OgbujiFourthought, Inc.
http://uche.ogbuji.nethttp://4Suite.orghttp://fourthought.com
Use CSS to display XML, part 2 -
http://www-128.ibm.com/developerworks/edu/x-dw-x-xmlcss2-i.html
Introducing the Amara XML Toolki
ara discussion as
well). I follow that list far more diligently than c.l.py.
--
Uche OgbujiFourthought, Inc.
http://uche.ogbuji.nethttp://4Suite.orghttp://fourthought.com
Use CSS to display XML, part 2 -
http://www-128.ibm.com/developerworks/edu/x-dw-x-xm
gt; compiled, but I'll try it anyway.
Actually, as I mentioned in my last message, we do have some success
reports re: 4Suite + py2exe. See the March archives of the 4Suite list.
I think it took some work from those of the 4Suite developers who are
Windows-savvy, it did
]))
Same output, of course. I even tested it for you in Amara 0.9.4. And
what the heck, while I was there, I added it to the demos.
You can make things even more obfuscated^H^H^H^H^H^H^H^H^H^Hterse using
further lambda or list comp tricks, but I leave that as an exercise for
the perverse
.
> I cannot install pyvm (portable binary python machine) - have no such big
> quota.
> Any idea how can I solve it?
To install 4Suite in the home dir, use an incantation such as:
./setup.py config --prefix=$HOME/lib
./setup.py install
Note: I expect you also installed Python i
On Sat, 2005-04-16 at 08:12 -0600, Uche Ogbuji wrote:
> On Sat, 2005-04-09 at 14:09 -0700, dzieciou wrote:
>
> > I'm new-comer in Python.
> > I want to install few Python modules (4Suite, RDFLib, Twisted and Racoon)
> > in my home directory, since Python installatio
s";
true: Include all external general (text) entities.
false: Do not include external general entities.
access: (parsing) read-only; (not parsing) read/write
"""
Quote from:
http://docs.python.org/lib/module-xml.sax.handler.html
But you're on pre
cal filesystem.
Problem, now that I think of it, is that I'm not sure you can specify
an catalog in PySAX. You might instead have to override the method
entityResolver in your handler (and be sure to ). See the example in
listing 1 and and discussion here:
http://www.xml.com/pub/a/
one possible hybrid
approach.
xmltramp ( http://www.aaronsw.com/2002/xmltramp/ ) is another
interesting hybrid.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/
--
http://mail.python.org/mailman/listinfo/python-list
[1] http://uche.ogbuji.net/tech/4suite/amara/
[2] http://uche.ogbuji.net/uche.ogbuji.net/tech/4suite/amara/manual-dev
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji.net http://4Suite
at you guessed:
>>> import amara
>>> rssDigg = amara.parse("http://www.digg.com/rss/index.xml";)
>>> print rssDigg.rss.channel.item.title
Video: Conan O'Brien iPod Ad Parody
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net
DId you run a WIndows
installer? Next I'd check the library path for ActivePython. What is
the output of
python -c "import sys; print sys.path"
Where you replace "python" abpve with whatever way you invoke
ActivePython.
--
Uche Ogbuji Fo
#x27;__name__', '__path__', '__version__', 'bindery',
'binderytools', 'binderyxpath', 'create_document', 'dateutil_standins',
'domtools', 'os', 'parse', 'pushbind', 'pushdom', 'py
"""
>>> import amara
>>> print dir(amara)
['__builtins__', '__doc__', '__file__', '__name__', '__path__',
'__version__', 'binderytools', 'os', 'parse']
&q
that you can perhaps try out any solutions we come up
with?
Thanks.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publ
at right after waking up. And it shows :-)
Should have been "print domtools.__file__"
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http:/
Rick, thanks. Based on your clue I checked, and it seems those Amara
packages are not being built rightly. I'll look to get those packages
fixed and updated tomorrow.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthough
Jacob Kroon wrote:
> I'm writing a block-diagram editor, and could use some tips about
> writing/reading
> diagrams to/from an xml file format. The basic layout of my code :
>
> class Diagram {
> Blocks blocks[]
> }
>
> class Block {
> int x, y
> }
>
> class Square(Block) {
> int width,
has no attribute 'create_document'
> bash-2.03$
This came up when I was on vacation and incommunicado. What version of
Amara are you using on both platforms? How did you install them?
Thanks.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuj
gt; in sax.handlers.contenthandler , is the namespace defined like domain
> names on some website?
Based on this question, I tend to think you might want to leave the XML
processing to someone else's code. How about using Pilgrim's
feedparser?
http://feedparser.org/
--
Uche Ogbuji
[2]
and Amara [3]. For many people these are now very easy to install.
This is the case for some other third-party XML tools as well.
[1] http://peak.telecommunity.com/DevCenter/EasyInstall
[2] http://4suite.org/
[3] http://uche.ogbuji.net/tech/4suite/amara/
--
Uche Ogbuji
ml.html
Then add to that the fact that "" can legitimately appear in an
XML comment, so that logic is even more brittle.
The following code does this *safely* with Amara:
import amara
doc = amara.parse('test.xml')
top = doc.xml_xpath('//Top')[0]
top.xml_parent.xml_in
em than you may think :-)
Luckily it's a problem I've worked on. For discussion see:
http://www.xml.com/pub/a/2004/11/24/py-xml.html
For an updated solution see abs_path in Amara domtools. In most cases
you can safely call that on an Amara bindery node.
--
Uche Ogbuji
t; [1] and
> <http://www.xml.com/lpt/a/1675> [2]
And also the following article, by me, focusing on middleware:
http://www.ibm.com/developerworks/library/wa-wsgi/
(cover Weblog entry: http://copia.ogbuji.net/blog/2006-08-23/_Mix_and_m
)
--
Uche Ogbuji
create text nodes by using doc.createTextNode.
* You can always remove text nodes (or any other kind) by using
.removeChild
* It's much easier to navigate if you use XPath. PyXML has an
xml.xpath module you can use.
Good luck.
[1] http://www-128.ibm.com/developerworks/xml/
only instantiating the chunks of interest one at a time. This
allows for handling of huge files with a very simple programming idiom.
http://uche.ogbuji.net/tech/4suite/amara/
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthough
ports regex in XPath using the EXSLT community standard's
regex module [2]. It would be something like:
[re:match(@class, 'fo.*']
With the re prefix set as required by the EXSLT module.
[1] http://4Suite.org
[2] http://www.exslt.org/regexp/
--
Uche Ogbuji
http://copia.ogbuji.net/blog/2005-07-22/Beyond_HTM
Personally, I avoid Tidy. I've too often seen it crash or hang on
really bad HTML. TagSoup seems to be built like a tank. I've also
never seen BeautifulSoup choke, but I don't use it as much as TagSoup.
--
Uche Ogbuji
space declaration. So my guess is that you somehow got way off the
rails in your problem-solving, and you'll need to provide mre
background if you want help.
BTW, I recommend upgrading to Amara 1.1.7. That branch will soon be
1.2, and I consider it more mature than 1.0 at this point.
I don't get a crash on my system (Ubuntu), but I do get a legitimate
error message because that DTD is broken. The W3C seems to like
disseminating broken DTDs. Just yesterday I was helping someone around
the infamous broken XHTML 1.1 DTDs.
I do want to know why you're gettign a
i have to compare 2 similar xml document and get the add, changed and
> deleted files.and write it into acd.xml file.
> can u help me with the python code for this. I am using SAX.
Use the right tool and such problems tend to become much simpler.
http://www.logilab.org/projects/xmldiff
--
Uche Og
d more such options.
http://uche.ogbuji.net/tech/4suite/amara/
http://4Suite.org
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.ne
print buildPage()
-- % --
For what it's worth I just developed, and switched to WSGI middleware
that only does the transform on the server side if the client doesn't
understand XSLT. It's called applyxslt and is part of wsgi.xml [1].
That reduces server load, and with caching (via Mygh
32com.client
>
> def buildPage():
[SNIP]
Added to:
http://uche.ogbuji.net/tech/akara/nodes/2003-01-01/python-xslt
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji.net
what's the XSLT processor in the case of Safari
(only the most recent versions of Safari). But regardless, with that
coverage you can write apps using XSLT, support the entire spectrum of
browsers (and mobile apps, spiders, etc.) and yet rarely ever re
In fact, I
think it's clear that Infoset is not even the preeminent *data model*
of the XML world. That distinction goes to the XPath data model, which
is quite different from the Infoset.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net
Paul Watson wrote:
> Explicit [XML declaration] is better than implicit.
Yes indeed.
"Always use an XML declaration"
http://www-128.ibm.com/developerworks/xml/library/x-tipdecl.html
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net
Fredrik Lundh wrote:
> Uche Ogbuji wrote:
>
> > I certainly have never liked the aspects of the ElementTree API under
> > present discussion. But that's not as important as the fact that I
> > think the above statement is misleading. There has always been a
> &g
ed to XML.
Again, my take:
http://www.ibm.com/developerworks/xml/library/x-namcar.html
And yes, default namespaces are about 50% of the problem with
namespace. QNames in content (which are of course an abuse of
namespaces) are almost all of the other 50%. I call them "hidden
namespaces":
5881
Using this filter you can then write SAX code that assumes normalized
text events. Also, 4Suite's SAX implementation, Saxlette,
automatically does this text event merging for you at C speed:
http://4suite.org/docs/CoreManual.xml#saxlette
--
Uche Ogbuji F
t ""
Just be sure you're well aware of all the issues:
http://www.xml.com/pub/a/2002/11/13/py-xml.html
See also:
http://www.ibm.com/developerworks/xml/library/x-think35.html
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net
tree-callback methods will give you the
best speed. Fredrik already mentioned ElementTree's IterParse.
Amara's pushbind and pushdom and 4Suite's Saxlette (which has some neat
callback features) are other options.
http://uche.ogbuji.net/tech/4suite/amara/
http://4suite.org/docs/Cor
t ""
Just be sure you're well aware of all the issues:
http://www.xml.com/pub/a/2002/11/13/py-xml.html
See also:
http://www.ibm.com/developerworks/xml/library/x-think35.html
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net
good
> solution? Thanks!
That minidom behavior is fairly unsafe. 4Suite's PrettyPrinter is much
safer:
>>> from Ft.Xml import Parse
>>> from Ft.Xml.Domlette import PrettyPrint
>>> XML = "blabla"
>>> doc = Parse(XML)
>>> Pre
nt entity, because it has multiple
elements at document level. It's also not well-formed according to
XMLNS 1.0 unless you declare the "title" prefix. You will not be able
to use a non XMLNS 1.0 document with most XML technologies, including
XSLT
result.msg.xml() #to get the XML source for that
element
print doc.response.resData.appData.name
print doc.response.resData.appData.name.xml()
[1] http://uche.ogbuji.net/tech/4Suite/amara/
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji.net http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/
--
http://mail.python.org/mailman/listinfo/python-list
4Suite has some friendly gettext-based i18n extensions. See:
http://copia.ogbuji.net/blog/2005-06-14/i18n_for_X
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji.net http://4Su
"""
> Most examples in the book do not include such a declaration and yet
are
> properly rendered by Internet Explorer.
> Is it mandatory and why is it that Expat crashes on it?
It's not mandatory but it's probably good practice to make the document
self-contained. The xlink prefix is defined in
1-01/general-section
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://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-xmlcs
TML serialiser. "
Amara does provide for this, e.g.:
from amara.binderytools import bind_string
doc = bind_string(text)
print doc.xml(method=u"html")
Which automatically and transparently brings to bear the full power of
the XSLT HTML output method.
--
Uche Ogbuji
In Amara[2], this task is trivial. To get all the images in an XHTML
div, you'd simply do:
for img in div.img:
process_img(img)
You access names directly as objects according to their element type
name.
[1] see, e.g., http://www.xml.com/pub/a/2003/01/08/py-xml.html
[2] see http:
Chris Spencer:
"""
Fredrik Lundh wrote:
> Chris Spencer wrote:
> > If an XML parser reads in and then writes out a document without having
> > altered it, then the new document should be the same as the original.
> says who?
Good question. There is no One True Answer even within the XML
standard
LogiLabs's
app is that it can output XUpdate, which could be used with, say
4Suite's 4XUpdate to apply a patch to another document.
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.nethttp://fourthought.com
http://copia.ogbuji
1 - 100 of 102 matches
Mail list logo