[Pharo-users] Re: Standalone html builder (a la seaside without seaside?)

2020-09-30 Thread monty
Yes, XMLWriter can do this. Use can also use:   xmlWriter outputsSelfClosingTags: false   before writing to get more HTML-like output ___ montyos.wordpress.com     Sent: Tuesday, September 29, 2020 at 3:08 PM From: "Santiago Bragagnolo" To: "Any question about pharo is welcome" Subject: 

Re: [Pharo-users] Naming parameters - conventions?

2018-07-12 Thread monty
The primary trade-off is between Type Suggesting vs. Role Suggesting parameter names. For example, aString and aSymbol tell us only what type of object the parameter expects, while aName and aTitle tell us the *role* (or purpose) of the parameter, with the expected type hopefully obvious. You

Re: [Pharo-users] XML support for pharo

2018-07-11 Thread monty
This is the latest version of the XML/XPath Scraping Booklet: ___ montyos.wordpress.com

Re: [Pharo-users] Lost in stream

2018-06-20 Thread monty
st in stream > > No with Pharo, and pretty old XML parser version. But still this one was > always capable to parse entity > > > Le 18/06/2018 à 02:43, monty a écrit : > > Are you developing in Squeak? I ask because the XML parser in the default > > Squeak image is very old. Y

Re: [Pharo-users] Lost in stream

2018-06-18 Thread monty
uot; > To: "Any question about pharo is welcome" > Subject: Re: [Pharo-users] Lost in stream > > > > > On 18 Jun 2018, at 02:18, monty wrote: > > > > Also consider using XMLParser's built-in file reading support: > > #parseFileNamed:/#onF

Re: [Pharo-users] Lost in stream

2018-06-17 Thread monty
Are you developing in Squeak? I ask because the XML parser in the default Squeak image is very old. You can download the latest Pharo XMLParser lib from the SqueakMap. It's the "XMLParser" project. Other libs I maintain are also available as SM projects, like "XMLParser-XPath". If you're doing

Re: [Pharo-users] Lost in stream

2018-06-17 Thread monty
Print-evaluate this: ' ' parseXML and you should get (with any recent XMLParser lib): If you don't want entity replacement, set #replacesContentEntityReferences: to false. Also consider using XMLParser's built-in file reading support: #parseFileNamed:/#onFileNamed:. They work cross platform

Re: [Pharo-users] Why do #select:thenXxx methods not return their result

2018-06-07 Thread monty
Not just more readable. They can also be more efficient. Look at #select:thenCollect: in OrderedCollection: select: selectBlock thenCollect: collectBlock " Optimized version Collection>>#select:thenCollect: " | newCollection element | newCollection := self copyEmpty.

Re: [Pharo-users] configurable space in XML Writer tag

2018-04-06 Thread monty
It's changed to no longer emit that space. I was considering removing it, or at least making it configurable, anyway.

Re: [Pharo-users] Plans for XSD in XML(Parser) the foreseeable future?

2018-04-06 Thread monty
Unfortunately not. It's a major effort, and I'm not able to devote the time to it now.

Re: [Pharo-users] Problem with input to XML Parser - 'Invalid UTF8 encoding'

2017-10-10 Thread monty
nd order problems. It all begins because the > > Corriere web site does strange things with encoding, including using a > > UTF8 > > character in a page coded with 8859-1, as Paul pointed out. In any case, > > reading the page as a string and then parsing it solves my pr

Re: [Pharo-users] Writing XML

2017-09-15 Thread monty
lines to 2. > Nice. :) > > Thanks. > > Jimmie > > > > On 09/15/2017 09:29 AM, monty wrote: > > If you want to write a DOM tree to a file, send #printToFileNamed: (or a > > related message like #canonicallyPrintToFileNamed: or > > #printToFileNamed

Re: [Pharo-users] Writing XML

2017-09-15 Thread monty
If you want to write a DOM tree to a file, send #printToFileNamed: (or a related message like #canonicallyPrintToFileNamed: or #printToFileNamed:beforeWritingDo:) to the root. See the XMLNode "printing" category for more. This will automatically encode the file with the encoding the

Re: [Pharo-users] Thread-safe initialization of class state (was Re: Threads safety in Pharo)

2017-08-11 Thread monty
Threads safety in Pharo) > > What package you explore? I not find fileTypes method in Pharo 7. Like I said, it's a hypothetical example. But I'm sure you could find similar examples of unsafe class state initialization in the image and in popular libraries. > 2017-08-11 8

