 |
|
|
 |
|
|
 |
|
 |
Maybe it does but I really dont want to spend horus f***ing around trying to figure out why I followed your guide and it doesnt work. Thanks for wasting my time a**hole!
|
|
|
|
 |
|
 |
Not mentioning what the other mentioned below, because that part is obvious, I like how you give an XML example then represent it with the code. Some have code examples without the XML that they are testing with. However, why only write a portion of an article? Articles about a subject should cover all the major aspects of that subject? When talking about XML, you should talk about Reading from file to a string, Searching the string, Updating the string, and Saving from string to an XML file. Most people are not generating going around just creating XML files. Beginners will create the XML file on their HD based on the demo, then use example code to read it, search through it for specific data, update it, then write it back to the XML file. This covers the most important aspects of XML and will help a beginner better understanding of how this information is used.
--
Chizl
|
|
|
|
 |
|
 |
In all my laziness I tried to find some article to fast read/write xml in C# and came across this one. I have to say this is one of the bad XML structures I've seen. XML newbies should not read this article at all. I agree with "You've totally undermined the hierarchical nature of XML" comment.
|
|
|
|
 |
|
|
 |
|
 |
I Agree with the comment "You've totally undermined the hierarchical nature of XML"
|
|
|
|
 |
|
 |
I have to agree with the comments about 'You've totally undermined the hierarchical nature of XML' - nice article nicely written - good commenting - but not really the best use of XML.
|
|
|
|
 |
|
 |
verry nice and simple article! cheer's
|
|
|
|
 |
|
 |
But this below step i can't follow.. Im new to Visual C# 2008 which I am using... where is XML menu? (XML> Create Schema)
Creating the schema (.XSD) file for validating our just made .xml file)
Go to menu XML -> Create Schema.
Notice that in the solution explorer, it has created a file XMLFile1.xsd.
Also notice what the IDE (Integrated Development Environment) has added in <Book> tag of ours.
It signifies our .xml file will be validated against which Schema file.
|
|
|
|
 |
|
 |
I'm using Visual C# 2005 and I'm having the same problem.
The XML menu is only found in Visual Studio, not the express edition.
I know this can be done in a much easier way, but I can't remember how.
|
|
|
|
 |
|
 |
