[
Lists Home |
Date Index |
Thread Index
]
- To: "Chet Murthy" <chet@watson.ibm.com>,<xml-dev@lists.xml.org>
- Subject: RE: [xml-dev] XML too hard for programmers?
- From: "Dare Obasanjo" <dareo@microsoft.com>
- Date: Tue, 18 Mar 2003 21:52:44 -0800
- Thread-index: AcLt0xniOiL4z7IyQg6GjC51a6UH4AAAFGfw
- Thread-topic: [xml-dev] 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@watson.ibm.com]
> Sent: Thursday, March 13, 2003 10:45 PM
> To: xml-dev@lists.xml.org
> Cc: chet@watson.ibm.com
>
>
> 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>
>
>
|