Re: [Pharo-users] Thread-safe initialization of class state (was Re: Threads safety in Pharo)

2017-08-11 Thread monty
: 'html' put: 'Web Page'; >yourself ]. > > Then have something > > fileTypes > ^fileTypes value > > Where you have a critical section in #value? > > Tim > > Sent from my iPhone > On 11 Aug 2017, at 07:53, monty > <mon...@program

[Pharo-users] Thread-safe initialization of class state (was Re: Threads safety in Pharo)

2017-08-11 Thread monty
Here's a hypothetical broken class method that does lazy initialization of a class inst var: fileTypes fileTypes ifNil: [ fileTypes := Dictionary new. fileTypes at: 'txt' put: 'Text File'; at: 'html' put:

Re: [Pharo-users] XPath has unresolved dependencies

2017-06-05 Thread monty
Thanks, it should be fixed now.   Sent: Monday, June 05, 2017 at 6:50 AM From: "Henrik Nergaard" To: "Any question about pharo is welcome" , "mon...@programmer.net" Subject: XPath has unresolved dependencies Hi,  

Re: [Pharo-users] Dictionary whose values are dictionaries

2017-05-27 Thread monty
You could just use a regular Dictionary, but with association keys: dict at: outerKey -> innerKey put: innerValue

Re: [Pharo-users] Problems loading XML System ( was [Zinc] ZnInvalidUTF8: Illegal leading byte for utf-8 encoding)

2017-05-21 Thread monty
ems loading XML System ( was [Zinc] > ZnInvalidUTF8: Illegal leading byte for utf-8 encoding) > > Monty > > Many thanks for your patient explanation. I would like to try one > supplementary question, if I may. Almost all my work involves reading HTML > files from the web and extractin

Re: [Pharo-users] Problems loading XML System ( was [Zinc] ZnInvalidUTF8: Illegal leading byte for utf-8 encoding)

2017-05-17 Thread monty
g> > Subject: Re: [Pharo-users] Problems loading XML System ( was [Zinc] > ZnInvalidUTF8: Illegal leading byte for utf-8 encoding) > > Monty > > Many thanks for your help. I have followed your advice to start again in a > clean Moose 6.1 image, and so far everything is

Re: [Pharo-users] Problems loading XML System ( was [Zinc] ZnInvalidUTF8: Illegal leading byte for utf-8 encoding)

2017-05-15 Thread monty
Zinc] > ZnInvalidUTF8: Illegal leading byte for utf-8 encoding) > > Monty > > As an update, I have rebuilt from the Moose 6.0 download. The version of > XML-Parser in that was dated 18 July 2016 (configuration monty.233), so I > installed versions of XML-Parser-HT

Re: [Pharo-users] [Zinc] ZnInvalidUTF8: Illegal leading byte for utf-8 encoding

2017-05-15 Thread monty
For that kind of incremental parsing, you could also use XMLParserStAX, a pull-parser that parses a document as a stream of event objects you control with #next, #peek, and #atEnd. It also supports pull-DOM parsing with messages like #nextNode, #nextElement, and #nextElementNamed:, which return

Re: [Pharo-users] [Zinc] ZnInvalidUTF8: Illegal leading byte for utf-8 encoding

2017-05-13 Thread monty
> Sent: Friday, May 12, 2017 at 5:30 AM > From: PBKResearch > To: "'Any question about pharo is welcome'" > Subject: Re: [Pharo-users] [Zinc] ZnInvalidUTF8: Illegal leading byte for > utf-8 encoding > > With reference to Norbert's comment,

Re: [Pharo-users] XMLHTMLParser Entity Handling oddity

2017-05-06 Thread monty
at 9:51 AM, Udo Schneider > <udo.schnei...@homeaddress.de[mailto:udo.schnei...@homeaddress.de]> > wrote:Perfect! Thank you very very much! > > Am 05/05/17 um 19:28 schrieb monty: > > This should be fixed now. Thanks for the bug report. > Sent: Wedne

Re: [Pharo-users] XMLHTMLParser Entity Handling oddity

2017-05-05 Thread monty
This should be fixed now. Thanks for the bug report. > Sent: Wednesday, May 03, 2017 at 4:44 PM > From: "Udo Schneider" > To: pharo-users@lists.pharo.org > Subject: [Pharo-users] XMLHTMLParser Entity Handling oddity > > All, > > I'm hitting an interesting issue

Re: [Pharo-users] best practices for using external files for testing

