Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# VB.NET
Hi Folks,
I want to create a Xml file Like
<?xml version="1.0" encoding="UTF-8"?>
<NikuDataBus xmlns:xsi="" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_read.xsd">
  <Header version="8.0" action="read" objectType="contentPack" externalSource="NIKU">
    <!-- you change the order by simply swap 1 and 2 number in the name attribute -->
    <args name="order_by_1" value="code"/>
    <args name="documentLocation" value="C:\niku"/>
    <Filter name="code" criteria="EQUALS">xogHelloWorld</Filter>
Please Help me !
Adersh Ram BK
Posted 2-Oct-12 2:28am
Sandeep Mewara at 2-Oct-12 7:40am
What have you tried so far? Where are you stuck?
Adersh Ram at 2-Oct-12 7:40am
Creating the fist name spaces (second and third line )
Sandeep Mewara at 2-Oct-12 7:49am
If they are known and fixed. Hard code it before forming the body of XML.
Adersh Ram at 2-Oct-12 7:51am
sometimes it will change some condition, so it cannot hard code that....
Is there any way to do that
Sandeep Mewara at 2-Oct-12 7:54am
Then based on condition hardcode it. I don't think there is any other way.
Adersh Ram at 2-Oct-12 7:57am
ok, thanks for your quick reply.
Sergey Alexandrovich Kryukov at 2-Oct-12 12:49pm
Could be done via serialization. Anyway, I provided a short overview of nearly all approaches available in .NET, please see my answer.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

This is my short overview of what you already have from .NET:
  1. Use System.Xml.XmlDocument class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.
  3. Use the classes System.Xml.XmlTextWriter and System.Xml.XmlTextReader; this is the fastest way of reading, especially is you need to skip some data.
  5. Use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, supporting LINQ to XML Programming.
Also, I'm not sure that you really need to write/read XML directly. Chances are, you need to use Serialization:[^],[^],[^].
Nearly the most comprehensive and easy-to-use method of serialization is the one based on Data Contract:[^].
Please also see my past answers where I advocate this approach:
How can I utilize XML File streamwriter and reader in my form application?[^],
Creating property files...[^].
Good luck,
Sandeep Mewara at 2-Oct-12 13:11pm
Good enough. My 5!
Sergey Alexandrovich Kryukov at 2-Oct-12 13:13pm
Thank you, Sandeep.
Maciej Los at 2-Oct-12 14:52pm
Agree, my 5 too!
Sergey Alexandrovich Kryukov at 2-Oct-12 15:23pm
Thank you, Maciej.
Adersh Ram at 2-Oct-12 15:17pm
Thanks SA
It is really helpfull, sorry for late reply....!
Sergey Alexandrovich Kryukov at 2-Oct-12 15:24pm
You are welcome.
Late reply is not a problem at all; I get all notifications.
So, are you going to accept the answer formally (green button)? -- thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 200
1 George Jonsson 175
2 Kornfeld Eliyahu Peter 169
3 PIEBALDconsult 110
4 Richard MacCutchan 85
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294

Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 2 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100