Re: [Pharo-users] Writing XML

2017-09-15 Thread monty


> Sent: Friday, September 15, 2017 at 4:30 PM
> From: "Jimmie Houchin" 
> To: "Any question about pharo is welcome" 
> Subject: Re: [Pharo-users] Writing XML
>
> I didn't pay attention to this previously. But I just noticed that using 
> #printToFileNamed:   preserved the DOM tree's original line ending where 
> as previously I had to insure the the XMLWriter #lineEnding was changed 
> from defaultLineEnding to canonicalLineEnding. The original document 
> used LF and not CR.

To clarify, #printToFileNamed: and company use CRLF on Windows and LF 
elsewhere. XMLWriter uses Pharo's LE by default (CR), but it will use the 
preferred LE of your platform (LF or CRLF) with 
#enablePlatformSpecificLineBreak, LF when canonical XML 
(https://www.w3.org/TR/xml-c14n) is enabled, or whatever LE you want with 
#lineBreak:.

You can 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.
> 
> 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:beforeWritingDo:) to the root. See the XMLNode "printing" 
> > category for more. This will automatically encode the file with the 
> > encoding the XMLDocument>>#encoding attribute specifies (if recognized), 
> > and it's portable across Pharo, Squeak, and GemStone. Use 
> > #parseFileNamed:/#onFileNamed: to get portable automatic file decoding when 
> > parsing.
> >
> >> Sent: Wednesday, September 13, 2017 at 1:02 PM
> >> From: "Jimmie Houchin" 
> >> To: "Any question about pharo is welcome" 
> >> Subject: [Pharo-users] Writing XML
> >>
> >> Hello,
> >>
> >> I am attempting to read and write an XML document.
> >>
> >> Currently I have parsed the document successfully. I have basic
> >> navigation and have learned how to modify the XMLDocument.
> >>
> >> Now I want to write the modified document back to the file system.
> >> What I have tried so far is:
> >>
> >> writer := XMLWriter new.
> >> xmldoc document writeXMLOn: writer.
> >> writer stream.
> >> f := File openForWriteFileNamed: '/home/jimmie/xmldoc.xml'.
> >> f nextPutAll: (writer write contents).
> >> f flush.
> >> f close.
> >>
> >> It does write an xml document to the file system. However, it has
> >> exploded in size. The original is 28mb and is in UTF-8. The newly
> >> written file is 112mb and is UTF-32.
> >>
> >> I do not know why the change in encoding or how to correct or manually
> >> set the encoding.
> >>
> >> Any help in understanding how to correctly write an XML document that I
> >> have read and minimally modified would be greatly appreciated.
> >>
> >> Thanks.
> >>
> >> Jimmie
> >>
> >>
> 
> 
> 



[Pharo-users] Pharo 7 license question

2017-09-15 Thread Jimmie Houchin

Hello,

Pharo 7 to my understanding fundamentally changes Pharo. It is my 
understanding that Pharo 7 starts with a core Pharo kernel and like many 
languages out there, imports or adds code from a variety of external 
sources to the image being built.


With that understanding, I am curious if that would allow for inclusion 
of a specific library/module to be licensed as GPL? And it not affect 
the other code in the composed image?


I am a big believer in the MIT/BSD license and not a big fan of the GPL. 
However, there is software out there that I have avoided looking at the 
source code or attempting to port it to Pharo because it is GPL. I would 
sincerely love if I could now port such a library and license it under 
the GPL as required, and it not affect any other code outside of that 
specific library.


I am not a lawyer. Nor do I know any lawyers. Is is possible for someone 
to get a reasonably definitive answer on this question?


I am sure I am not the only one who has had this desire. I am also sure 
that I am not the only one who will have this question in the future. So 
it would be nice to have a proper legal response that could possibly be 
explicitly stated somewhere on the website or on an FAQ or something.


Regardless of the answer, yes or no. It does need to be a settled issue 
for Pharo. That way someone could know if GPL/LGPL or whatever software 
could be in the catalog.


Just wanted to put that out there to the community. I look forward to 
the answer, should one be or become available.


Thanks.


Jimmie





Re: [Pharo-users] Writing XML

2017-09-15 Thread Jimmie Houchin
I didn't pay attention to this previously. But I just noticed that using 
#printToFileNamed:   preserved the DOM tree's original line ending where 
as previously I had to insure the the XMLWriter #lineEnding was changed 
from defaultLineEnding to canonicalLineEnding. The original document 
used LF and not CR.


Overall this was a nice win.
It cleaned up my method to save the file and reduced 7 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:beforeWritingDo:) to the root. See the 
XMLNode "printing" category for more. This will automatically encode the file with 
the encoding the XMLDocument>>#encoding attribute specifies (if recognized), and it's 
portable across Pharo, Squeak, and GemStone. Use #parseFileNamed:/#onFileNamed: to get portable 
automatic file decoding when parsing.


