View mode: basic / threaded / horizontal-split · Log in · Help
December 22, 2005
Juno library (alpha)
I'm releasing an alpha version of my library for Windows programming, Juno. 
Included at this early stage is a collection of XML-processing classes and 
COM helpers. Eventually I hope to make it the D equivalent of ATL for simple 
Windows programming. To this end I am also thinking of incorporating a Win32 
windowing library somewhere along the line.

The XML classes use the MSXML parser for the underlying functionality, and 
the DOM interface is modelled on that used in the .NET Framework (which was 
itself based on MSXML). Features include:

   - Loading from and saving to files (preliminary support for saving to a 
Stream is provided)
   - XPath queries
   - XSLT transformations of XmlDocument objects

To try it out, download the source from: 
http://www.paperocean.org/juno/files/juno.zip

It's currently in a fairly rough but nonetheless usable state. Extensive 
testing has yet to be done. Namespace support is limited (XPath expressions 
with namespaces don't yet work) but that's next on my agenda. I also plan to 
add a SAX implementation (based on the interface at saxproject.org) and 
provide more options for XSLT output.

Here's a snippet:

   import std.stdio, std.cstream, juno.xml.all;

   int main() {
       // Load a document and change some nodes.
       XmlDocument doc = new XmlDocument;
       doc.load("test.xml");

       foreach (XmlNode node; 
doc.selectNodes("descendant:book[author/last-name='Austen']") {
           node.lastChild.innerText = "20.99";
       }

       // Write to stdout
       doc.save(std.cstream.dout);

       // Load an XSLT stylesheet and transform the XmlDocument.
       XslTransform stylesheet = new XslTransform;
       stylesheet.load("simple.xsl");

       Stream stream = new MemoryStream;
       stylesheet.transform(doc, stream);
       writefln(stream.toString());

       return 0;
   }

There's some documentation with examples included in the package, but it's 
fairly brief. More to come.

At this time, I have no plans to port it to other platforms, although I may 
eventually add an option to choose between the MSXML and (cross-platform) 
LibXML parsers.

Please do send me bugs should you come across any (it's quite likely).

John.
December 22, 2005
Re: Juno library (alpha)
> I'm releasing an alpha version of my library for Windows programming,
> Juno. Included at this early stage is a collection of XML-processing
> classes and COM helpers. Eventually I hope to make it the D equivalent
> of ATL for simple Windows programming. To this end I am also thinking
> of incorporating a Win32 windowing library somewhere along the line.
> 
> The XML classes use the MSXML parser for the underlying functionality,
> and the DOM interface is modelled on that used in the .NET Framework
> (which was itself based on MSXML). Features include:
> [...snip...]
> At this time, I have no plans to port it to other platforms, although
> I may eventually add an option to choose between the MSXML and
> (cross-platform) LibXML parsers.
> 
> Please do send me bugs should you come across any (it's quite likely).
> 
> John.
> 

Very nice. I've been needing something to do xsl transformations in D for 
a while now. This will work quite nicely, even if it isn't cross-platform. 
It might be worth it at some point to create a common interface that your 
xml classes use to support different parsers. I realize your library is for 
*Windows programming*, but there are even other parsers available on Windows. 
At work I used to deal with very large XML files and we had a home-grown 
parser that parsed them very fast (without vailidation). Point is it would 
be nice to support an interface for different parsers even if your library 
is for windows only.
Thanks John, I'll let you know if I find any bugs.

Chris
December 22, 2005
Re: Juno library (alpha)
"Chris Lajoie" <ctlajoie@yahoo.com> wrote in message 
news:a8deea6147a68c7d52283f5668a@news.digitalmars.com...
>
>> I'm releasing an alpha version of my library for Windows programming,
>> Juno. Included at this early stage is a collection of XML-processing
>> classes and COM helpers. Eventually I hope to make it the D equivalent
>> of ATL for simple Windows programming. To this end I am also thinking
>> of incorporating a Win32 windowing library somewhere along the line.
>>
>> The XML classes use the MSXML parser for the underlying functionality,
>> and the DOM interface is modelled on that used in the .NET Framework
>> (which was itself based on MSXML). Features include:
>> [...snip...]
>> At this time, I have no plans to port it to other platforms, although
>> I may eventually add an option to choose between the MSXML and
>> (cross-platform) LibXML parsers.
>>
>> Please do send me bugs should you come across any (it's quite likely).
>>
>> John.
>>
>
> Very nice. I've been needing something to do xsl transformations in D for 
> a while now. This will work quite nicely, even if it isn't cross-platform. 
> It might be worth it at some point to create a common interface that your 
> xml classes use to support different parsers. I realize your library is 
> for *Windows programming*, but there are even other parsers available on 
> Windows.

You're right, of course. For what it's worth, I chose MSXML because it's 
quick, robust and feature-complete, plus I'm familiar with using it from C++ 
and most Win32 machines are likely to have it pre-installed.

A common interface is something I might look into once everything's working 
smoothly. I can see how that would be a good idea.

> At work I used to deal with very large XML files and we had a home-grown 
> parser that parsed them very fast (without vailidation). Point is it would 
> be nice to support an interface for different parsers even if your library 
> is for windows only.
> Thanks John, I'll let you know if I find any bugs.

That'd be great, thanks.
Top | Discussion index | About this forum | D home