PDA

Click to See Complete Forum and Search --> : Xml


Matt.Net
Apr 12th, 2002, 12:30 AM
I've been reading about XML replacing INI in the future

What i want to do is use XML with some datasets/dataadapters/sqlconnections.

I want to store object properties like "datasource", "integrated security" etc for a server.

I then want to use the stored data in my sqlconnection.

I know i need to use a XMLReader in my code, but that's where i'm all freaked out cos it looks too complex for me.

Could you post some code, or some commands which i would be using?

Thanks
Matt

Magiaus
Apr 13th, 2002, 11:03 AM
i think xml is a scam, i don't use tech that is shoved down my throat when i already had it

in my humble opinion xml is just a bunch of extra work you don't need

Magiaus
Apr 13th, 2002, 11:06 AM
unless my boss tells me to

Matt.Net
Apr 14th, 2002, 08:12 PM
well, lets say your boss is telling you too.

cos mine is kinda pushing me towards this...

Magiaus
Apr 15th, 2002, 06:03 AM
what do you know? do you know XML 1.0 yet? or are you starting from scratch?

unfortantly M$ is going to make us all use XML I have even read about it replacing relational database like SQL Server. Why? because M$ said so. stupid flat file bs.....

Cander
Apr 15th, 2002, 08:38 AM
no not stupid flat file...STRUCTURED flat file..that is what it is all about.

I think you are on the thinking of XML is a replacement for the database..it is not. It provides a structured way to describe data...something that was laking, especially for cross platform use.

XML is great, when you use it for the right things.

i havent used the xml classes in .NET yet, but you can probably find plenty of examples at

http://www.gotdotnet.com

Magiaus
Apr 15th, 2002, 08:53 AM
I have read 2 books on XML and a book on flash and xml. I know it is structured an i also see uses for it. But I had that 3 years ago i just didn't call it XML. Also as far as XML and the web go that is crap. I have these things called style sheets that i use and well the work without XML (or could be considered a form of xml) but i read articles that tell me i need to use xml with style sheets and that is bs. xml is good for keeping up or documetation so to speak but it is just another layer of work. it is good for property files and the like but anything else it is just ading work to your plate. and maybe i'm wrong but it isn't worth it. instead of a style sheet and a page i now have a xml do a style sheet and the page you do the math my results as far as content look the same.

i am not at all closed minded so please, please make me like XML cause i am going to have to use it

Magiaus
Apr 15th, 2002, 08:55 AM
and people writing code book are saying xml is going to replace sql

Cander
Apr 15th, 2002, 09:07 AM
well css is just for styling a page..not conaprable to XML which is useful to seperate content and data on your web page.. Also XML has a something that goes with it called XSL. This allows you to transform you XML into HTML/another XML format/SVG/whatever...that in itself is a handy tool to make a more dynamic webpage in which the client can do the work saving your server some processing(for instance, your server can create the xml, but the client turns it into html by using XSL.)

Another excellent use for XML as I use it..I have a web based system I wrote that is very traffic intense..Each person has alot of info that needs to be persisted while they are logged on. But the content hitting to a database as they edit data can be a tremendous strain. So what I do is, when a use logs on, their data is all palced into an xml string and placed in a session variable. As they go through the site, any cahnges are made to the XML string very easily..When they log off, then any changes made are sved to the database..

And as far as XML vs. a flat file. Well XML is easy to read and easier to access what you want. I mean how many times have you had to get data from a plain text file by opening it, looping it to find the correct line, then have to parse the hell out of the file to get what you want? In many cases, this is a pain in the butt to write bunches of instr$'s and mid$'s. In xml you just specify the node, all voila you got what you need.

XML is also usefule to transfer data bvetween databases that normally cannot talk to each other..although i have never needed this working in an all MS shop, and you may never need it either, but I have talked to many people who have said this is a god sent for getting Unix data to Windows and vice versa..

Magiaus
Apr 15th, 2002, 09:30 AM
what do you think the XMLParser does for you it pareses the file. or splits it based on the file header

I don't know much about XSL though it isn't covered in the books i have in fact i think i just got bunk books because they don't teach anything about how to use xml just how to make xml except for the flash book it teaches how to use xml with flash.....

Magiaus
Apr 15th, 2002, 09:32 AM
lets not argue about why or why not it is good or redundant lets help matt instead :cool:

MedevH
Apr 15th, 2002, 09:40 AM
Now this is a bit unusual
this whole discussion about XML
I've played with XML usage in flash and just though it was to many tags to deal with.

Why in the world would I want to define text in a <text></text> tag oh well.

I like what cander is saying about the Cross-DB exchange I'm betting there are lots of programmers that find that useful.

