[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: [P

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
> > 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
Caekenberghe" > 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: > > #

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 (S

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. firstIn

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
ond 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 so

Re: [Pharo-users] Writing XML

2017-09-15 Thread monty
an use #printToFileNamed:beforeWritingDo: with a block that sends #lineBreak: to the writer argument to get a custom LE when printing a DOM tree to a file. > Overall this was a nice win. > It cleaned up my method to save the file and reduced 7 lines to 2. > Nice. :) > > Thanks. >

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 XMLDocument

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

2017-08-11 Thread monty
e? 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:53 GMT+02:00 monty > mailto:mon...@programmer.net]>

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

2017-08-11 Thread monty
ut: '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 > mailto:mon...@p

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

2017-08-10 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: 'Web

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,   Loading XPath from the catalog browser into the latest image raises a warnin

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
gal 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 extracting relevant sections, and I am trying to work >

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

2017-05-17 Thread monty
: [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 working fine. Apologies for &g

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

2017-05-15 Thread monty
class initialize]] and try running the tests again. > Sent: Monday, May 15, 2017 at 6:50 PM > From: PBKResearch > To: "'Any question about pharo is welcome'" > Subject: [Pharo-users] Problems loading XML System ( was Re: [Zinc] > ZnInvalidUTF8: Illega

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, there /may/ be an ambiguity about the > word 'header' in

Re: [Pharo-users] XMLHTMLParser Entity Handling oddity

2017-05-06 Thread monty
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: Wednesday, May 03, 2017 at 4:44 PM > From: "Udo Schneider" > mailto:udo.schnei...@homeaddress.de]>

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 with XMLHTMLParser and I'm not eve

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 an

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 bro

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

2017-03-31 Thread monty
You could use XMLHTMLParser from STHub PharoExtras/XMLParserHTML (supported on Pharo, Squak, and GS): descriptions := OrderedCollection new. (XMLHTMLParser parseURL: aURL) allElementsNamed: 'meta' do: [:each | ((each attributeAt: 'name') asLowercase = 'description'

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 good idea > Hi, > > I wrote a little tool to test regular expressions and

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 namespa

Re: [Pharo-users] Coding XPath as Smalltalk

2017-02-20 Thread monty
n initial number predicate attached to a node test (like in the first example) optimizes the node test by limiting the number of matching nodes it enumerates. > Sent: Saturday, September 03, 2016 at 11:08 AM > From: PBKResearch > To: "'Any question about pharo is welcome'&

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 Cruz" > mailto:vitormc...@gmail.com]>: > > > > I think t

Re: [Pharo-users] Coding XPath as Smalltalk

2016-09-03 Thread monty
> Sent: Saturday, September 03, 2016 at 2:56 AM > From: stepharo > To: pharo-users@lists.pharo.org > Subject: Re: [Pharo-users] Coding XPath as Smalltalk > > > > Le 3/9/16 à 08:41, monty a écrit : > >> Sent: Saturday, September 03, 2016 at 2:02 AM > >&

Re: [Pharo-users] Coding XPath as Smalltalk

2016-09-03 Thread monty
Thanks! > Sent: Saturday, September 03, 2016 at 4:31 AM > From: "Sven Van Caekenberghe" > To: "Any question about pharo is welcome" > Subject: Re: [Pharo-users] Coding XPath as Smalltalk > > > > On 03 Sep 2016, at 08:17, Tudor Girba wrote: > >

Re: [Pharo-users] Coding XPath as Smalltalk

2016-09-03 Thread monty
> Sent: Saturday, September 03, 2016 at 5:30 AM > From: PBKResearch > To: "'Any question about pharo is welcome'" > Subject: Re: [Pharo-users] Coding XPath as Smalltalk > > Hi Monty > > Many thanks. I have picked up a project that I had not worke

Re: [Pharo-users] Coding XPath as Smalltalk

2016-09-02 Thread monty
> Sent: Saturday, September 03, 2016 at 2:02 AM > From: stepharo > To: "Any question about pharo is welcome" > Subject: Re: [Pharo-users] Coding XPath as Smalltalk > > Hi monty > > In which repository this maintained version is? PharoExtras/X

Re: [Pharo-users] Coding XPath as Smalltalk

2016-09-02 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 a

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 polymor

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 > To: pharo-users@lists.pharo.org > Subject: Re: [Pharo-users] XMLParser Claims U+00A0 is “Invalid UTF-8” > > Good for finding one

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 their

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

2016-07-28 Thread monty
aro-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 cod

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@lists.pharo.org > Subje

[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 welcome" Subject: [Ph

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 > To: "Any question about pharo is welcome" > Subject: Re: [Pharo-users] XML verification using an external XSD file - > possible yet in Pharo? > > Hi paul > > monty told me that his XML

Re: [Pharo-users] ifNotEmpty(Do):

2015-10-11 Thread monty
Not only isn't it easier to understand, it's harder. With collections "do:" normally means enumeration (do:, allButLastDo:, reverseDo:), but ifNotEmptyDo: doesn't enumerate the receiver. > Sent: Sunday, October 11, 2015 at 5:29 AM > From: "Marcus Denker" > To: "Any question about pharo is welco

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.

Re: [Pharo-users] XML Viewer and XML syntax highlighting

2015-09-17 Thread monty
What's needed is a highlight/styling widget that works with GT that can also be treated like an ordinary write stream. Then you subclass XMLPrettyPrintingWriterFormatter and override the formatting messages to style the stream differently at certain points (like before a start tag, after a star

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: "Al

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
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: #'enti

Re: [Pharo-users] Looking for old Linux vm

2013-06-18 Thread Monty Kamath
Sean - Thank you for posting this to the list for me. Thanks Esteban, Sean, Damien, Stephan for the replies! I really appreciate it! I ended up trying out this version and it works! http://ftp.squeak.org/4.0/unix-linux/ Cheers! Monty On Mon, Jun 17, 2013 at 10:54 PM, wrote: > MontyK wr