in reply to Parsing pseudo XML files
OK, I guess it's time to put on my XML-Ayatollah hat once again:
You have 2 choices here: if the data you want to process is really XML, then please, please, please, don't write your own parser but use either XML::SAX::PurePerl (a SAX parser) or XML::Parser::Lite (emulates XML::Parser, just check it thouroughly as it is used to parse SOAP messages in SOAP::Lite, which does not cover all of the XML spec). If the data is not XML (does it include & or < or HTML entities? Are tag names sometines not valid XML names, what about encoding, does it include some latin1 encoded accented characters?) then you can write your own parser (as an XML parser would complain and die) but then please, please, please don't call it XML. It will save you a huge amount of trouble when someone or something that expects XML tries using it.
XML is not the answer for everything. If this is an internal format then it's fine for it to be anything you want. But if you want to use XML then do it right from the start. It will pay off in the long run.
And remember that there are tools that can help you create valid XML, such as XML::Writer, or data bases XML export utilities.
|
|---|