I still do not see the replacing of the Relational Database happening. It just doesn't make any sense.

Structured Flat File or Stupid Flat File.

Its still a flat file,
I see XML just like coding in COBOL.
You the programmer have to lay everything out.

I'm not a programmer I'll be the first to say it.
I'm a developer, I don't like typing.
Thats just to much to have to write especially when a database does all that for you.

Magiaus
Apr 15th, 2002, 09:46 AM
you made me get out my XML book and actualy want to start reading again. But I looked in the index and XSL is barely covered..... and that sounds like the good part. i'm on chapter 13: Creating a Basic XML Document. page 184 and now i finally get to make a document...... recomended reading..?

Magiaus
Apr 15th, 2002, 09:54 AM
00010 IDENTIFICATION DIVISION.
00020 PROGRAM-ID. FIK_DICH.
00030 AUTHOR. Magiaus.
00040 *
00050 ENVIORMENT DIVISION.
00060 *
00070 DATA DIVISION.
00080 *
00090 PROCEDURE DIVISION.
00100 DO-IT.
00110 DISPLAY "Fik Dich Mein Houndien."
00120 STOP RUN

Cander
Apr 15th, 2002, 10:27 AM
the point I was making about the parsing is that YOU, the developer, doesnt have to do the parsing.

BTW who is arguing, just trying to explain XML as far as usefulness and practicallity..not just theory..;)

if you want to get some quick down and dirty info on XSL, you should goto

http://www.xml101.com

they have some good quick startting info on using XSL to transform XML into html..


Another coolness factor of XML and XSL that many people dont know about, is you can use XSL to turn an XML document into SVG. SVG is an xml based language that lets you do pretty much what flash does. It is pretty cool to be able to create dynamic images and animation using this.

Ok as far as helping him out, I gave alink to soemwhere with soem tutorials as I just havent used XML in .NET as of yet, so I havent studied that class.

Magiaus
Apr 15th, 2002, 10:43 AM
:cool:

MedevH
Apr 15th, 2002, 02:51 PM
Cander...How much XML do you use on a daily basis?
And do you have any other resources on it other than the link provided?

You've got me interested in it again too.

Oh one other question,
just thought I'd ask Do you have anything on XML inside of FLASH

I've looked and most of the time they talk about the Basics,
Well I have a concept of the basics.

Matt.Net
Apr 15th, 2002, 06:17 PM
yes, do help me.

i think using XML to store properties is what i'm hoping to do.

As for my experinece in XML, i basically only know how to make the XML files. That's it.

Basically, i'm 19, have a limited knowledge of VB from high school, and have been thrust into the VS.Net fold.

Matt

Magiaus
Apr 15th, 2002, 09:17 PM
I have to do a little research on using it in .net but i will post something

Lethal
Apr 15th, 2002, 09:33 PM
From my personal experience, I think XMl and XSL rock. On the project that I am working on (and past projects), we don't use private variables in our business objects to store our data, rather, we use a XML document. Our property let and gets just read/write directly against the xml doc. We've even used the MSXML parser to transform our setup install into Base64 and stream it across the intranet. The possibilities are endless. XML will be huge for a long time..

Magiaus
Apr 15th, 2002, 09:57 PM
here is some reading

The XmlReader class is an abstract base class that provides non-cached, forward-only, read-only access. The XmlReader class checks that the XML is well-formed, and throws XmlExceptions if an error is encountered. It can read a stream or a document, and it implements the namespace requirements outlined in the recommendation provided by the W3C located at www.w3.org/TR/REC-xml-names.

Being an abstract base class enables you to customize your own type of reader or extend the current implementations of XmlTextReader, XmlValidatingReader, and XmlNodeReader classes.

The XmlReader class also defines methods that enable you to pull data from XML or to skip unwanted records. XmlReader is unlike the SAX model, which is a push model with the parser pushing events to the application. For more information on a comparison to SAX, see Comparing XmlReader to SAX Model.

The XmlReader class has methods to:

Read XML content when the content is available in its entirety, for example, an XML text file.
Find the depth of the XML element stack.
Determine if an element has content or is empty.
Read and navigate attributes.
Skip over elements and their content.
The XmlReader class has properties that return information, such as:

The name of the current node.
The content of the current node.
Implementations of the XmlReader class extend the base class and vary in their design to support different scenario needs. The following table describes the implementations of the XmlReader class.

