Re: [Mono-list] Xml reading & writing.

2008-09-17 Thread Neil Munro
2008/9/17 Jonathan Pryor <[EMAIL PROTECTED]>

> On Wed, 2008-09-17 at 02:43 +0100, Neil Munro wrote:
> > I have an xml file that is my applications preferences, it's an update
> > tool, now this update tool can update from multiple sources. If no
> > preferences file is found on first run, a default set are saved. Now
> > if the user wishes to add a new update source to the xml file I need
> > to place the blah in the correct part of
> > the file, since the file holds ALL application preferences, I can't
> > just dump a new source at the end of the text file.
> >
> > I guess my question is, what's the best way to solve this problem?
>
> As with many things, there are *several* ways to do this:
>
>  * System.Xml.XmlDocument:
>http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx
>Provides a DOM oriented XML manipulation API.
>Pro: Somewhat easy to use.
>Con: Loads the entire document into memory, so not very useful for
> large documents.


This looks like the solution I am going to go for.


>
>
>  * System.Xml.XmlReader & System.Xml.XmlWriter:
>http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx
>http://msdn.microsoft.com/en-us/library/system.xml.xmlwriter.aspx
>Pro: Provides a "pull-model" API so that the entire document need
> not be loaded at once.
>Con: Not as easy to use as XmlDocument.
>
>  * System.Xml.XPath.IXPathNavigable
>
> http://msdn.microsoft.com/en-us/library/system.xml.xpath.ixpathnavigable.aspx
>Allows reading/writing of XML-like data w/o requiring XML, but
>needs an actual implementation that supports reading/writing,
>which XmlNode (and thus XmlDocument) do.
>
> And I'm probably missing a few...
>
> Unless you're working with a large document (read: several MB and
> larger), I'd suggest either XmlDocument or IXPathNavigable for starters.
>
>  - Jon


So I have this:

// Save it in the prefs.xml file.
XmlDocument xmlDoc = new XmlDocument( );

xmlDoc.Load( sPath_To_Prefs_File );

Now I know that the whole document is loaded into memory at this point, how
would i traverse the document in memory to get to the 
section, read until there are no more of that tag and add a new update
source after the last one and before the next line?
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Xml reading & writing.

2008-09-16 Thread Neil Munro
Hey I have what I believe might be quite a common problem, and while I could
find a way to solve it just using my own code, I imagine what I believe is
such a common operation will have a way of solving it.

I have an xml file that is my applications preferences, it's an update tool,
now this update tool can update from multiple sources. If no preferences
file is found on first run, a default set are saved. Now if the user wishes
to add a new update source to the xml file I need to place the
blah in the correct part of the file, since the
file holds ALL application preferences, I can't just dump a new source at
the end of the text file.

I guess my question is, what's the best way to solve this problem? I mean I
could write a function that reads the document in line by line, storing it
in program then adding a new update source at the correct point (in memory)
then dumping it back to the file, but this seems horribly inefficient.

Thanks
Neil Munro
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Can't build a stand alone mono environment.

2008-01-09 Thread Neil Munro
I am following the instructions here
http://www.mono-project.com/Parallel_Mono_Environments#Source_from_Version_Control_.28Mono_SVN.29to
try and build an independent mono environment so I can use the latest
features and the latest monodevelop however I can't quite get monodevelop
working right. I'm going to rebuild the packages from scratch, but a list of
packages to build in the correct order would be a help right now. I am going
to install into /opt but I also need to know something regarding the file
you run source on.

I run ubuntu 7.10 and don't really know where gnome is installed into, thus
had to take a guess based on the results of whereis gnome. If someone can
just help me out I'd really appreciate it, I get so far and just get stuck
and would just like to be working on my project again.

#!/bin/bash
MONO_PREFIX=/opt/mono
GNOME_PREFIX=/opt/gnome
export LD_LIBRARY_PATH=$MONO_PREFIX/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$MONO_PREFIX/include:$GNOME_PREFIX/include
export ACLOCAL_PATH=$MONO_PREFIX/share/aclocal
export PKG_CONFIG_PATH=$MONO_PREFIX/lib/pkgconfig:$GNOME_PREFIX/lib/pkgconfig
PATH=$MONO_PREFIX/bin:$PATH
PS1="[mono] \w @ "
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


[Mono-list] Help with a project

2007-11-29 Thread Neil Munro
Hey, I am trying to write an experimental program to see if Web2.0 can be
used for anything critical in the computing world, so I have started a
project for using RSS feeds as software update sources, however I am having
trouble actually getting things to work, I believe I need to be working with
XPath and have followed tutorials and gotten no-where.

My current thinking is to extract the enclosure tags from an RSS feed. But I
am having trouble doing this, I will post my code if people think they can
help me, and I don't know if this channel is for coding help, it was
suggested to me, but if it's not is there a code mailing list?

Thanks
Neil Munro
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list