could the people with a bit of knowledge try to write a map of all the possible and working solutions? People are telling me that python doc is good so may be we should also consider that arranging knowledge on maps is the first step Please take 15 mins because in 15 min you can get a real impact!
http://www.squeaksource.com/XMLPullParser.html
If I would going to write a XML parser, I'd go for a VTD parser instead. Cheers,
Hernán
2010/7/19 Norbert Hartl <norbert@hartl.name>:
On 06.07.2010, at 23:04, jaayer wrote:
---- On Tue, 06 Jul 2010 03:19:48 -0700 Torsten Bergmann wrote ----
Just check "XMLWriter-tbn.5" which can be found in "http://squeaksource.com/PharoGoodies/"
------------------------------------------------------ |writer| writer := XMLTagWriter xml. writer comment: 'A new xml file'. writer tag: 'package' with: [ writer cData: 'name' with: 'XMLWriter'. ]. writer contents
returns
------------------------------------------------------
You can also access the stream (writer stream). Indenting is not yet working fully but at least it should give you idea. Check out the test cases for more.
I once saw such an XMLWriter written by Ernest Micklei in VAST (credits for the idea) and rebuilt it in Pharo.
Bye T. -- GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl. Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
The next version of XMLSupport will feature an XMLWriter with an API similar to XMLTagWriter. I had decided a few weeks that any API using explicit start/end methods was unsmalltalk-like and should be replaced with one based on execute-around methods, though I was unaware of XMLTagWriter and instead modeled the API loosely on Seaside's HTML generation. You now send XMLWriter messages that create markup-writing objects for the parts of a document. These objects can then be configured using messages like #attributeAt:put: and written to the document explicitly with a serialization message (which typically accepts content) or implicitly by creating another markup writer after it. The new API looks like this:
| writer | ((writer := XMLWriter new) enablePrettyPrinting; xmlDeclaration; tag: 'foo') xmlnsAt: 'foo' put: 'http://foo'; attributeAt: 'a' put: 'one'; attributeAt: 'b' put: 'two'; content: [ writer tag: 'bar' content: [ (writer string: 'test'; tag: 'baz'; tag: 'foobar') content: 'test']] which produces: <?xml version="1.0" encoding="UTF-8"?> <foo xmlns:foo="http://foo" a="one" b="two"> <bar>test<baz /> <foobar>test</foobar> </bar> </foo>
Could you elaborate on the usage of xmlns? The one you defined does nothing. The foo in the xml is just the element name. I would like to know
- how to define a namespace prefix for an element - how to define a default namespace for an element
I think I need another look in the xml parser since last time :) Thanks for putting effort into xml parser. Is there a pull parser available or planned?
thanks,
Norbert
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project