i am using visual c# 2005 while creating the xsd file once i click on create schema on solution exploreer there is no xsd file ceated on the from itself it shows
what shd i do now urgent (
|
|
|
|
 |
|
 |
Hai irfan!
Thanks for your article, really going to help me a lot!
What is the use of validation here! Can u please explain it, i have some doubt with that!
also explain me whether it will validate against attributes or elements?
because in my project i am using length as one of the attribute, how to check this length that agains my input for that particulat node?
i have no option to create schme, if i give add new item ->xml schema then it will give new schma, but i want to get the schema for our xml file, how could i do that? please help me!
i dont have the XMl menu in my .NET IDE. how could i get this?
please help me!
|
|
|
|
 |
|
 |
Thanks for the example. A question however - I dont understand why you are reading the same xml file twice? once for reading/validating it and then again for reading it. any particular reasons? wouldnt it be less time expensive if the validator passed back a reader object if the validation was successful.
|
|
|
|
 |
|
 |
My question doesn't really have impact on this article but for the fact that it is about xml. i'm quite new to xml so still figuring out babysteps.:->
using c# i'm witing data to xml with the xmltextwriter class. then using xsl stylesheet i view the data via html.
all i still need to do is add one tag.
<?xml:stylesheet type="text/xsl" href=""?>
this must be done via c#, is there a way i do this via the xmltextwriter or do i need to do something else.
Any help wil be appreciated.
Thanx in advance.
-- modified at 0:45 Friday 13th January, 2006
|
|
|
|
 |
|
 |
Personally, I think this is a very bad article for beginners. It looks like you are not very familiar with either C# or XML.
The article code is hard to read and is not the proper way to be accomplishing the goals here.
I've been programming XML for 3 years and C# for 1 1/2 years and I'm confused.
|
|
|
|
 |
|
 |
Hey...
I noticed some people critiquing your XML skills. I've decided to critique your C# skills.
Gone are the days of using m_ to prefix member variables. Instead you should use something like
public void Test( string TestVariable )
{
this.TestVariable = TestVariable;
}
You do not need to prefix object instances with Obj since everything in C# is derived from System.Object. Instead, you can prefix with something more reader friendly such as...
XmlDocument MyXmlDocument = new XmlDocument( );
or....
XmlDocument BooksXml = new XmlDocument( );
There is a truth about speaking the language of the land.
|
|
|
|
 |
|
 |
Hello there,
Thanx for your article, it put me on the right track, but an important yet crucial piece of information in missing :
In your xml root node you should specify 'xmlns="targetNameSpace"',
where targetNameSpace has the same value of the 'targetNamespace=""' specified in the root of the xsd used. If you don't to this everything validation you do seems fine, always !!
Another problem with your code is that in the finally block you close all used reader without
checking them first to be different from null, meaning that your finally block itself would
throw an 'object null reference exception'.
The next time be a bit more strict, it's needed in programming
Erlend Robaye
Fluxys N.V.
Belgium
Erland.Robaye@fluxys.net
|
|
|
|
 |
|
 |
There are so many tools that claim to be OBJECT Oriented, it is getting out of hand to be able to know the good from the bad and ugly.
XML is certainly a good thing, but which too to use to develop OOC and which other languages to use: C++, Java, etc.
What is the role of UML when developing using XML. Do you need UML? I am certainly confused!!!!!!!!!!!!!!!!
I will be glad to participate in forums related to Software Modeling, Simulation, Code Generation, and Reverse Engineering
|
|
|
|
 |
|
 |
You should never rely on items being stored in any particular order in XML as you do in this article. By doing so you are only asking for problems. Instead of writing the file as: <Book> <Title>Title A</Title> <Title>Title B</Title> <ReleaseDate>2004</ReleaseDate> <ReleaseDate>2002</ReleaseDate> etc... etc.. etc... </Book> you should be doing this: <Books> <Book> <Title>Title A</Title> <ReleaseDate>2004</ReleaseDate> </Book> <Book> <Title>Title B</Title> <ReleaseDate>2002</ReleaseDate> </Book> etc...etc... etc... </Books> you can then select out each book node by using SelectNodes(...) and XPath notation, and then iterate over the result collection to read the data. -mdb
|
|
|
|
 |
|
 |
Apart from this xml representation of data, over-all he tackle the xml-subject nicely, especially for the beginners!.. We should encourage new commers, atleast they have the courage to publish something... Good Job Patel
|
|
|
|
 |
|
 |
Sonia Gandhi wrote:
Apart from this xml representation of data, over-all he tackle the xml-subject nicely, especially for the beginners!.. We should encourage new commers, atleast they have the courage to publish something... Good Job Patel
Sonia - you are totally wrong on the 'especially for beginners'. Beginners should be taught the RIGHT way to do things, not the WRONG way. This article presents the WRONG way. This will only lead to confusing them about the purposes and capabilities of XML. Its like teaching beginning math students that parentheses in math equations are just there to make them look nicer.
Patel - I'm glad you are willing to submit articles. Thanks for this - I haven't submitted even one so you are one up on me in this category. I can only assume that the source of this particular article came from your personal experience and how you use XML. Let me just say that you are not using it the way it was intended - you might as well be using your own custom file format.
-mdb
|
|
|
|
 |
|
 |
Hey guys!!
This is Irfan Patel.
Thanx for your criticism fuzzylintman.
True I have undermined XML but thats what I intended to do. XML is something very powerful and complex for that matter specially for beginners and my article was for beginners. Inspite of having 6yrs in development experience I spent days to figure out what is what!!!
Thats the reason I took the simplest XML example of only two layers deep which as you have said truly undermined the power of XML.
Thanx fuzzylintman for encouraging me to write BETTER
And thanx sonia for encouraging me to write MORE !!
Irfan Patel (MCSD)
Technical Architect
New Mumbai, India
|
|
|
|
 |
|
 |
Irfan,
I understand XML fine, but new to C#. When I pull your downloaded project in I have not problem.
But when I build from scratch, it does not build correctly with identical code. I have problem getting to Classes folder see below for reference. Please help in setup or what I need to work properly. Thanks-alex
C:\Documents and Settings\alex\My Documents\Visual Studio Projects\XMLReadWrite_alex\Form1.cs(4): The type or namespace name 'Classes' does not exist in the class or namespace 'XMLReadWrite_alex' (are you missing an assembly reference?)
|
|
|
|
 |
|
 |
Dear Alex,
Yes there is a quite visible error.
Looking at your message I can make out that it is the Namespace which is harassing you.
You have chosen a namespace 'XMLReadWrite_alex' and the source code I have attached has 'XMLReadWrite'.
Hence if you try to access the classes folder you have to give
'XMLReadWrite_alex.Classes' as the namespace.
Hope it suffice your needs.
Irfan Patel (MCSD)
Technical Architect
New Mumbai, India
|
|
|
|
 |