Class Description
XmlTextReader Class Reads character streams. It is a forward-only reader that has methods that return data on content and node types. There is no Document Type Definition (DTD) or schema support.
XmlNodeReader Class Provides a parser over an XML Document Object Model (DOM) API, like the XmlNode tree. Takes in an XmlNode, it returns whatever nodes it finds in the DOM tree, including entity reference nodes. There is no DTD or schema validation support but it can resolve entities defined in DTD.
XmlValidatingReader Class Provides a fully compliant validating or non-validating XML parser with DTD, XML Schema definition language (XSD) schema or XML-Data Reduced (XDR) schema support. Takes an XmlTextReader and layers validation services on top.
Customized XML Reader Creation Allows developer-defined derivations of the XmlReader.

The XsltReader is another implementation that does not have a public constructor. It is created as a result of calling the Transform method on the XslTransform class. The XsltReader provides the following functionality:

Enforces the rules that XML must be well-formed.
Does not validate against DTDs or schemas.
Does not expand default attributes, because DTD information (DOCTYPE nodes) are not exposed in the XPath Data Model. See the XmlReader.IsDefault property. If you need to expand default attributes in the source document before applying a transformation, then the data store (for example, XmlDocument) needs to be loaded through an XmlValidatingReader.
Each of the classes, XmlTextReader, XmlValidatingReader, and XmlNodeReader, are designed to support different scenarios. The table below describes which reader to use for each scenario, and what value to give the ValidationType property.

Scenario Reader to use ValidationType property
Needs greater performance and does not need any DTD or Schema support. XmlTextReader Not available.
Requires the XML to be well-formed, including external entities and DocTypes with a supplied DTD. XmlTextReader Not available.
Needs XML to be valid and well-formed according to the DTD. XmlValidatingReader Auto or DTD.
Needs XML to be well-formed and validated against a schema. XmlValidatingReader Auto when no DTD is available, or XDR schema.
Needs XML to be well-formed when streaming XML data from an XmlNode. XmlNodeReader Not available.

The following table describes how the XmlResolver and XmlTextReader.Normalization properties on the various readers can be set to achieve each scenario.

The Normalization property, when set to true, removes white space in attribute values and does character range checking. As a result, setting the Normalization property to true results in slower performance than when it is set to false, which is the default value. For more information, see XmlTextReader.Normalization Property.

Scenario XmlResolver Normalization property
Needs greater performance and does not need any DTD or Schema support. Set to null reference. For more information, see XmlTextReader.XmlResolver Property. Set to false.
Requires document to be well-formed, including external entities and DocTypes with a supplied DTD. Set to non-null reference. All external entities must be resolvable. For more information, see XmlTextReader.XmlResolver Property. Set to true.
Needs document to be well-formed, and needs the XML to be valid according to the DTD. Set to non-null reference. All external entities must be resolvable. For more information, see XmlValidatingReader.XmlResolver Property. Set to true on XmlTextReader before being passed to XmlValidatingReader.
Needs document to be well-formed and needs schema validation. Set to non-null reference. All external entities must be resolvable. For more information, see XmlValidatingReader.XmlResolver Property. Set to true on XmlTextReader before being passed to XmlValidatingReader.
Needs document to be well-formed when streaming XML data from an XmlNode. Not available. Not available.

The XmlResolver property is used for resolving external DTD and schema location references. The XmlResolver is also used to handle any import or include elements found in XSD schemas. Setting the XmlResolver property to null means that the application does not resolve external references. If this property is set to null and an external DTD or entity is encountered, the external DTD or entity is ignored.

Matt.Net
Apr 15th, 2002, 11:38 PM
and in English...?

Just kidding, thanks for that. it'll take a while for me to comprehend all of that.

So basically, i would use the XMLReader to return the name of the node, and if that matches with whatever i want, then i can use another method to return the properties i have stored?

Matt

Magiaus
Apr 15th, 2002, 11:48 PM
i was going to but i got distracted by some stuff on the general board, but i think that is the idea

Matt.Net
Apr 15th, 2002, 11:59 PM
so to return the properties, it would be something like :
where node = [servername]..?

i'm a little more confident now to give it a go...

its funny how your attitude to XML has changed

Magiaus
Apr 16th, 2002, 12:01 AM
at first i was just being funny because i don't like it much and didn't know what cander informed us about so yeah it changed some

i am about to try and make a small xml app so i'll post something soon

Magiaus
Apr 16th, 2002, 12:16 AM
<?xml version = "1.0"?>
<!ELEMENT blankProps [
<!Element propArrayOne (info, moreDetail,evenMore)>
]>

i am going to have to do a little rereading i have forgotten a bunch of this but lets make a doc and see what we can do

Magiaus
Apr 16th, 2002, 10:51 PM
sorry but i'm not going to be able to do anything on this xml help for a day or two

maybe someone else will help out

i will post in a day or two though

Matt.Net
Apr 16th, 2002, 11:50 PM
don't worry.

i'm now working on something a little more important.

i'll be back for help in about a week or two