2017-04-18 Thread monty
XMLParser's XML-Tests-Conformance project, which is automatically generated from the W3C's Conformance Test Suites project (https://www.w3.org/XML/Test/), stores the contents of its files in class methods. This way it's self-contained, portable, and the actual files only need to be downloaded

Re: [Pharo-users] PetitParser question parsing HTML meta tags

2017-04-02 Thread monty
XMLParserHTML is the fastest HTML parser on Pharo, Squeak, and GS. It has DOM and SAX parsers and works with other libs such as PharoExtras/XPath and PharoExtras/XMLParserStAX. Element and attribute names are normalized to lowercase, and printing XML DOM trees back as HTML is complicated by

Re: [Pharo-users] [ANN] Regex Tester Tool for Pharo

2017-03-01 Thread monty
Very nice! > Sent: Wednesday, March 01, 2017 at 3:32 PM > From: "Torsten Bergmann" > To: "Pharo Development List" , "Any question about > pharo is welcome" > Subject: [Pharo-users] [ANN] Regex Tester Tool for Pharo >is a

Re: [Pharo-users] [ANN] XML Metadata Interchange (XMI) for Pharo

2017-03-01 Thread monty
Is this based on Peter's work? Also: "anXMLElement name xmlPrefixBeforeLocalName" -> "anXMLElement prefix" "anXMLElement elements collect:" -> "anXMLElement elementsCollect:" "^self fromXMLElement: (XMLDOMParser parse: aStringOrStream usingNamespaces: false) root"...why are you disabling

Re: [Pharo-users] Coding XPath as Smalltalk

2017-02-20 Thread monty
limiting the number of matching nodes it enumerates. > Sent: Saturday, September 03, 2016 at 11:08 AM > From: PBKResearch <pe...@pbkresearch.co.uk> > To: "'Any question about pharo is welcome'" <pharo-users@lists.pharo.org> > Subject: Re: [Pharo-users] Coding XPat

Re: [Pharo-users] The Ultimate Smalltalk Tutorial

2016-10-24 Thread monty
+1 for PBE. > Sent: Monday, October 24, 2016 at 1:56 AM > From: "Nicolai Hess" > To: "Any question about pharo is welcome" > Subject: Re: [Pharo-users] The Ultimate Smalltalk Tutorial > > Am 23.10.2016 3:16 nachm. schrieb "Vitor Medina

Re: [Pharo-users] Coding XPath as Smalltalk

2016-09-03 Thread monty
gt; > > On 03 Sep 2016, at 08:17, Tudor Girba <tu...@tudorgirba.com> wrote: > > > > Hi, > > > > Indeed, Monty is doing a great job at maintaining and evolving the XML > > support. > > Yes indeed ! > > > Cheers, > > Doru > > > &g

Re: [Pharo-users] Coding XPath as Smalltalk

2016-09-03 Thread monty
> Sent: Saturday, September 03, 2016 at 5:30 AM > From: PBKResearch <pe...@pbkresearch.co.uk> > To: "'Any question about pharo is welcome'" <pharo-users@lists.pharo.org> > Subject: Re: [Pharo-users] Coding XPath as Smalltalk > > Hi Monty > > Many

Re: [Pharo-users] Coding XPath as Smalltalk

2016-09-03 Thread monty
> Sent: Saturday, September 03, 2016 at 2:02 AM > From: stepharo <steph...@free.fr> > To: "Any question about pharo is welcome" <pharo-users@lists.pharo.org> > Subject: Re: [Pharo-users] Coding XPath as Smalltalk > > Hi monty > > In which repository

Re: [Pharo-users] Coding XPath as Smalltalk

2016-09-03 Thread monty
  Hernan, the PharoExtras/XPath repo has a major rewrite of your package to support all of XPath 1.0 + XPath 2.0 extensions like the element() and attribute() type tests and namespace literals in name tests like '{namespaceURI}localName'. A rewrite was needed because the old lib only implemented

Re: [Pharo-users] Coding XPath as Smalltalk

2016-09-02 Thread monty
Peter, you're using an ancient version with bugs that were fixed last fall. The newest version has more tests and correct behavior (checked against a reference implementation). Just download a new Moose image and you'll get it, along with an up to date XMLParser. (But if you insist on upgrading

Re: [Pharo-users] Set on Attribute

2016-08-25 Thread monty
Other than PluggableSet, something like Unix's sort and uniq combo would work: condenseOnFirst: aCollection | lastSelected | ^ aCollection sorted select: [:each | (lastSelected isNil or: [lastSelected first ~= each first]) ifTrue: [

Re: [Pharo-users] Generating custom classes based on attributes from XML Document

2016-08-17 Thread monty
You now can match on attributes too. The attributes: arguments can be any attribute specification object or just an ordinary dict or other association collection (nil values mean a key just must be present with any value).   And there is visitor pattern support so you don't have to define

Re: [Pharo-users] XMLParser Claims U+00A0 is “Invalid UTF-8”

2016-07-28 Thread monty
Also #parseURL:/#onURL: will use WebClient on Squeak (unless Zinc is present of course) > Sent: Thursday, July 28, 2016 at 6:15 PM > From: monty <mon...@programmer.net> > To: pharo-users@lists.pharo.org > Subject: Re: [Pharo-users] XMLParser Claims U+00A0 is “Invalid UTF-8” &g

Re: [Pharo-users] XMLParser Claims U+00A0 is “Invalid UTF-8”

2016-07-28 Thread monty
Good for finding one of the fixes, but please use #parseURL:/#onURL: instead of #asUrl/#asZnUrl with #retrieveContents, because that will result in Zinc eagerly decoding the response without looking at the declaration as the XML spec requires. #parseURL:/#onURL: use Zinc correctly, doing

Re: [Pharo-users] XMLParser Claims U+00A0 is “Invalid UTF-8”

2016-07-28 Thread monty
t; Subject: Re: [Pharo-users] XMLParser Claims U+00A0 is “Invalid UTF-8” > > monty-3 wrote > > Just to be sure, I manually recreated your file (with the great Bless hex > > editor) and parsed it with no issue. > > Thanks! > > > monty-3 wrote > > Please post your co

Re: [Pharo-users] XMLParser Claims U+00A0 is “Invalid UTF-8”

2016-07-28 Thread monty
Just to be sure, I manually recreated your file (with the great Bless hex editor) and parsed it with no issue. Please post your code and attach the actual source as a file separately. > Sent: Thursday, July 28, 2016 at 3:12 PM > From: "Sean P. DeNigris" > To:

[Pharo-users] Some info (was: How to access XML tag name?)

2016-03-14 Thread monty
To handle character data (the "b" in "b"), use characters:. But know it's sent multiple times for an element if its character data is separated by other markup like 'bd' (the new comment explains this). SAX parsing usually ends up needing a stack to track elements and their character data and

Re: [Pharo-users] Writing a dictionary as XML?

2016-02-18 Thread monty
  xml :=     XMLWriter writeWith: [:writer |         dict keysAndValuesDo: [:key :value |             writer                 tag: key                 with: value]]   Sent: Wednesday, February 17, 2016 at 12:46 PM From: "p...@highoctane.be" To: "Any question about pharo is

Re: [Pharo-users] XML verification using an external XSD file - possible yet in Pharo?

2016-02-04 Thread monty
> Sent: Thursday, February 04, 2016 at 4:31 AM > From: stepharo <steph...@free.fr> > To: "Any question about pharo is welcome" <pharo-users@lists.pharo.org> > Subject: Re: [Pharo-users] XML verification using an external XSD file - > possible yet in

Re: [Pharo-users] String vs Symbol use cases

2015-09-17 Thread monty
Peter, the XPath lib was rewritten not long ago to provide full XPath 1.0 support + extensions, so feel free to mail me with questions or bugs. The old lib didn't implement the whole spec and would crash or infinite loop on valid input, so I felt a rewrite was needed. > myDocument xPath:

Re: [Pharo-users] String vs Symbol use cases

2015-09-17 Thread monty
> Remember the xPath: usage gives access to full XPath syntax (not just axis > and nametests), including predicates, functions, and variables. XPath is > really a different language so mapping it all to a ST DSL is tricky. For > example, XPath 1.0 is weakly typed so "1" = 1 = "1.0" but clearly

Re: [Pharo-users] String vs Symbol use cases

2015-09-17 Thread monty
Hernan maintained the old lib. The PharoExtras/XPath lib you get from the catalog or config browsers was rewritten and questions/bugs should be sent to me. Note it is incompatible with Pastell, so you can't have both in the same image. > Sent: Thursday, September 17, 2015 at 4:07 PM > From:

Re: [Pharo-users] XPath (was String vs Symbol use cases)

2015-09-17 Thread monty
I understand the problem and I'm studying possible fixes while reviewing the specs, but I need more time. if you could work around it for now, that would be good. I will update you by mail.