Sent: Wednesday, September 13, 2017 at 1:02 PM
From: "Jimmie Houchin" 
To: "Any question about pharo is welcome" 
Subject: [Pharo-users] Writing XML

Hello,

I am attempting to read and write an XML document.

Currently I have parsed the document successfully. I have basic
navigation and have learned how to modify the XMLDocument.

Now I want to write the modified document back to the file system.
What I have tried so far is:

writer := XMLWriter new.
xmldoc document writeXMLOn: writer.
writer stream.
f := File openForWriteFileNamed: '/home/jimmie/xmldoc.xml'.
f nextPutAll: (writer write contents).
f flush.
f close.

It does write an xml document to the file system. However, it has
exploded in size. The original is 28mb and is in UTF-8. The newly
written file is 112mb and is UTF-32.

I do not know why the change in encoding or how to correct or manually
set the encoding.

Any help in understanding how to correctly write an XML document that I
have read and minimally modified would be greatly appreciated.

Thanks.

Jimmie







Re: [Pharo-users] Writing XML

2017-09-15 Thread Jimmie Houchin

Thanks for the reply.
I appreciate the education the people on this list provide.

I was already doing the XMLDOMParser #onFileNamed: to open the file.
It was showing the correct #encoding for the parsed file.
It was just the writing of the nearly identical file which was different.
I tried as you wrote #printToFileNamed:and it did as you explained.

Thanks again.

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:beforeWritingDo:) to the root. See the 
XMLNode "printing" category for more. This will automatically encode the file with 
the encoding the XMLDocument>>#encoding attribute specifies (if recognized), and it's 
portable across Pharo, Squeak, and GemStone. Use #parseFileNamed:/#onFileNamed: to get portable 
automatic file decoding when parsing.


Sent: Wednesday, September 13, 2017 at 1:02 PM
From: "Jimmie Houchin" 
To: "Any question about pharo is welcome" 
Subject: [Pharo-users] Writing XML

Hello,

I am attempting to read and write an XML document.

Currently I have parsed the document successfully. I have basic
navigation and have learned how to modify the XMLDocument.

Now I want to write the modified document back to the file system.
What I have tried so far is:

writer := XMLWriter new.
xmldoc document writeXMLOn: writer.
writer stream.
f := File openForWriteFileNamed: '/home/jimmie/xmldoc.xml'.
f nextPutAll: (writer write contents).
f flush.
f close.

It does write an xml document to the file system. However, it has
exploded in size. The original is 28mb and is in UTF-8. The newly
written file is 112mb and is UTF-32.

I do not know why the change in encoding or how to correct or manually
set the encoding.

Any help in understanding how to correctly write an XML document that I
have read and minimally modified would be greatly appreciated.

Thanks.

Jimmie







Re: [Pharo-users] Usability issues with Calypso

2017-09-15 Thread kmo
You say The current behaviour is trying to be close to single source pane
behaviour of old browsers. 

I think that's a bit of the problem. For me, nautilus is a single source
pane browser and it looks like a single source pane browser. Calypso looks
like something else - it looks like a typical tabbed editor. So it's
behaviour does not march its look. That's what's confusing.

I don't know what is the best behaviour for the tabs - but I think I would
prefer always manually opening/closing tabs rather than the auto tabs
behaviour - that way I would feel more in control.

Other people's mileage may vary.






--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



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>>#encoding attribute specifies (if recognized), and it's 
portable across Pharo, Squeak, and GemStone. Use #parseFileNamed:/#onFileNamed: 
to get portable automatic file decoding when parsing.

> Sent: Wednesday, September 13, 2017 at 1:02 PM
> From: "Jimmie Houchin" 
> To: "Any question about pharo is welcome" 
> Subject: [Pharo-users] Writing XML
>
> Hello,
> 
> I am attempting to read and write an XML document.
> 
> Currently I have parsed the document successfully. I have basic 
> navigation and have learned how to modify the XMLDocument.
> 
> Now I want to write the modified document back to the file system.
> What I have tried so far is:
> 
> writer := XMLWriter new.
> xmldoc document writeXMLOn: writer.
> writer stream.
> f := File openForWriteFileNamed: '/home/jimmie/xmldoc.xml'.
> f nextPutAll: (writer write contents).
> f flush.
> f close.
> 
> It does write an xml document to the file system. However, it has 
> exploded in size. The original is 28mb and is in UTF-8. The newly 
> written file is 112mb and is UTF-32.
> 
> I do not know why the change in encoding or how to correct or manually 
> set the encoding.
> 
> Any help in understanding how to correctly write an XML document that I 
> have read and minimally modified would be greatly appreciated.
> 
> Thanks.
> 
> Jimmie
> 
>