[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XML too hard for programmers?
Tim is basically asking for pull-based XML parsers, implementations of which exist in .NET Framework and the Java world. There isn't much difference between his mythical Holy Grail example while (<STDIN>) { next if (X<meta>X); if (X<h1>|<h2>|<h3>|<h4>X) { $divert = 'head'; } elsif (X<img src="/^(.*\.jpg)$/i>X) { &proc_jpeg($1); } # and so on... } and its C# equivalent which has been available in the .NET Framework for over a year while (xmlreader.Read()){ if(reader.NodeType.Equals(XmlNodeType.Element) && reader.Name.Equals("meta")){ continue; } if((reader.Name.Equals("h1") || reader.Name.Equals("h2") || reader.Name.Equals("h3") || reader.Name.Equals("h4")) && reader.NodeType.Equals(XmlNodeType.Element)){ divert = "head"; }else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.Name.Equals("img")){ string jpegurl = reader.GetAttribute("src); if((jpegurl != null) && jpegurl.EndsWith(".jpg")){ ProcessJpeg(jpegurl); } } } His Perl + pseudocode is more verbose than the actual C# code but the functionality he claims to want is right there and terseness isn't really a place where C# can compete with Perl anyway. Tim's post indicates that he is quite disconnected from the world of modern XML programming practices, I especially like his "The notion that there is an 'XML data model' is silly and unsupported by real-world evidence" quote. I'm interested in what criteria he used to determine that the thousands of users of XPath, XSLT and the DOM don't count as "real-world evidence". -- PITHY WORDS OF WISDOM Never eat yellow snow. This posting is provided "AS IS" with no warranties, and confers no rights. > > > -----Original Message----- > From: Chet Murthy [mailto:chet@w...] > Sent: Thursday, March 13, 2003 10:45 PM > To: xml-dev@l... > Cc: chet@w... > > > Regarding Tim's comments, I was wondering if anybody had good > examples of the sort of XML processing that Tim is talking about. > > I wrote some processors to deal with the dmoz.org RDF files, > and found that streaming XML processing wasn't trivial, but > that with sufficient tool support, it wasn't bad at all. > > But I thought I'd ask the community if anybody had good > examples of this. > > Basically, I think that with a sufficient library of > examples, in the form of a set of inputs, a program which > processes them, and a complaint about why the program is > uglier than it should be, a developer could go off and try to > improve the situation. > > The larger the library, the better-informed that developer would be. > > Me, I have a lot of RDF stuff. But RDF/XML is itself rather > weird and crufty, in ways which far surpass XML, so that's > not a good example. > > --chet-- > > ----------------------------------------------------------------- > The xml-dev list is sponsored by XML.org > <http://www.xml.org>, an initiative of OASIS > <http://www.oasis-open.org> > > The list archives are at http://lists.xml.org/archives/xml-dev/ > > To subscribe or unsubscribe from this list use the subscription > manager: <http://lists.xml.org/ob/adm.pl> > >
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|