зеркало из https://github.com/mono/mail-archives.git
99 строки
3.1 KiB
HTML
99 строки
3.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-list] Modify XML Docs
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:miguel%40ximian.com">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
|
|
<LINK REL="Previous" HREF="016140.html">
|
|
<LINK REL="Next" HREF="016142.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-list] Modify XML Docs
|
|
</H1>
|
|
<B>Miguel de Icaza
|
|
</B>
|
|
<A HREF="mailto:miguel%40ximian.com"
|
|
TITLE="[Mono-list] Modify XML Docs">miguel@ximian.com
|
|
</A><BR>
|
|
<I>05 Oct 2003 14:38:24 -0400</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="016140.html">[Mono-list] Modify XML Docs
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016142.html">[Mono-list] Modify XML Docs
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16141">[ date ]</a>
|
|
<a href="thread.html#16141">[ thread ]</a>
|
|
<a href="subject.html#16141">[ subject ]</a>
|
|
<a href="author.html#16141">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>Hello,
|
|
|
|
><i> Im creating an app (mBloggy, to post 'posts' to a blog), however I'm
|
|
</I>><i> going to use a xml file to save the user configuration (the blogs).
|
|
</I>><i> Today I can write (JUST new files), read it and identify some parts, but
|
|
</I>><i> I dont undestand what the inet says about modifying xml files, so How
|
|
</I>><i> can I modify an xml file? to modify nodes and remove elements, for
|
|
</I>><i> example:
|
|
</I>><i>
|
|
</I>><i> <mbloggy>
|
|
</I>><i> <account>
|
|
</I>><i> <username>Pablo</username>
|
|
</I>><i> <password>Crypted</password>
|
|
</I>><i> <identifier>Personal WebSite</identifier>
|
|
</I>><i> <url><A HREF="http://pablo.com.mx/xmlrpc.php</url">http://pablo.com.mx/xmlrpc.php</url</A>>
|
|
</I>><i> </account>
|
|
</I>><i> <account>
|
|
</I>><i> ... the same..
|
|
</I>><i> </account>
|
|
</I>><i> </mbloggy>
|
|
</I>
|
|
This sounds like a prime candidate for XmlSerialization, use:
|
|
|
|
public class mbloggy {
|
|
public Account [] accounts;
|
|
}
|
|
|
|
public class account {
|
|
public string username;
|
|
public string password;
|
|
public string identifier;
|
|
public string url;
|
|
}
|
|
|
|
mbloggy m = new mbloggy ();
|
|
account a = new Account;
|
|
m.accounts = new Account [1];
|
|
m.accounts [0] = a;
|
|
a.username = "Miguel";
|
|
a.identifier = "...";
|
|
|
|
XmlSerializer s = new XmlSerializer (typeof (mbloggy));
|
|
s.Serialize (Console.Out, m);
|
|
|
|
Miguel
|
|
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="016140.html">[Mono-list] Modify XML Docs
|
|
</A></li>
|
|
<LI> Next message: <A HREF="016142.html">[Mono-list] Modify XML Docs
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#16141">[ date ]</a>
|
|
<a href="thread.html#16141">[ thread ]</a>
|
|
<a href="subject.html#16141">[ subject ]</a>
|
|
<a href="author.html#16141">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|