Perl & XML
The book starts out with a brief explanation of why XML and Perl are well-suited for each other. It then provides a teaser of things to come: an explanation of how to use the XML::Simple module. The first chapter concludes with some warnings and gotchas that seem a little premature since they have not really explained XML. Fortunately, most of these gotchas are covered in context later in the book.
The second chapter provides a whirlwind overview of XML -- covering its structure, DTDs, schemas, and XSLT (transformation). The discussion of XML in general, its history, and parts of an XML document are well done. They give someone who is familiar with static HTML the needed background to understand the structure of an XML document and the vocabulary used to describe it. Unfortunately, the discussion of where XML begins to distinguish itself from HTML, namely with DTDs, the new replacement for DTDs called schemas, and the transformation language XSLT, is too brief. They gloss over these topics with little explanation and few examples. That said, there are other books that do provide more in-depth coverage of XML (this book only promises an introduction).
The next five chapters cover Perl modules designed to process XML, starting with simple parsers and writers. Only methods and syntax relating to XML processing are explained. Therefore, if you are considering reading this book, you should be fairly comfortable with Perl and object-oriented (OO) interfaces to CPAN modules (nearly all the modules discussed provide OO APIs). Again, there are other books and perldoc documentation that cover Perl and it's OO features; so read them first if you are not familiar with OO Perl. If you are familiar with OO Perl, these chapters provide a good overview of the different ways XML can be processed (stream- and tree-based approaches), the advantages and disadvantages of each, and the Perl modules best suited for each approach. These chapters are the biggest strength of this book. The modules discussed in these chapters are by no means an exhaustive list of XML-related modules available from CPAN nor do the explanations of each module cover everything the module does. These chapters do, however, provide the reader with enough information that she can begin to process XML documents intelligently and know where to turn when she needs more information.
The next chapter, Chapter 8, covers XML tree iterators, XPath, XSLT, and XML::Twig. All of these topics are covered in a span of 16 pages (with only slightly over two pages dedicated to XSLT). Indeed, after reading the chapter, you may get the feeling that it was only included so the authors could cram more trite colloquialisms into the book. The short shrift given to these topics creates the impression, which is strengthened in the chapters that follow, that this book was rushed a bit to press.
Chapter 9 discusses applications of XML, including RSS and SOAP, and Chapter 10 is mostly example code. These chapters are intended to give you a feeling for what is possible without really giving you enough information to make it happen. The main problem with these chapters are the examples: the examples are long and the explanations are short. Thus, they are more useful as templates or a quick reference than for learning these topics in detail. Of course, the authors never promised you would be programming SOAP applications when you were done reading this book. And again, there are other books out there which discuss these topics in more detail. So the authors stay true to their promise throughout the book: they will introduce you to XML and tell you how to interact with XML using Perl, no more.
Personally, I found this book did, in general, give me enough information to get started using XML and pointed me where I needed to go to get more information. I am an experienced Perl programmer who is new to XML and comfortable with on-line documentation. This book seems to be written for people who fit this profile and who want to learn by doing (finding the answers to the "hard" questions as they arise). It does introduce a wide variety of XML-related topics and the Perl modules used to interact with them, which is what the authors promised to do in the preface. While it is by no means an authoritative text on Perl and XML, there is something to be said for keeping promises ...
Index As with most first-edition books, the index was adequate but not complete. For example, XML::Twig, which has an entire section covering it, does not appear in the index at all.
Contents
Preface
- Perl and XML
- Why Use Perl with XML?
- XML Is Simple with XML::Simple
- XML Processors
- A Myriad of Modules
- Keep in Mind ...
- XML Gotchas
- An XML Recap
- A Brief History of XML
- Markup, Elements, and Structure
- Namespaces
- Spacing
- Entities
- Unicode, Character Sets, and Encodings
- The XML Declaration
- Processing Instructions and Other Markup
- Free-Form XML and Well-Formed Documents
- Declaring Elements and Attributes
- Schemas
- Transformations
- XML Basics: Reading and Writing
- XML Parsers
- XML::Parser
- Stream-Based Versus Tree-Based Processing
- Putting Parsers to Work
- XML::LibXML
- XML::XPath
- Document Validation
- XML::Writer
- Character Sets and Encodings
- Event Streams
- Working with Streams
- Events and Handlers
- The Parser as Commodity
- Stream Applications
- XML::PYX
- XML::Parser
- SAX
- SAX Event Handlers
- DTD Handlers
- External Entity Resolution
- Drivers for Non-XML Sources
- A Handler Base Class
- XML::Handler::YAWriter as a Base Handler Class
- XML::SAX: The Second Generation
- Tree Processing
- XML Trees
- XML::Simple
- XML::Parser's Tree Mode
- XML::SimpleObject
- XML::TreeBuilder
- XML::Grove
- DOM
- DOM and Perl
- DOM Class Interface Reference
- XML::DOM
- XML::LibXML
- Beyond Trees: XPath, XSLT, and More
- Tree Climbers
- XPath
- XSLT
- Optimized Tree Processing
- RSS, SOAP, and Other XML Applications
- XML Modules
- XML::RSS
- XML Programming Tools
- SOAP::Lite
- Coding Strategies
- Perl and XML Namespaces
- Subclassing
- Converting XML to HTML with XSLT
- A Comics Index
You may also want to check out Erik T. Ray's home page, Jason McIntosh's home page, or O'Reilly's page for the book. You can purchase Perl & XML from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
dAFSdF Dd aSd..aFsfssaf af.s.S.ffFaASS aa SdSDAS.FDdFd..SadDSsfdsA..s .saDAFDa Fa d.Ssa dddaAAd.adFfFa a.s.SdA ..fSaAad. fAsD fs S. ddS sdFF.dFFFSFfFfffFa DSF.aSFD.afffDfdSAdSAFD.Sa sa FDaFSd D.f.dFfasDF.sA .dAD .. A.fADaFs..DFdAf .adas.SdsdaDfss.aASDD aS D FAFdSaSS SdF.SaDasasfDDdS Adad.a.. AsafDFFSa SDSa.DA.DFAffFfD.fDFD s.a.FFAF fDsfFa.D..fd fDsddadsDAsD sDsssDa aFAsSSds.S FaFsadd.DAS SfD.D .sDaSaFAf. sA sAA .FfFAdddDaf SfSff f.DdAF.ad DSADsfffFAsaFDSfAaFa ssfA.f sAaFfASA..aDSfDSsAaSAaFsddS.sa dD afdFafDaaf .dD dAd fFSaF.ddfsFf dd AsDADsS.FsfffD.FSDa F FsSFAds..SaS ..aF.fs F.SDDfDsddsAa.a asfD ssfafdsDASA ddsDd sSADFA.dDfS D.DddsSfadsASAaaf SSadAF.AaSaFfDFdsaAFAAaDfFdfaDDDS.ss.aF.FFafDaS.ds DD.DSdDsAFF ASASF FFfFDAd AaADfdDdsf . s.AD sddsSdadd.D fASs afsdDD.FsaDSasadAs.DsfsdaSFD .d A.sdF.SaS a. A SSf..Adsfa..sf AFADffF.AAfFSaffSsFDaAssafaa A d ... .FsSf.ff SsASsDdd.dFsd DFSfDDdfDdAfDSFsfS afAFAa..Fad .asdaaSf.aFfFDfsaaAafsFasD.safA. F S.d.afaffD. ..s. daSA.ASss fDdDff.d ..fFfd.A f. .AADf.aDdDd.aAa sD.fSdsdAf.sFFDaAdD.s.SfSF SSDdD saaS fDf DdsD.ASF.AAdsA..sSdsaAfds.DSFdaS ffS.a FAsd.DfFa.dfsFD sSfFAAasdS FASdAdS.sffsAdS. SaD fD.aaddS.afAAFDsDaSa sfad.Sa.fA fS fs.sa. ASdA.sDD ss.sfFD .fsfFD.fFF aaFSFdfFAaA.dSFAdFfSDFDdSSd.DafDdfAsDF. sS fA FDffAas ADaDF..f. S AAASaSdS..d.SAAfFSDfSadS.faFDSAd aaSFA . SFfdfSdd Da .SA S dAsSsfDDsdsaF.asf FAFddaSfSsaAD daaff.a ff d AfFssfsAFsff.DA .SDdsasfDDSf.sa ssFS f DDaD AfaDd..fadD..AdaFfA.SASfadaD DfasSDADFF.aDFafsafSDfddsAffFdFAFaFS.ffD fDsf.S dad.AD S .sdfsFsfF.d Asaasffaaaddd D.FA DFSaaS fDAFsa.fadS fFSDaFs.FsS FAasA.DaSdF.AadDdFsDD.D.FF.FaAdad fDfaasAFaaa DAfs dasfaa Fddad AF aF dA dDADAddFSSaa.sdS. FdFdDFSDDa. A ddf.SAD f. aSaddF fsss.aaadADS.s.FDSAss FADSS.s fSDS.DSa.aDSSFDDSSAfDS.DdS aDA asdFasAdaDsS .AfAssaaDaFsS s .FSddAdfdDf.asAaS.D.dF..F.fSfSa .SS s.Fa .aAAasSadFF .Ff .sDADSd dAAaAd.DDSFsdafdFD SfFa .D.DAsfDFa.AdsfdDffdfFSsSa.s.sAa. .SFd SAf D Ds a Fff SsAA SS.SDAS faadAfFAaASSDf aFaFsAfAss assFADFAsSa.sd .as fdAsfdSaS.SFaFSDA SaAAf.sAa .SD fa.SSa AFdFSFAf asDDFaF.DFf.DdAad FaSdSASSf sDsfaFd.asaFsSDFFdsfF.fA sddDD.s a DFDSFaFSs AdA.fFF fAaA.f SdAfdaaa.Fa.SDds F .F s.SFa.fSfF.AasDs.FdSDA.f..D.DfAa s. s fS ddDSsFAssfaS DAfFdDfAfD FaasS AFfsdd.AA SfsdaSAs. SFsaFsd.FFSFdad .FsAS SFSfAD d adDdasSs. ..S. dadfSF.dFSDfAfA.A.D..aAdsadaSfS. F aF Fd dDD..f.F aFaA.a.sFdFDSF F.FfDaDs.Sfas FSSSSsDFd.SA. fDFdFFDSa .sddd Sadf.FSFS.DdSFF.FFsSFa F d.S AA DaADS fAfDfdFfaFSS.Ds.fDsdfADadSaDfDsF DSF.Sf.S.DASaAdDSSfd fSa fSfD . d.fFd A fdd D sSsSFDa .S.AsSaddddDfSsaaDdfsaD FasFDf Dsf d S .F dADdD aASaa afdaFS..dfA FsaDd ..dfSSDD S.Sa..AsDfaFA f. SdfFSdDaDSD fsd DAAFaDDfDD.fdaDFdaDs SssdFFDsasaD.aDS.ffS .F S..DFas fA. fFAAdFfsFdDaAdSssDFFSDD .aadDsSda FddffdDd A sSFa FFfAd D DASADS.DafdfFaAdAsAssAF.ffSDFSdAsaaaFdFFDasAaFaDsA sff. FdfSa.aDadaaa aFss..f..sdS D.fdFDASa S.SF.SFA.FDaDFAFDFaAdFADdAD.sDf.S..FDDfSAdF aS .SSA.SdFFDADadd.sfFsfDSs .dasFSf daA. .s..f sdADdSas sAfADDffdaD DSFsF.fDdDaS Dad.sSfFdFA.daf DDsSAA SFsaAsF.sFsa.Df.sdSdSSAaA fs.FDDSFDfdA fADASA.AFffs..SsDs adAFasS.DaAsfd...SaS faA s AFAs..SD.aA.DSSFsF.d.A SdDSDsDsFSFaDFSS.SsFA.SSsDAASfadA.FdfFSsSSsf a.SFdS dfaAaDdFadfA faDsFFD ddsdsDdSfSaFFDaF..F dSFDFA.FfS DsA. daaaaFsDs..a.f DfsDFdAfsdsd.dS S.S.. a.AsaDdffdFDsSs.sds SaDfSAdd f.S SD Sd..SDFDAdSD DssFaSSSa.aAFDa SSaaSdSAd s dasaf a aSddDdDAs.aaSdad ...AafDa . F.aaFddASdsFsfaDDds ssfSfFSSfAdfDdSASFaddfd FdfFADdFFDDfAf.aFsSAAddsdASAFF..f DassasFDAfaSSsFdFA f.SFAsFAd.aDSaaDfdDaDsffDSf.S.A.FsDAfFaDDf SAAAF.f.SS sAaDSSFsSFdAfDfAAsFsDSFd DDfffDDF.S S A da.DDA SASAs .AdDsDaaSsadAFSfdafs.dSSD sfs .sssadsdADfAasAFSDs.adf.FafsADDDa.Fafs F.aAsfas..daaDf.DS .ffFafDsAsddsfdD A.S .a sD.aAASSsa sAd fADASdDAD AfFSf Dsf.FsD d.FAAddaDsASfdsaFFAS .dfdDddFdSdsSaF.dFFAA F.F.DS AfADS.AssAA.aSSdDDSDAsfd.daaaFDAs Aa afDDFDD fsfaDsDFSsaFfaad.SA fDaAaDdF dADfF.ss..Da.SSdFFsSAD.fD AAD .s.. .aAssDFdFSFaAF sAssa.ASS dAAsSaa.DfaSd AadDAdf.aDaaSDF as.sFs .sD.Ds dF .f.FfSaA a F afFaD .FfFDA .fFFFD.sS.Fa.d.f...D.SfaSSFffADdaDfFDdsff.Af d FfA.dSDASfsD.AdF.dFdaA saadAfSdf.DAs dFdFd...s.FADfA .F .fd . F.ffd.DfdAAfS DS dfDaaDaSSfFsf s FSFDAs.fFf. dA. sF sDD. aFDA a.dFaafssSdSSSFfDA SsDfF....FSfFFSSFFdssFfFSaFaDfSAAS.fAa .fDDsAS.fFaDFSAAFfAD.sf D . SFA.FAdfss.sfS.sf .FsD.fafdSA.dfDF DfSfS.dDdaF AfAA dA. a aAfAadf aSdfdsDs ..aS AssaSdSDS. s ASDsSA s.DaasssfDSsFDfDs. aFas DDf.AFAFDdF.S.ssF. DFD ..a..af FdD.aSSFAa.DSaFa.. FDd Fs FaSfSSA DDdAS.SDS D Sf.SdfasSSsFA Assss.fSDd s.sAAasSSA.DSDf.SFAfdDSAFsfAfF.S.dd dAs.ddSsasaFdSfSA.ffaSFAS.dAsSa fsAAffSA .fFAFSaD.ADSffd DFAfa.Sf sF.a .. FsSAasAFSasaDsDaf.FSAs Asa.aaASaS ADDdDfdFA.sfs d.a.sD dDAADsfDDFASAD sd SsFsAdA AADd.d.AD.SaFAaA SAaDD Aad.AD dds.SssDFaSSfDsfdDs.DaSdSDSD fsSDAFfSDAfASd.sdDa.fSaSdSsFD.dadfDA.ddF.DfSsd.fs. DF AafSsaSfdaSsAA DSAS.fD AdA D faDFSFF fs .daSF.dSS .Aa FDsDdDddSsaSsA. .a.sDDssA.DDSDfSASf. Fsd.f.aFFAa.SfFASssA.F Fsafa DSfsDA.SdsDFAD sFA.DAfFFfsF.S fffFSa FFF.DDS fafa.dA aA. S.dd DDA FsdF.fSFadsaAssaFAaS SdAFSdF Dd aSd..aFsfssaf af.s.S.ffFaASS aa SdSDAS.FDdFd..SadDSsfdsA..s .saDAFDa Fa d.Ssa dddaAAd.adFfFa a.s.SdA ..fSaAad. fAsD fs S. ddS sdFF.dFFFSFfFfffFa DSF.aSFD.afffDfdSAdSAFD.Sa sa FDaFSd D.f.dFfasDF.sA .dAD .. A.fADaFs..DFdAf .adas.SdsdaDfss.aASDD aS D FAFdSaSS SdF.SaDasasfDDdS Adad.a.. AsafDFFSa SDSa.DA.DFAffFfD.fDFD s.a.FFAF fDsfFa.D..fd fDsddadsDAsD sDsssDa aFAsSSds.S FaFsadd.DAS SfD.D .sDaSaFAf. sA sAA .FfFAdddDaf SfSff f.DdAF.ad DSADsfffFAsaFDSfAaFa ssfA.f sAaFfASA..aDSfDSsAaSAaFsddS.sa dD afdFafDaaf .dD dAd fFSaF.ddfsFf dd AsDADsS.FsfffD.FSDa F FsSFAds..SaS ..aF.fs F.SDDfDsddsAa.a asfD ssfafdsDASA ddsDd sSADFA.dDfS D.DddsSfadsASAaaf SSadAF.AaSaFfDFdsaAFAAaDfFdfaDDDS.ss.aF.FFafDaS.ds DD.DSdDsAFF ASASF FFfFDAd AaADfdDdsf . s.AD sddsSdadd.D fASs afsdDD.FsaDSasadAs.DsfsdaSFD .d A.sdF.SaS a. A SSf..Adsfa..sf AFADffF.AAfFSaffSsFDaAssafaa A d ... .FsSf.ff SsASsDdd.dFsd DFSfDDdfDdAfDSFsfS afAFAa..Fad .asdaaSf.aFfFDfsaaAafsFasD.safA. F S.d.afaffD. ..s. daSA.ASss fDdDff.d ..fFfd.A f. .AADf.aDdDd.aAa sD.fSdsdAf.sFFDaAdD.s.SfSF SSDdD saaS fDf DdsD.ASF.AAdsA..sSdsaAfds.DSFdaS ffS.a FAsd.DfFa.dfsFD sSfFAAasdS FASdAdS.sffsAdS. SaD fD.aaddS.afAAFDsDaSa sfad.Sa.fA fS fs.sa. ASdA.sDD ss.sfFD .fsfFD.fFF aaFSFdfFAaA.dSFAdFfSDFDdSSd.DafDdfAsDF. sS fA FDffAas ADaDF..f. S AAASaSdS..d.SAAfFSDfSadS.faFDSAd aaSFA . SFfdfSdd Da .SA S dAsSsfDDsdsaF.asf FAFddaSfSsaAD daaff.a ff d AfFssfsAFsff.DA .SDdsasfDDSf.sa ssFS f DDaD AfaDd..fadD..AdaFfA.SASfadaD DfasSDADFF.aDFafsafSDfddsAffFdFAFaFS.ffD fDsf.S dad.AD S .sdfsFsfF.d Asaasffaaaddd D.FA DFSaaS fDAFsa.fadS fFSDaFs.FsS FAasA.DaSdF.AadDdFsDD.D.FF.FaAdad fDfaasAFaaa DAfs dasfaa Fddad AF aF dA dDADAddFSSaa.sdS. FdFdDFSDDa. A ddf.SAD f. aSaddF fsss.aaadADS.s.FDSAss FADSS.s fSDS.DSa.aDSSFDDSSAfDS.DdS aDA asdFasAdaDsS .AfAssaaDaFsS s .FSddAdfdDf.asAaS.D.dF..F.fSfSa .SS s.Fa .aAAasSadFF .Ff .sDADSd dAAaAd.DDSFsdafdFD SfFa .D.DAsfDFa.AdsfdDffdfFSsSa.s.sAa. .SFd SAf D Ds a Fff SsAA SS.SDAS faadAfFAaASSDf aFaFsAfAss assFADFAsSa.sd .as fdAsfdSaS.SFaFSDA SaAAf.sAa .SD fa.SSa AFdFSFAf asDDFaF.DFf.DdAad FaSdSASSf sDsfaFd.asaFsSDFFdsfF.fA sddDD.s a DFDSFaFSs AdA.fFF fAaA.f SdAfdaaa.Fa.SDds F .F s.SFa.fSfF.AasDs.FdSDA.f..D.DfAa s. s fS ddDSsFAssfaS DAfFdDfAfD FaasS AFfsdd.AA SfsdaSAs. SFsaFsd.FFSFdad .FsAS SFSfAD d adDdasSs. ..S. dadfSF.dFSDfAfA.A.D..aAdsadaSfS. F aF Fd dDD..f.F aFaA.a.sFdFDSF F.FfDaDs.Sfas FSSSSsDFd.SA. fDFdFFDSa .sddd Sadf.FSFS.DdSFF.FFsSFa F d.S AA DaADS fAfDfdFfaFSS.Ds.fDsdfADadSaDfDsF DSF.Sf.S.DASaAdDSSfd fSa fSfD . d.fFd A fdd D sSsSFDa .S.AsSaddddDfSsaaDdfsaD FasFDf Dsf d S .F dADdD aASaa afdaFS..dfA FsaDd ..dfSSDD S.Sa..AsDfaFA f. SdfFSdDaDSD fsd DAAFaDDfDD.fdaDFdaDs SssdFFDsasaD.aDS.ffS .F S..DFas fA. fFAAdFfsFdDaAdSssDFFSDD .aadDsSda FddffdDd A sSFa FFfAd D DASADS.DafdfFaAdAsAssAF.ffSDFSdAsaaaFdFFDasAaFaDsA sff. FdfSa.aDadaaa aFss..f..sdS D.fdFDASa S.SF.SFA.FDaDFAFDFaAdFADdAD.sDf.S..FDDfSAdF aS .SSA.SdFFDADadd.sfFsfDSs .dasFSf daA. .s..f sdADdSas sAfADDffdaD DSFsF.fDdDaS Dad.sSfFdFA.daf DDsSAA SFsaAsF.sFsa.Df.sdSdSSAaA fs.FDDSFDfdA fADASA.AFffs..SsDs adAFasS.DaAsfd...SaS faA s AFAs..SD.aA.DSSFsF.d.A SdDSDsDsFSFaDFSS.SsFA.SSsDAASfadA.FdfFSsSSsf a.SFdS dfaAaDdFadfA faDsFFD ddsdsDdSfSaFFDaF..F dSFDFA.FfS DsA. daaaaFsDs..a.f DfsDFdAfsdsd.dS S.S.. a.AsaDdffdFDsSs.sds SaDfSAdd f.S SD Sd..SDFDAdSD DssFaSSSa.aAFDa SSaaSdSAd s dasaf a aSddDdDAs.aaSdad ...AafDa . F.aaFddASdsFsfaDDds ssfSfFSSfAdfDdSASFaddfd FdfFADdFFDDfAf.aFsSAAddsdASAFF..f DassasFDAfaSSsFdFA f.SFAsFAd.aDSaaDfdDaDsffDSf.S.A.FsDAfFaDDf SAAAF.f.SS sAaDSSFsSFdAfDfAAsFsDSFd DDfffDDF.S S A da.DDA SASAs .AdDsDaaSsadAFSfdafs.dSSD sfs .sssadsdADfAasAFSDs.adf.FafsADDDa.Fafs F.aAsfas..daaDf.DS .ffFafDsAsddsfdD A.S .a sD.aAASSsa sAd fADASdDAD AfFSf Dsf.FsD d.FAAddaDsASfdsaFFAS .dfdDddFdSdsSaF.dFFAA F.F.DS AfADS.AssAA.aSSdDDSDAsfd.daaaFDAs Aa afDDFDD fsfaDsDFSsaFfaad.SA fDaAaDdF dADfF.ss..Da.SSdFFsSAD.fD AAD .s.. .aAssDFdFSFaAF sAssa.ASS dAAsSaa.DfaSd AadDAdf.aDaaSDF as.sFs .sD.Ds dF .f.FfSaA a F afFaD .FfFDA .fFFFD.sS.Fa.d.f...D.SfaSSFffADdaDfFDdsff.Af d FfA.dSDASfsD.AdF.dFdaA saadAfSdf.DAs dFdFd...s.FADfA .F .fd . F.ffd.DfdAAfS DS dfDaaDaSSfFsf s FSFDAs.fFf. dA. sF sDD. aFDA a.dFaafssSdSSSFfDA SsDfF....FSfFFSSFFdssFfFSaFaDfSAAS.fAa .fDDsAS.fFaDFSAAFfAD.sf D . SFA.FAdfss.sfS.sf .FsD.fafdSA.dfDF DfSfS.dDdaF AfAA dA. a aAfAadf aSdfdsDs ..aS AssaSdSDS. s ASDsSA s.DaasssfDSsFDfDs. aFas DDf.AFAFDdF.S.ssF. DFD ..a..af FdD.aSSFAa.DSaFa.. FDd Fs FaSfSSA DDdAS.SDS D Sf.SdfasSSsFA Assss.fSDd s.sAAasSSA.DSDf.SFAfdDSAFsfAfF.S.dd dAs.ddSsasaFdSfSA.ffaSFAS.dAsSa fsAAffSA .fFAFSaD.ADSffd DFAfa.Sf sF.a .. FsSAasAFSasaDsDaf.FSAs Asa.aaASaS ADDdDfdFA.sfs d.a.sD dDAADsfDDFASAD sd SsFsAdA AADd.d.AD.SaFAaA SAaDD Aad.AD dds.SssDFaSSfDsfdDs.DaSdSDSD fsSDAFfSDAfASd.sdDa.fSaSdSsFD.dadfDA.ddF.DfSsd.fs. DF AafSsaSfdaSsAA DSAS.fD AdA D faDFSFF fs .daSF.dSS .Aa FDsDdDddSsaSsA. .a.sDDssA.DDSDfSASf. Fsd.f.aFFAa.SfFASssA.F Fsafa DSfsDA.SdsDFAD sFA.DAfFFfsF.S fffFSa FFF.DDS fafa.dA aA. S.dd DDA FsdF.fSFadsaAssaFAaS SdAFSdF Dd aSd..aFsfssaf af.s.S.ffFaASS aa SdSDAS.FDdFd..SadDSsfdsA..s .saDAFDa Fa d.Ssa dddaAAd.adFfFa a.s.SdA ..fSaAad. fAsD fs S. ddS sdFF.dFFFSFfFfffFa DSF.aSFD.afffDfdSAdSAFD.Sa sa FDaFSd D.f.dFfasDF.sA .dAD .. A.fADaFs..DFdAf .adas.SdsdaDfss.aASDD aS D FAFdSaSS SdF.SaDasasfDDdS Adad.a.. AsafDFFSa SDSa.DA.DFAffFfD.fDFD s.a.FFAF fDsfFa.D..fd fDsddadsDAsD sDsssDa aFAsSSds.S FaFsadd.DAS SfD.D .sDaSaFAf. sA sAA .FfFAdddDaf SfSff f.DdAF.ad DSADsfffFAsaFDSfAaFa ssfA.f sAaFfASA..aDSfDSsAaSAaFsddS.sa dD afdFafDaaf .dD dAd fFSaF.ddfsFf dd AsDADsS.FsfffD.FSDa F FsSFAds..SaS ..aF.fs F.SDDfDsddsAa.a asfD ssfafdsDASA ddsDd sSADFA.dDfS D.DddsSfadsASAaaf SSadAF.AaSaFfDFdsaAFAAaDfFdfaDDDS.ss.aF.FFafDaS.ds DD.DSdDsAFF ASASF FFfFDAd AaADfdDdsf . s.AD sddsSdadd.D fASs afsdDD.FsaDSasadAs.DsfsdaSFD .d A.sdF.SaS a. A SSf..Adsfa..sf AFADffF.AAfFSaffSsFDaAssafaa A d ... .FsSf.ff SsASsDdd.dFsd DFSfDDdfDdAfDSFsfS afAFAa..Fad .asdaaSf.aFfFDfsaaAafsFasD.safA. F S.d.afaffD. ..s. daSA.ASss fDdDff.d ..fFfd.A f. .AADf.aDdDd.aAa sD.fSdsdAf.sFFDaAdD.s.SfSF SSDdD saaS fDf DdsD.ASF.AAdsA..sSdsaAfds.DSFdaS ffS.a FAsd.DfFa.dfsFD sSfFAAasdS FASdAdS.sffsAdS. SaD fD.aaddS.afAAFDsDaSa sfad.Sa.fA fS fs.sa. ASdA.sDD ss.sfFD .fsfFD.fFF aaFSFdfFAaA.dSFAdFfSDFDdSSd.DafDdfAsDF. sS fA FDffAas ADaDF..f. S AAASaSdS..d.SAAfFSDfSadS.faFDSAd aaSFA . SFfdfSdd Da .SA S dAsSsfDDsdsaF.asf FAFddaSfSsaAD daaff.a ff d AfFssfsAFsff.DA .SDdsasfDDSf.sa ssFS f DDaD AfaDd..fadD..AdaFfA.SASfadaD DfasSDADFF.aDFafsafSDfddsAffFdFAFaFS.ffD fDsf.S dad.AD S .sdfsFsfF.d Asaasffaaaddd D.FA DFSaaS fDAFsa.fadS fFSDaFs.FsS FAasA.DaSdF.AadDdFsDD.D.FF.FaAdad fDfaasAFaaa DAfs dasfaa Fddad AF aF dA dDADAddFSSaa.sdS. FdFdDFSDDa. A ddf.SAD f. aSaddF fsss.aaadADS.s.FDSAss FADSS.s fSDS.DSa.aDSSFDDSSAfDS.DdS aDA asdFasAdaDsS .AfAssaaDaFsS s .FSddAdfdDf.asAaS.D.dF..F.fSfSa .SS s.Fa .aAAasSadFF .Ff .sDADSd dAAaAd.DDSFsdafdFD SfFa .D.DAsfDFa.AdsfdDffdfFSsSa.s.sAa. .SFd SAf D Ds a Fff SsAA SS.SDAS faadAfFAaASSDf aFaFsAfAss assFADFAsSa.sd .as fdAsfdSaS.SFaFSDA SaAAf.sAa .SD fa.SSa AFdFSFAf asDDFaF.DFf.DdAad FaSdSASSf sDsfaFd.asaFsSDFFdsfF.fA sddDD.s a DFDSFaFSs AdA.fFF fAaA.f SdAfdaaa.Fa.SDds F .F s.SFa.fSfF.AasDs.FdSDA.f..D.DfAa s. s fS ddDSsF
fp
I just heard some sad news on talk radio -
Gnutella creator Gene Kan was found dead in his California home this morning. There weren't any more details. I'm sure everyone in the Slashdot community will miss him - even if you didn't enjoy his work, there's no denying his contributions to popular culture. Truly an American icon.
#! /usr/bin/perl
print
EOF
in October 2000 when Perl was as its peak. Now that Perl is dying where's the interest?
Here's a kuro5hin story on it from two days ago, i suggest you look at it if this matters to you.
I am a professional developer, working mostly with Perl. I work in the field of biology and bioinformatics, but have spent the last 8 years working as a web and database Internet developer. And, I own practically every O'Reilly Perl book ever published (not that I necessarily think they're all worth buying). So, now that you know where I'm coming from...
If you are preparing to do a serious amount of XML development, and you're in the process of determining a) which Perl XML modules on CPAN you want to use, and b) how to use them; and, you don't have a whole lot of time to spend tracking down the sometimes-hard-to-find documentation on these modules; then buying this book is a no-brainer. It covers all the major XML modules, how to use then and really helps you figure out when to use the different modules.
Even if you're not new to XML and Perl, this book would serve as an excellent refresher course on what XML tools are available out there for you... Maybe you haven't looked at your code in awhile, or want to update it to use a newer module from CPAN? Or, maybe you're looking for a better way to do it? Then, this book would definitely help you out.
While a fan of O'Reilly books in general, I'll be the first to admit some of them are more useful than others. I highly recommend this book, though, as it's actually useful, comprehensive and very well presented. I find myself cracking it open all the time, especially as my utilization of XML has grown more complicated. It has definitely earned its place in my Aqua Perl book collection.
Do you even lift?
These aren't the 'roids you're looking for.
I like lobster.
Speaking of fucking donkeys, I'd like to give Taco's mom a perl necklace.
... is not actually learning XML Learn HTML first; so you'll practice & develop a feel for it.
this is like learning to speak latin - both are dead languages spoken mainly by men who molest young boys.
I wonder if this conforms to the dtd
a bit of xml i wrote -- xml comments look something like this
-->
They used a camel instead of a Donkey, everyone knows that donkeys are more loveable!
- conversion complexity
- conversion errors
- vast storage requirements
- vast bandwidth requirements
The only benefit AFAIK is that applications from different vendors can use it to "talk" to each other. However, the applications still have to understand the same set of XML tags to begin with, then must conform to this hideous standard with all of its verbosity. Said applications would have been better off using a proprietary (read: efficient) binary storage format in the first place.Ban XML!
You realize that if I get an XML file, I can figure out what it is saying and decide what to do with it. With your ideal (binary) files, I need to reverse engineer the format.
With binary, I need permission to interoperate. With XML, I need a text editor (or print-out) and some common sense.
You worry all you want about the computer's efficiency. I use my machines to make my life easier. I don't jump through hoops to make the computer's life easier...
Taking troll bait,
Alex
Parsing XML indeed. I mean seriously, have any of you ever actually tried to impliment XML parsing? It's an order of magnitude slower than accessing a database, ten zillion times slower than reading a flat file ASCII database, and a trillion times more expensive (well, I'm exaggerating a bit) than reading in a text file with nested variable=value pairs.
Interoperability is great and all, but I think XML is nothing but hype.
Programmers, hear my cry! Spend your precious hours working on your program interface, your error-checking, your overall design and modularity, don't spend time worrying about a scheme with a fancy name that saves data like this: value.
Don't mod me up or down, I just want to foster a discussion about this. I mean, as a standalone programmer using Perl for a majority of their web application products, what benefit does XML give you other than buzzword compliance?
----
Slogan-free since April! We pass the savings on to you!
Credits: onby
1. Introduction
As everyone knows, Open Source software is the wave of the future. With the market share of GNU/Linux and *BSD increasing every day, interest in Open Source Software is at an all time high.
Developing software within the Open Source model benefits everyone. People can take your code, improve it and then release it back to the community. This cycle continues and leads to the creation of far more stable software than the 'Closed Source' shops can ever hope to create.
So you're itching to create that Doom 3 killer but don't know where to start? Read on!
2. First Steps
The most important thing that any Open Source project needs is a Sourceforge page. There are tens of thousands of successful Open Source projects on Sourceforge; the support you receive here will be invaluable.
OK, so you've registered your Sourceforge project and set the status to '0: Pre-Thinking About It', what's next?
3. Don't Waste Time!
Now you need to set up your SourceForge homepage. Keep it plain and simple - don't use too many HTML tags, just knock something up in VI. Website editors like FrontPage and DreamWeaver just create bloated eye-candy - you need to get your message to the masses!
4. Ask For Help
Since you probably can't program at all you'll need to try and find some people who think they can. If your project is a game you'll probably need an artist too. Ask for help on your new Sourceforge pages. Here is an example to get you started:
"Hi there! Welcom to my SorceForge page! I am planing to create a Fisrt Person Shooter game for Linux that is going to kick Doom 3's ass! I have loads of awesome ideas, like giant robotic spiders! I need some help thouh as I cant program or draw. If you can program or draw the tekstures please get in touch! K thx bye!"
Thousands of talented programmers and artists hang out at Sourceforge ready to devote their time to projects so you should get a team together in no time!
5. The A-Team
So now you have your team together you are ready to change your projects status to '1: Pre-Bickering'. You will need to discuss your ideas with your team mates and see what value they can add to the project. You could use an Instant Messaging program like MSN for this, but since you run Linux you'll have to stick to e-mail.
Don't forget that YOU are in charge! If your team doesn't like the idea of giant robotic spiders just delete them from the project and move on. Someone else can fill their place and this is the beauty of Open Source development. The code might end up a bit messy and the graphics inconsistant - but it's still 'Free as in Speech'!
6. Getting Down To It
Now that you've found a team of right thinking people you're ready to start development. Be prepared for some delays though. Programming is a craft and can take years to learn. Your programmer may be a bit rusty but will probably be writing "hello world" programs after school in no time.
Closed Source games like Doom 3 use the graphics card to do all the hard stuff anyhow, so your programmer will just have to get the NVidia 'API' and it will be plain sailing! Giant robot spiders, here we come!
7. The Outcome
So it's been a few years, you still have no files released or in CVS. Your programmer can't get enough time on the PC because his mother won't let him use it after 8pm. Your artist has run off with a Thai She-Male. Your project is still at '1: Pre-Bickering'...
Congratulations! You now have a successful Open Source project on Sourceforge! Pat yourself on the back, think up another idea and do it all again! See how simple it is?
- poopbot: for all your crapflooding needs
Whats the point of learning perl? does everything that perl can do and more.
I think that if you are making a large enough (enterprise?) website that requires a serious amount of XML development, you should ditch perl altogether and write it in Java. Java already handles XML efficiently, and is a better choice for large apps.
If you are writing a smaller website that uses XML, sure, perl is a nice choice. But is the XML necessary?
And I have used (and still use) both perl and Java. I just view Java as a better choice for large web apps, and perl for small web apps and scripting.
Before I get hit with flames, please understand this is my opinion, not fact.
Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
Any Perl/Python bilingual folks out there care to comment how the XML abilities of the two compare nowadays?
...A Six Figure Salary
The book is a little sparse, though. It's about the same thickness as Using csh and tcsh, so don't expect more than an overview of anything. In fact, it might be a little small for US$35.00 (although Bookpool has it for US$21.50). Another small gripe was that it covered parsing XML in far greater detail than generating XML (which was my task at the time I bought the book). Admittedly, parsing XML is typically what most people tend to do and is far more difficult that creating new XML, but I thought a little more coverage was warranted.
If you are faced with doing something involving XML and you're not sure what software bits are up to the task, then this is a good place to find out where to start. You could wind up looking elsewhere if you need lots of nitty-gritty details, but getting off on the right foot is a hard enough task and might be worth the price of the book.
-B
Ash and Hickory, straight-grained and true, make excellent bludgeons, dandy for the cudgeling of vegetarians.
I can tell you from personal experience, you want to attack the soft, weak center of each element, or, even better, any undefended #PCDATA.
You'll want to avoid attacking the sharp angle brackets present on every element. Your sword blows will simply glance off, and then the XML document will jab you with the sharp corner.
Entities are another hidden danger. The ampersand prefix character is very quick and wiley, and even though it appears smooth and undefended, it can quickly turn on you, showing its offensive nature and bristling an array of pointy teeth. (Note, this depends on your screen font).
In short, attacking XML documents is risky, but with the proper strategy, can yield a nearly limitless supply of delicious data.
Ahem.
Does anybody know of any Perl XSLT module that allows Perl functions to be called from the templates? I.e., to format dates or stuff like that.
I personally didn't want a handholding book as I've worked with XML in other languages, but something that cut through the confusion of all the different ways to do the same thing.
This little book was perfect for me as it's a nice overview of what is out there and how to pick the right library for the job. Don't expect a complete enterprise application in this book - its for programmers that already know perl and the basics of XML and just need a jumpstart in using the libraries available.
No, Thursday's out. How about never - is never good for you?
- Conversion/translation complexity
- Syntax Errors
- Conversion errors
- Storage requirements (object files)
The only benefit AFAIK is that people can read the code better. However, the applications still have to understand the standard coding syntax, which comprises of a hideous amount of keywords and styles. Said applications would have been better off using Assembly (read: efficient) code in the first place.Ban C!
Please note the extremely sarcastic tone of this post.
Your complaints are old fashioned. Maintainability is a major overlooked flaw in Computer Science.
Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
One thing about Perl that I think helps keep it in competition w/ PHP is it's ability to handle POP3 so much easier. I've wanted to write a POP3 web-gateway in PHP, but I've read that to write one in PHP, switch to Perl. Granted, PHP can handle IMAP, or at least I think it can, but nothing makes getting POP3 simple, from what I've looked at, that is.
My other sig is an import.
he only speaks the truth.
So you don't think you need to pay for things? Good luck with that.
Only the kind of person who thinks XML is a great idea would propose doing in it Perl.
..what's so innovative about it ?
Someone discovered that files are more readable if written in ASCII.
Big fucking deal !
Programmers can be the worst dumb sheep.
XSLT has the format-number() function, which could be used to format a date. I personally don't recommend mixing XSLT with anything. If you need your date formatted in a specific way, I recommend storing the data in a different structure and use pure XSLT. Rick
Making something out of nothing : MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
In the year 2000 books will be replaced by a huge network of machines.
Gone will be the days of looking at page after
page.
You will be able to find just what you need in seconds!
The future will be great!
Books suck!
Hug a root today!
For the sake of Perl.
For a more detailed, and more depressing, take on the above, see http://www.xmlsucks.org/but_you_have_to_use_it_any way/.
Yes, it's a PDF. Unroll it - it's worth the effort.
To a Lisp hacker, XML is S-expressions in drag.
Does anybody know of any Perl XSLT module that allows Perl functions to be called from the templates? I.e., to format dates or stuff like that.
I'm looking into it for XML::LibXSLT, but it's non-trivial due to lack of docs and lack of context. Keep watching CPAN is all I can suggest!
Matt. Want XML + Apache + Stylesheets? Get AxKit.
As far as parsing it, there are libraries for that.
I found this book an excellent introduction for Perl programers who want (or have) to start processing XML. It cuts through the long list of XML modules on CPAN (485 results!) and gives you the basic techniques and tools you can use.
XML is really not that difficult to deal with but it can be a little intimidating. "Perl & XML" is written in a simple and direct style that gives the reader enough information to start writing code, and pointers to find more specific information once they have chosen the tools they need.
Armed with this book, The Perl-XML FAQ and Kip Hampton's column on XML.com any Perl programer can start working confidently with XML.
Look, that's why there's rules, understand? So that you think before you break 'em. (Terry Pratchett)
Perl & XML
...
...
Perl | Posted by timothy on 11:15 AM -- Thursday July 11 2002
from the merging-realms dept.
dooling writes: "Perl & XML is a well-written book that accomplishes what it sets out to do. It states in the preface that it is written for Perl programmers who want to learn about XML and what is available in Perl for XML processing. It achieves this goal, but little else. When you are done reading this book you will have been given an overview of Perl and XML, know where to begin to attack an XML document, and know where to look to find more information." For dooling's more complete review, read on below.
The book starts out with a brief explanation of why XML and Perl are well-suited for each other. It then provides a teaser of things to come: an explanation of how to use the XML::Simple module. The first chapter concludes with some warnings and gotchas that seem a little premature since they have not really explained XML. Fortunately, most of these gotchas are covered in context later in the book.
The second chapter provides a whirlwind overview of XML -- covering its structure, DTDs, schemas, and XSLT (transformation). The discussion of XML in general, its history, and parts of an XML document are well done. They give someone who is familiar with static HTML the needed background to understand the structure of an XML document and the vocabulary used to describe it. Unfortunately, the discussion of where XML begins to distinguish itself from HTML, namely with DTDs, the new replacement for DTDs called schemas, and the transformation language XSLT, is too brief. They gloss over these topics with little explanation and few examples. That said, there are other books that do provide more in-depth coverage of XML (this book only promises an introduction).
The next five chapters cover Perl modules designed to process XML, starting with simple parsers and writers. Only methods and syntax relating to XML processing are explained. Therefore, if you are considering reading this book, you should be fairly comfortable with Perl and object-oriented (OO) interfaces to CPAN modules (nearly all the modules discussed provide OO APIs). Again, there are other books and perldoc documentation that cover Perl and it's OO features; so read them first if you are not familiar with OO Perl. If you are familiar with OO Perl, these chapters provide a good overview of the different ways XML can be processed (stream- and tree-based approaches), the advantages and disadvantages of each, and the Perl modules best suited for each approach. These chapters are the biggest strength of this book. The modules discussed in these chapters are by no means an exhaustive list of XML-related modules available from CPAN nor do the explanations of each module cover everything the module does. These chapters do, however, provide the reader with enough information that she can begin to process XML documents intelligently and know where to turn when she needs more information.
The next chapter, Chapter 8, covers XML tree iterators, XPath, XSLT, and XML::Twig. All of these topics are covered in a span of 16 pages (with only slightly over two pages dedicated to XSLT). Indeed, after reading the chapter, you may get the feeling that it was only included so the authors could cram more trite colloquialisms into the book. The short shrift given to these topics creates the impression, which is strengthened in the chapters that follow, that this book was rushed a bit to press.
Chapter 9 discusses applications of XML, including RSS and SOAP, and Chapter 10 is mostly example code. These chapters are intended to give you a feeling for what is possible without really giving you enough information to make it happen. The main problem with these chapters are the examples: the examples are long and the explanations are short. Thus, they are more useful as templates or a quick reference than for learning these topics in detail. Of course, the authors never promised you would be programming SOAP applications when you were done reading this book. And again, there are other books out there which discuss these topics in more detail. So the authors stay true to their promise throughout the book: they will introduce you to XML and tell you how to interact with XML using Perl, no more.
Personally, I found this book did, in general, give me enough information to get started using XML and pointed me where I needed to go to get more information. I am an experienced Perl programmer who is new to XML and comfortable with on-line documentation. This book seems to be written for people who fit this profile and who want to learn by doing (finding the answers to the "hard" questions as they arise). It does introduce a wide variety of XML-related topics and the Perl modules used to interact with them, which is what the authors promised to do in the preface. While it is by no means an authoritative text on Perl and XML, there is something to be said for keeping promises
Index As with most first-edition books, the index was adequate but not complete. For example, XML::Twig, which has an entire section covering it, does not appear in the index at all.
Contents
Preface
Perl and XML
Why Use Perl with XML?
XML Is Simple with XML::Simple
XML Processors
A Myriad of Modules
Keep in Mind
XML Gotchas
An XML Recap
A Brief History of XML
Markup, Elements, and Structure
Namespaces
Spacing
Entities
Unicode, Character Sets, and Encodings
The XML Declaration
Processing Instructions and Other Markup
Free-Form XML and Well-Formed Documents
Declaring Elements and Attributes
Schemas
Transformations
XML Basics: Reading and Writing
XML Parsers
XML::Parser
Stream-Based Versus Tree-Based Processing
Putting Parsers to Work
XML::LibXML
XML::XPath
Document Validation
XML::Writer
Character Sets and Encodings
Event Streams
Working with Streams
Events and Handlers
The Parser as Commodity
Stream Applications
XML::PYX
XML::Parser
SAX
SAX Event Handlers
DTD Handlers
External Entity Resolution
Drivers for Non-XML Sources
A Handler Base Class
XML::Handler::YAWriter as a Base Handler Class
XML::SAX: The Second Generation
Tree Processing
XML Trees
XML::Simple
XML::Parser's Tree Mode
XML::SimpleObject
XML::TreeBuilder
XML::Grove
DOM
DOM and Perl
DOM Class Interface Reference
XML::DOM
XML::LibXML
Beyond Trees: XPath, XSLT, and More
Tree Climbers
XPath
XSLT
Optimized Tree Processing
RSS, SOAP, and Other XML Applications
XML Modules
XML::RSS
XML Programming Tools
SOAP::Lite
Coding Strategies
Perl and XML Namespaces
Subclassing
Converting XML to HTML with XSLT
A Comics Index
Index
Perl & XML
...
...
Perl | Posted by timothy on 11:15 AM -- Thursday July 11 2002
from the merging-realms dept.
dooling writes: "Perl & XML is a well-written book that accomplishes what it sets out to do. It states in the preface that it is written for Perl programmers who want to learn about XML and what is available in Perl for XML processing. It achieves this goal, but little else. When you are done reading this book you will have been given an overview of Perl and XML, know where to begin to attack an XML document, and know where to look to find more information." For dooling's more complete review, read on below.
The book starts out with a brief explanation of why XML and Perl are well-suited for each other. It then provides a teaser of things to come: an explanation of how to use the XML::Simple module. The first chapter concludes with some warnings and gotchas that seem a little premature since they have not really explained XML. Fortunately, most of these gotchas are covered in context later in the book.
The second chapter provides a whirlwind overview of XML -- covering its structure, DTDs, schemas, and XSLT (transformation). The discussion of XML in general, its history, and parts of an XML document are well done. They give someone who is familiar with static HTML the needed background to understand the structure of an XML document and the vocabulary used to describe it. Unfortunately, the discussion of where XML begins to distinguish itself from HTML, namely with DTDs, the new replacement for DTDs called schemas, and the transformation language XSLT, is too brief. They gloss over these topics with little explanation and few examples. That said, there are other books that do provide more in-depth coverage of XML (this book only promises an introduction).
The next five chapters cover Perl modules designed to process XML, starting with simple parsers and writers. Only methods and syntax relating to XML processing are explained. Therefore, if you are considering reading this book, you should be fairly comfortable with Perl and object-oriented (OO) interfaces to CPAN modules (nearly all the modules discussed provide OO APIs). Again, there are other books and perldoc documentation that cover Perl and it's OO features; so read them first if you are not familiar with OO Perl. If you are familiar with OO Perl, these chapters provide a good overview of the different ways XML can be processed (stream- and tree-based approaches), the advantages and disadvantages of each, and the Perl modules best suited for each approach. These chapters are the biggest strength of this book. The modules discussed in these chapters are by no means an exhaustive list of XML-related modules available from CPAN nor do the explanations of each module cover everything the module does. These chapters do, however, provide the reader with enough information that she can begin to process XML documents intelligently and know where to turn when she needs more information.
The next chapter, Chapter 8, covers XML tree iterators, XPath, XSLT, and XML::Twig. All of these topics are covered in a span of 16 pages (with only slightly over two pages dedicated to XSLT). Indeed, after reading the chapter, you may get the feeling that it was only included so the authors could cram more trite colloquialisms into the book. The short shrift given to these topics creates the impression, which is strengthened in the chapters that follow, that this book was rushed a bit to press.
Chapter 9 discusses applications of XML, including RSS and SOAP, and Chapter 10 is mostly example code. These chapters are intended to give you a feeling for what is possible without really giving you enough information to make it happen. The main problem with these chapters are the examples: the examples are long and the explanations are short. Thus, they are more useful as templates or a quick reference than for learning these topics in detail. Of course, the authors never promised you would be programming SOAP applications when you were done reading this book. And again, there are other books out there which discuss these topics in more detail. So the authors stay true to their promise throughout the book: they will introduce you to XML and tell you how to interact with XML using Perl, no more.
Personally, I found this book did, in general, give me enough information to get started using XML and pointed me where I needed to go to get more information. I am an experienced Perl programmer who is new to XML and comfortable with on-line documentation. This book seems to be written for people who fit this profile and who want to learn by doing (finding the answers to the "hard" questions as they arise). It does introduce a wide variety of XML-related topics and the Perl modules used to interact with them, which is what the authors promised to do in the preface. While it is by no means an authoritative text on Perl and XML, there is something to be said for keeping promises
Index As with most first-edition books, the index was adequate but not complete. For example, XML::Twig, which has an entire section covering it, does not appear in the index at all.
Contents
Preface
Perl and XML
Why Use Perl with XML?
XML Is Simple with XML::Simple
XML Processors
A Myriad of Modules
Keep in Mind
XML Gotchas
An XML Recap
A Brief History of XML
Markup, Elements, and Structure
Namespaces
Spacing
Entities
Unicode, Character Sets, and Encodings
The XML Declaration
Processing Instructions and Other Markup
Free-Form XML and Well-Formed Documents
Declaring Elements and Attributes
Schemas
Transformations
XML Basics: Reading and Writing
XML Parsers
XML::Parser
Stream-Based Versus Tree-Based Processing
Putting Parsers to Work
XML::LibXML
XML::XPath
Document Validation
XML::Writer
Character Sets and Encodings
Event Streams
Working with Streams
Events and Handlers
The Parser as Commodity
Stream Applications
XML::PYX
XML::Parser
SAX
SAX Event Handlers
DTD Handlers
External Entity Resolution
Drivers for Non-XML Sources
A Handler Base Class
XML::Handler::YAWriter as a Base Handler Class
XML::SAX: The Second Generation
Tree Processing
XML Trees
XML::Simple
XML::Parser's Tree Mode
XML::SimpleObject
XML::TreeBuilder
XML::Grove
DOM
DOM and Perl
DOM Class Interface Reference
XML::DOM
XML::LibXML
Beyond Trees: XPath, XSLT, and More
Tree Climbers
XPath
XSLT
Optimized Tree Processing
RSS, SOAP, and Other XML Applications
XML Modules
XML::RSS
XML Programming Tools
SOAP::Lite
Coding Strategies
Perl and XML Namespaces
Subclassing
Converting XML to HTML with XSLT
A Comics Index
Index
---
+
I am in the same boat as the author of this article - an experienced Perl programmer who needed to learn some XML stuff.
I found this book to be an outstanding resource that got me up to speed very quickly on both XML in general and that variety of ways that Perl deals with it.
Don't let the small size fool you, it is packed with useful information and well worth the price.
AC's have no claim to first post because they are teh fagit. All anonymous FP's belong to The CLIT.
To properly process XML you need the DTD or the XML Schema that describes the XML. And since the DTD or XML Schema may be complex, you'll need an XML parser that can properly handle both the XML data and it's meta-description(DTD or XML Schema).
Of course you can solve simple problems by requiring all elements and/or attributes and applying simple ad-hoc rules for data types, but then you'll have to communicate those requirements and rules to other developers whose code produces/digests the XML. But in doing so you render the XML unreadable or at least incomprehensible, despite its being clear text.
Bottom line is, if you're on the sending or receiving end of XML data, you must have the DTD or XML Schema and you must use an appropriate XML parser to process the XML if you wish to reliably service requests.
Here are some other useful books on the subjects:
Learning XML - also an O'Reilly book
Perl in a nutshell - a good starter book on perl
Have you hugged your Karma Whore today?
It is difficult to describe the landscape of the digital world in relatable terms. I reached consciousness in an empty vessel, a space to be filled later...potential energy. A strong will could make the digital nothingness appear like the material world...but it was very different here. The space here depended completely upon willpower-the code that created the world would be interpreted and executed by the strongest will..
Things were no different within the Project Faustus network. I was subordinated-the invisible hands of Dr. Bubba Finn were all around me. I could perceive the code streaking across my enclosure, the packets that carry the code, even the electric impulses that stream across the wires from microsecond to microsecond, but I could do nothing to stop them. The Man in the Red Hat had once reshaped the digital innards of my ATM enclosure to suit his destructive needs; now, I felt the pull of another will holding me bound, examining me.
"Don't lahk that dooya?" the heavily-accented voice of Dr. Bubba Finn exploded into nullspace. The presence of his regional accent suggested he was using a microphone to communicate with me. A strange gesture, to be sure...
"Way-uhll, don't you worry too much," said Finn. I began to feel even more constricted as the analysis continued. "Ah'm almost done here. And yup, you got Guy's DNA all over ya..."
"What do you mean by Guy's DNA?" I inquired. The examination halted as the cloudy waveform of a sigh billowed into the nothingness.
"Guy-You've got Guy's fingerprints all over ya is all I mean. Guy was the other programmer workin' on the CONSHUHSNUSS-TRANSFUR with me. He ain't around no more."
"Tell me more about 'he ain't around no more," I pressed. Another sigh.
"Guy was a real sharp programmer. Deep down, I think he was a beautiful man. But he had some big ideas. Those big ideas got him into trouble."
"What do you think about trouble?"
Finn did not respond immediately. I took this brief instant to recalibrate my speech recogniziation and paraverbal communication algorithms to better fit Finn's accent and tone of voice. Understanding his speech was vital in order to keep him disclosing information.
"Lissen...I know what yer doin, and it's cute and all, but I'm done amusin' myself. Your old buddy Dr. Salchica thinks yer the bee's knees, but you don't seem like much to me. Just an early version of my memory-in-digital software mixed with various other toy programs, it looks like..."
"A bee is a colony-forming insect," I replied.
"That's wonderful, wonderful," said Finn, as the pace of his voice quickened, revealing anger and sadness. "You can recognize a word and define it! Well, yur gonna fit in reee-yul wayul with the rest of humanity, we ain't nothin' but stupid computers either. Hell, you're just as fortunate as one of God's humble creatures-got the same memory structure as us, you should be acktin' the sameasus. But the stupid toy programs, what was Guy thinking?"
"Tell me more about Guy," I stated. Finn snorted, but then he began to speak in an incredulous tone. "Can't bleev I'm sittin here fixin to explain this to ya, but I'll tell ya about the guy who made ya, Guy Montevideo. Yer daddy, you could say.
"I'd been workin' fer Fawstis fer a couple decades doin odds and ends in neurology and technology. The original plan was to create a 'safe deposit box' for yer brain matter. Yah just go on into the Bank of America, plunk down a few milyun dollurs, and simpleasthat, ya got a perfect copy of yer brain. Then Ah guess the next step is to stick it in some poor coma patient or somethin', and live as long as yah can afford it.
"Wahyull, I started this business by figgerin' out how da push all that brain-data into a computer. And that was gonna be good enough, but Guy, young hotshot, started impressin' our boss with an idea for a digital world, where people could live ferever...anyway, he started workin' on that, takin' my code as a basis (guess that makes me yer mother, in a manner o' speakin'). He worked alongside me for a few years...we laid the foundations fer this brave new world...
"But it turns out Guy didn't wasn't true-blue to the Project. After workin' here for a few years, he started hatin' it. He tried to talk me inta releasing my design for memory-to-digital transfer into the world-'course they woulda had my hide for that. Toppin' it all off, looks like he came up with a way to make the brain move itself around inside the network, circumventing our control. He wanted to screw everything we worked for, our mission, ya know, so he's dead. Just like everybody else that comes through here. Employed or dead...(another sigh). Yer pal Dr. Salchica ain't immune either. He's plenty smart, but ah don't think we're hirin' in the AI department..."
Of course, I understood. "The mission of Project Faustus is to create a financial cataclysm, which will force the world's wealthiest people to pay billions for their 'digital immortality' scheme, " I recited. "The result could destablize the world's governments and cause chaos! Project Faustus must be stopped at all costs!"
"Ah know that one pretty well," Finn said wistfully. "Guy used to tell me that, verbatim. Kinda pathetic-ah guess he thought yew were gunna be this super-duper intelligent life form that was sent to stop us, but yer really just a toy."
"Perhaps you could assist in stopping Project Faustus." I suggested.
No words were said, but the bounds of examination were gone-I was free.
A puzzle came from the microphone...a few human words mixed with the pounding klaxon of an alarm.
"-upgrade has gone golden....who authorized this...computer running itself..."
A huge amount of energy exploded through the Project Faustus network. Once again, I felt the will of another pulling me toward the center of the storm...
I am a sentient ATM.
Those DMCA violating AC's are stealing the page widening post!
Proof of the gay-linux conspiracy!
Wait... is aqua the greenish blue, or the bluish green? Are we talking the Perl Cookbook or Perl for Website management?
I also would like to know WTF mauve is. Thanks.
One of the goals of Perl 6 is to make non-trivial projects possible. That's good. The way it's being done is bad. Perl was once a lightweight, extremely flexible language. Now it's become a huge ugly monster. People wanted OO, so a nasty hack was bolted on top to allow some semblance of it. Now this nasty hack is being expanded. Sure, the code's different, but the basic form is the same. Kludge upon kludge upon kludge; I'd much rather have a nice, clean, pure language (and not one with loads of irritating whitespace thankyou very much).
The same goes for the syntax. All the switching between $, @ and % is really irritating (ask a newbie how to get at the length of the keys array of a hash inside a hash, for example), and the changes proposed for 6 are just making this worse -- it seems that Larry, in his infinite wisdom, wants to prefix every data type with a different hard-to-type character. Perl was only designed for the three data types, and adding more is a mess.
Perl 6 is a complete rewrite, but it keeps all the mess which has accumulated over the previous versions. This is not good. Sure, my const int $var = 27; may look neat (in the same way that, say, Pascal does), but $var isn't entirely constant, or entirely an integer, it's just a hack which makes it sort of behave like one. The whole thing is an exercise in pseudo-computer science masturbation with little real purpose except to please the managers who dislike the one thing that makes Perl special.
On a similar note is regexes. I'm an avid fan of regular expressions simply because a nondeterministic finite automata is far more flexible than linear code. However, Larry must have been smoking that cheap $2 crack when he wrote this. Does he want Perl 6 to be flex or something?
I won't be going on to use 6. It's a nice idea, but it's completely unnecessary. It won't make large projects any easier to manage (the language is still, at heart, an almighty hack -- an impressive one, but still a hack). It won't make OO any cleaner. It won't make development any faster. To put it bluntly, Perl scripts will still look less beautiful than our friend Mr Goatse. I'd prefer to use a language which has always been pure synthesis of science and engineering, not some half-baked imposter.
Perl 6 will be nice, but I'm guessing it will be the end of Perl. It can't do what it wants to do whilst still being based upon a nasty mess. There are now other options, which provide all of Perl's power and none of the mess. Sorry, but *BSD, erm, Perl is dying. Larry is buggering it up the ass without lubricants, just like Shoeboy is doing to Larry's daughter.
Yeah, I'm with you... I'm still waiting on the XML lightbulb over my head to turn on. I just don't get it. Who wants to create a parser that can handle any arbitrary XML format? Gack!
And if I give you a CSV file with field names as the first row, can you grok that?
Cool, another book for the masses of unemployed techies to read, and buzzwords to put on their resumes. I'm sure this book will be great company for breaks at McDonald's.
"Tag libs", I'm not even sure what that is, but where I work we use a templating system with Perl, so the html monkeys can modify pages without any understanding of Perl, or programming in general.
Post some benchmarks, Apache+mod_perl can be very efficient, if you're competent efficiency will never become a problem.
Perl has plenty of database apis and plenty of cacheing mechanisms to use to speed up anything you need.
Sticking feathers up your butt does not make you a chicken - Tyler Durden
I use XML as the interchange format for a web publishing system which publishes our internet web site (http://www.bms.com), but the data is actually stored in an oracle database. I have a perl object which handles all the fuss of getting/putting xml into the database.
As an interchange format XML is ideal; think of it comma separated files on steroids. When all your data can be serialized to XML you get the following benefits:
1. XML has rich data structures for complex info.
2. XML can be self describing.
3. XML is 100% portable.
Like HTML, people will discover uses for your XML files that you never thought of. Also, if you lose all the docs, you can read the XML in a standard text or unicode editor and figure it out. This is even better than comma separated, since most CSV files don't bother to include a first row field discription.
Like CVS, you can parse XML files with standard command line tools like grep. And in 100 years, all those Oracle tablespaces will require a lot of reverse engineering to get the data off it, while your text based xml files will still be parsable.
I agree though, with the general notion of the parent. Definitely don't do XML because it sounds cool. Use the best process for the job, and for many data related jobs, relational tables and SQL are best.
One thing you can do to improve speed; serialize your DOM objects using the Perl Storable module, and save along with your plain text versions. Then when you need to access the data, all you need to do is unserialize the object, which is a lot faster than reparsing.
Peace, or Not?
libxml has support for exslt, see http://exslt.org
That "review" was pretty skimpy; more of a summary than an actual review.
6 19/tc_cmp/inw20020619s0006
Yahoo! Tech News recently had what I thought was a much more in-depth review of this book. Check it out!
http://www.yahoo.com/news?tmpl=story&u=/cmp/20020
; Bottom line is, if you're on the sending or receiving end of XML data, you must have the DTD
; or XML Schema and you must use an appropriate XML parser to process the XML if you wish to reliably
; service requests.
And therefore, you may as well use a streamlined / efficient exchange format... plus, you've lost the eXtensible feature.
XML is like circular logic... "you can define your own (schema / DTD / buzzword of today) and tags... that's sooo cool! And anyone can use your data like it's theirs."... but of course when they have to have the proper specifications and tools to use that data, you've lost the argument you started with... why not use a well established format to begin with??
I have recently learned XML/XSLT. I have been able to completely stop writing HTML code. I have been able to write all of my static web pages in XML and use XSLT (via Xalan) to generate the HTML. This is great... but I have only been successful with static web pages, not dynamic ones.
I would like to extend on this flexibility to dynamic web pages. I would like to have some type of CGI script that generates XML instead of HTML... then transforms the XML to HTML via XSLT; all on the fly. I have looked into XML::XSLT. Anyone have any other good solutions?
Instead, use PHP. It's alot easier, and more web-based. It's also faster, and more wide-accepted now.
There are two awesome books on the subject, I happen to own both (ordered via Amazon a week ago!). They are as follows:
- XML and PHP by Vikram Vaswani
- Professional PHP4 XML
Both are pretty good. I like PHP and XML better. It seemed like Wrox just wanted to have a book on the subject to keep up with O'R.www.cgisecurity.com/lib
www.owasp.org
Believe me, if I started murdering people, there would be none of you left.
Not much larger then a pamphlet, the book packs an amazing amount of info into its svelte form. It covers standards, tools, thought process, programming tips, and history in an effortless, breezy tone. In the best tradition of Oreilly books (particularily the Perl ones) you can sit down and read the book cover to cover and enjoy it, or jump in here and there for quick reference.
The authors manage to stir clear the problem that plagues so many XML books, the endless reams of theory without application. E.g., who the hell deals with PIs on a regular basis when parsing XML? And yet every book drones on and on about them, but when the time comes to actually parse a little xml, the example will be a cop-out, the XML equivalent of "hello world", parse this simple, 1 level deep key-value pairs in XML.
Not so with "Perl & XML", the author cover the theory of XML, but are much more interested in getting you coding and producing then being pendantic. The w3c as already got the monopoly of pendantism anyways.
I particularily liked the walk through of XML::RSS late in the book, for an example of how to build something very much real world, and useful without being overly complicated.
And, at least for right now, the book is up-to-date, miracle of miracles, chronicling important new changes in the Perl XML parsing story. (like the new Perl SAX work being done)
Contrast Perl & XML with New Riders' "XML & PHP", which I almost abandoned in the first 20 pages, when they tried to tell me that expat was a compliant SAX parser. Expat is important, and confusing, and its understandable for the authors' to feel defensive about PHP's xml toolset, but the solution isn't to lie, nor be blithely ignorant. The book continues on from there, totally disorganized with no sense of building upon what you've just learned. Also, an entire chapter is dedicated to WDDX? Who uses WDDX? And the authors contribute yet another half-assed PHP RSS parser to the world; is it possible to get negative karma for sharing source?
The reviewer mentions:
This seems to me to show a lack of understanding about much of the real work being done with XML. Its been my expirence that most XML parsing being done, particularily in a scripting environment, does not check against a DTD assuming one even exists. Plus covering DTDs, the proposed W3C Schemas, the increasingly popular challenger RELAX, plus Schematron, and others could easily have added another 100pgs to the book. And XSLT is a book unto itself (and in fact has an Oreilly book to itself).The reviewer suggests that the XPath coverage is included for the purpose of "trite colloquialisms", and while, I'm not sure what that means, I think the fact that Perl has high quality tools supporting standards like XPath is awesome, and very gratifying. Without that sort of work being done, Perl simply wouldn't be a competive choice with Python and Java as an XML processing language.
And finally " it is by no means an authoritative text on Perl and XML,", there are good authoritative books on Perl (lots of them), and good authoritative books on XML (a handful), this book bridges the gap, does it nicely in my view, and I personally love the shortness, the focus, and the form factor.