in reply to PERL/XML
A pointy bracket does not an XML document make!
<!CDATA[ Test tittel ]> - <!CDATA[ test ingres ]> - <![CDATA[ http://www.test.com/test ]]>This is not XML. An XML document is something with a root element and nested elements, something like:
<article> <title>Test tittel</title> <ingres>test ingres</ingres> <url>http://www.test.com/test</url> </article>
You might even want to add an XML declaration at the top of your file, just to make things more clear, and because I see you hitting encoding problems fairly soon in your experiments:
<?xml version="1.0" encoding="ISO-8859-1"?>Then as OeufMayo mentionned you should use an XML parser, at least it parses real XML as opposed to what your code seems to do (I can't tell considering the formatting).
Now after reading your code maybe your document is really an XML document, and I just got confused by the formatting, but in any case, you should still use a parser. If you don't you are not parsing XML but an undefined subset of XML. That will bite you one day.
From what I can guess from your code you use <artikle> as a delimiter between articles. This prevents you from using attributes to the artikle element. You also seem to be wrapping all your text in CDATA. Why not. But then <url>, which you also use a a delimiter is a valid string in any element.
Do yourself a favor and use XML::PYX or XML::Simple. You will be surprised at how easy they are to use and you will know that you have done things right, instead of writing a dirty hack that will crash baddly when you start using it in production code.
|
|---|