NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Aaaargh! (Score:2)
At least, if you do, don't put it into the XML namespace because that's not what it's producing.
Sorry to come across mad about this, but dealing with invalid XML (and worse, SGML) over the last 5 years has made me bitter and twisted.
For your well formed XML generation needs, I'm open to suggestions as to how I can improve XML::Genx [cpan.org] (within the constraints of the underlying library).
-Dom
Re:Aaaargh! (Score:2)
You really want to see the Perlmonks thread on this (I linked to it in the parent story). XML::Composer can easily produce valid XML and, to be honest, it produces XML much easier than most of the XML modules out there. Rather than slapping my hand when I use a namespace which is illegal or upper-case tags or improperly escaped data (shudder), it trusts me to really mean what I say. However, the fact is that we often have to deal with bad XML and there's no way around it. I hate it. You hate it. We ha
Re:Aaaargh! (Score:2)
And I apologise; I should have read the perlmonks thread first.
As to the name, how about XML::NotWellFormed? It's the most accurate description even if it is an oxymoron.
-Dom
Re:Aaaargh! (Score:2)
I'm leaning towards the name XML::Variant. While I sort of like your name, it really has a strong negative connotation and I don't want to dissaude the poor programmers having to work with bad XML.
Re: (Score:1)
or... (Score:1)
or
XML::Supposed2B
Re: (Score:1)
I still don’t like the idea, even as I understand the predicament. I would suggest you use a templating system instead of writing a module for this. Text:Template and the Template Toolkit can easily produce arbitrarily complex and arbitrarily broken XML output.
(Oh, and please get in touch with the people who’re asking broken XML from you and call them bozos [tbray.org]. Not offensively, of course.)
Re: (Score:2)
Believe me, I already had a phone call with a Yahoo! rep. He was very apologetic but there's not much I can do as a lone developer to shove Yahoo!
XML::Generator? (Score:1)
A friend and I had a similar discussion about generating XML in a simple way today -- we trawled CPAN and found XML::Generator [cpan.org]. Does it do (most of) what you're looking for?
Re:XML::Generator? (Score:2)
I had looked at XML::Generator and I liked it, but it had some problems. First, because of autoload, it's easy to do this:
I probably meant "field". My version forces you to map methods to tags and will die if you try to print a tag that doesn't exist (though you can add methods/tags on the fly).
Also, as far as I can tell, I would not be able to conveniently dump out data in the Yahoo! IDIF format. Here's an snippet:
Re:XML::Generator? (Score:1)
What if you wrote the correct tag name, but it gets inserted in the wrong place? What if the content is bad or a required attribute is missing?
Of course, a schema can only be used to validate well-formed documents…
Re:XML::Generator? (Score:2)
This is not XML, so really it should not be labelled as such. AFAICT it is pretty close to being SGML though. It might even be SGML, the XML declaration would be seen by an SGML parser as a regular PI, you can add a DTD when you parse the file, and unenclosed tags and &\W are valid in SGML. You just need the characters to be in latin1.
So why don't you go and pollute the SGML namespace ;--)
Seriously, I don't think you should release your module in the XML namespace. An IDIF module would be OK, it its o
mirod
Re:XML::Generator? (Score:2)
I have decided not to put this in the XML namespace. That much I agree on.
I can see how that might appear to be what I was doing. I'll be sure to clarify that. Unfortunately, this is a real problem space that developers constantly face: legacy XML "variants" or third-party resources which require malformed XML. Since it's not always possib
Re:XML::Generator? (Score:2)
mirod
Re: (Score:1)
I'm sure the usefulness of this information is long gone for you,
Re: (Score:1)
In Defense of Not-Invented-Here Syndrome [joelonsoftware.com]
Of course, Joel is fun to read because he writes a lot more confrontatively than the subject really warrants. I wrote something related [plasmasturm.org] recently.
Not more bad XML (Score:1)
If you have to generate not-quite-XML or bad XML, then you have a bigger problem. I am no
Re:Not more bad XML (Score:2)
But there's plenty of bad XML out there already and there are programmers who have no choice but to implement it, particularly if it's a third party requirement. Usually this bad XML tends to cause plenty of problems. Why have even more problems by creating yet another hand-rolled module which may or may not do what you want? Programmers in this unfortunate situation should at least be able to get the job done and not waste time having to reimplement something.
The good thing about Data::XML::Variant [cpan.org] is