xml.html 244 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <title>The XML C parser and toolkit of Gnome</title>
  6. <meta name="GENERATOR" content="amaya 8.5, see http://www.w3.org/Amaya/">
  7. <meta http-equiv="Content-Type" content="text/html">
  8. </head>
  9. <body bgcolor="#ffffff">
  10. <h1 align="center">The XML C parser and toolkit of Gnome</h1>
  11. <h1>Note: this is the flat content of the <a href="index.html">web
  12. site</a></h1>
  13. <h1 style="text-align: center">libxml, a.k.a. gnome-xml</h1>
  14. <p></p>
  15. <p
  16. style="text-align: right; font-style: italic; font-size: 10pt">"Programming
  17. with libxml2 is like the thrilling embrace of an exotic stranger." <a
  18. href="http://diveintomark.org/archives/2004/02/18/libxml2">Mark
  19. Pilgrim</a></p>
  20. <p>Libxml2 is the XML C parser and toolkit developed for the Gnome project
  21. (but usable outside of the Gnome platform), it is free software available
  22. under the <a href="http://www.opensource.org/licenses/mit-license.html">MIT
  23. License</a>. XML itself is a metalanguage to design markup languages, i.e.
  24. text language where semantic and structure are added to the content using
  25. extra "markup" information enclosed between angle brackets. HTML is the most
  26. well-known markup language. Though the library is written in C <a
  27. href="python.html">a variety of language bindings</a> make it available in
  28. other environments.</p>
  29. <p>Libxml2 is known to be very portable, the library should build and work
  30. without serious troubles on a variety of systems (Linux, Unix, Windows,
  31. CygWin, MacOS, MacOS X, RISC Os, OS/2, VMS, QNX, MVS, VxWorks, ...)</p>
  32. <p>Libxml2 implements a number of existing standards related to markup
  33. languages:</p>
  34. <ul>
  35. <li>the XML standard: <a
  36. href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</a></li>
  37. <li>Namespaces in XML: <a
  38. href="http://www.w3.org/TR/REC-xml-names/">http://www.w3.org/TR/REC-xml-names/</a></li>
  39. <li>XML Base: <a
  40. href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a></li>
  41. <li><a href="http://www.cis.ohio-state.edu/rfc/rfc2396.txt">RFC 2396</a> :
  42. Uniform Resource Identifiers <a
  43. href="http://www.ietf.org/rfc/rfc2396.txt">http://www.ietf.org/rfc/rfc2396.txt</a></li>
  44. <li>XML Path Language (XPath) 1.0: <a
  45. href="http://www.w3.org/TR/xpath">http://www.w3.org/TR/xpath</a></li>
  46. <li>HTML4 parser: <a
  47. href="http://www.w3.org/TR/html401/">http://www.w3.org/TR/html401/</a></li>
  48. <li>XML Pointer Language (XPointer) Version 1.0: <a
  49. href="http://www.w3.org/TR/xptr">http://www.w3.org/TR/xptr</a></li>
  50. <li>XML Inclusions (XInclude) Version 1.0: <a
  51. href="http://www.w3.org/TR/xinclude/">http://www.w3.org/TR/xinclude/</a></li>
  52. <li>ISO-8859-x encodings, as well as <a
  53. href="http://www.cis.ohio-state.edu/rfc/rfc2044.txt">rfc2044</a> [UTF-8]
  54. and <a href="http://www.cis.ohio-state.edu/rfc/rfc2781.txt">rfc2781</a>
  55. [UTF-16] Unicode encodings, and more if using iconv support</li>
  56. <li>part of SGML Open Technical Resolution TR9401:1997</li>
  57. <li>XML Catalogs Working Draft 06 August 2001: <a
  58. href="http://www.oasis-open.org/committees/entity/spec-2001-08-06.html">http://www.oasis-open.org/committees/entity/spec-2001-08-06.html</a></li>
  59. <li>Canonical XML Version 1.0: <a
  60. href="http://www.w3.org/TR/xml-c14n">http://www.w3.org/TR/xml-c14n</a>
  61. and the Exclusive XML Canonicalization CR draft <a
  62. href="http://www.w3.org/TR/xml-exc-c14n">http://www.w3.org/TR/xml-exc-c14n</a></li>
  63. <li>Relax NG, ISO/IEC 19757-2:2003, <a
  64. href="http://www.oasis-open.org/committees/relax-ng/spec-20011203.html">http://www.oasis-open.org/committees/relax-ng/spec-20011203.html</a></li>
  65. <li>W3C XML Schemas Part 2: Datatypes <a
  66. href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/">REC 02 May
  67. 2001</a></li>
  68. <li>W3C <a href="http://www.w3.org/TR/xml-id/">xml:id</a> Working Draft 7
  69. April 2004</li>
  70. </ul>
  71. <p>In most cases libxml2 tries to implement the specifications in a
  72. relatively strictly compliant way. As of release 2.4.16, libxml2 passed all
  73. 1800+ tests from the <a
  74. href="http://www.oasis-open.org/committees/xml-conformance/">OASIS XML Tests
  75. Suite</a>.</p>
  76. <p>To some extent libxml2 provides support for the following additional
  77. specifications but doesn't claim to implement them completely:</p>
  78. <ul>
  79. <li>Document Object Model (DOM) <a
  80. href="http://www.w3.org/TR/DOM-Level-2-Core/">http://www.w3.org/TR/DOM-Level-2-Core/</a>
  81. the document model, but it doesn't implement the API itself, gdome2 does
  82. this on top of libxml2</li>
  83. <li><a href="http://www.cis.ohio-state.edu/rfc/rfc959.txt">RFC 959</a> :
  84. libxml2 implements a basic FTP client code</li>
  85. <li><a href="http://www.cis.ohio-state.edu/rfc/rfc1945.txt">RFC 1945</a> :
  86. HTTP/1.0, again a basic HTTP client code</li>
  87. <li>SAX: a SAX2 like interface and a minimal SAX1 implementation compatible
  88. with early expat versions</li>
  89. </ul>
  90. <p>A partial implementation of <a
  91. href="http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/">XML Schemas Part
  92. 1: Structure</a> is being worked on but it would be far too early to make any
  93. conformance statement about it at the moment.</p>
  94. <p>Separate documents:</p>
  95. <ul>
  96. <li><a href="http://xmlsoft.org/XSLT/">the libxslt page</a> providing an
  97. implementation of XSLT 1.0 and common extensions like EXSLT for
  98. libxml2</li>
  99. <li><a href="http://gdome2.cs.unibo.it/">the gdome2 page</a>
  100. : a standard DOM2 implementation for libxml2</li>
  101. <li><a href="http://www.aleksey.com/xmlsec/">the XMLSec page</a>: an
  102. implementation of <a href="http://www.w3.org/TR/xmldsig-core/">W3C XML
  103. Digital Signature</a> for libxml2</li>
  104. <li>also check the related links section for more related and active
  105. projects.</li>
  106. </ul>
  107. <p> Hosting sponsored by <a href="http://www.aoemedia.de/opensource-cms.html"
  108. >Open Source CMS services</a> from AOE media.</p>
  109. <p>Logo designed by <a href="mailto:liyanage@access.ch">Marc Liyanage</a>.</p>
  110. <h2><a name="Introducti">Introduction</a></h2>
  111. <p>This document describes libxml, the <a
  112. href="http://www.w3.org/XML/">XML</a> C parser and toolkit developed for the
  113. <a href="http://www.gnome.org/">Gnome</a> project. <a
  114. href="http://www.w3.org/XML/">XML is a standard</a> for building tag-based
  115. structured documents/data.</p>
  116. <p>Here are some key points about libxml:</p>
  117. <ul>
  118. <li>Libxml2 exports Push (progressive) and Pull (blocking) type parser
  119. interfaces for both XML and HTML.</li>
  120. <li>Libxml2 can do DTD validation at parse time, using a parsed document
  121. instance, or with an arbitrary DTD.</li>
  122. <li>Libxml2 includes complete <a
  123. href="http://www.w3.org/TR/xpath">XPath</a>, <a
  124. href="http://www.w3.org/TR/xptr">XPointer</a> and <a
  125. href="http://www.w3.org/TR/xinclude">XInclude</a> implementations.</li>
  126. <li>It is written in plain C, making as few assumptions as possible, and
  127. sticking closely to ANSI C/POSIX for easy embedding. Works on
  128. Linux/Unix/Windows, ported to a number of other platforms.</li>
  129. <li>Basic support for HTTP and FTP client allowing applications to fetch
  130. remote resources.</li>
  131. <li>The design is modular, most of the extensions can be compiled out.</li>
  132. <li>The internal document representation is as close as possible to the <a
  133. href="http://www.w3.org/DOM/">DOM</a> interfaces.</li>
  134. <li>Libxml2 also has a <a
  135. href="http://www.megginson.com/SAX/index.html">SAX like interface</a>;
  136. the interface is designed to be compatible with <a
  137. href="http://www.jclark.com/xml/expat.html">Expat</a>.</li>
  138. <li>This library is released under the <a
  139. href="http://www.opensource.org/licenses/mit-license.html">MIT
  140. License</a>. See the Copyright file in the distribution for the precise
  141. wording.</li>
  142. </ul>
  143. <p>Warning: unless you are forced to because your application links with a
  144. Gnome-1.X library requiring it, <strong><span
  145. style="background-color: #FF0000">Do Not Use libxml1</span></strong>, use
  146. libxml2</p>
  147. <h2><a name="FAQ">FAQ</a></h2>
  148. <p>Table of Contents:</p>
  149. <ul>
  150. <li><a href="FAQ.html#License">License(s)</a></li>
  151. <li><a href="FAQ.html#Installati">Installation</a></li>
  152. <li><a href="FAQ.html#Compilatio">Compilation</a></li>
  153. <li><a href="FAQ.html#Developer">Developer corner</a></li>
  154. </ul>
  155. <h3><a name="License">License</a>(s)</h3>
  156. <ol>
  157. <li><em>Licensing Terms for libxml</em>
  158. <p>libxml2 is released under the <a
  159. href="http://www.opensource.org/licenses/mit-license.html">MIT
  160. License</a>; see the file Copyright in the distribution for the precise
  161. wording</p>
  162. </li>
  163. <li><em>Can I embed libxml2 in a proprietary application ?</em>
  164. <p>Yes. The MIT License allows you to keep proprietary the changes you
  165. made to libxml, but it would be graceful to send-back bug fixes and
  166. improvements as patches for possible incorporation in the main
  167. development tree.</p>
  168. </li>
  169. </ol>
  170. <h3><a name="Installati">Installation</a></h3>
  171. <ol>
  172. <li><strong><span style="background-color: #FF0000">Do Not Use
  173. libxml1</span></strong>, use libxml2</li>
  174. <p></p>
  175. <li><em>Where can I get libxml</em> ?
  176. <p>The original distribution comes from <a
  177. href="ftp://xmlsoft.org/libxml2/">xmlsoft.org</a> or <a
  178. href="ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/">gnome.org</a></p>
  179. <p>Most Linux and BSD distributions include libxml, this is probably the
  180. safer way for end-users to use libxml.</p>
  181. <p>David Doolin provides precompiled Windows versions at <a
  182. href="http://www.ce.berkeley.edu/~doolin/code/libxmlwin32/ ">http://www.ce.berkeley.edu/~doolin/code/libxmlwin32/</a></p>
  183. </li>
  184. <p></p>
  185. <li><em>I see libxml and libxml2 releases, which one should I install ?</em>
  186. <ul>
  187. <li>If you are not constrained by backward compatibility issues with
  188. existing applications, install libxml2 only</li>
  189. <li>If you are not doing development, you can safely install both.
  190. Usually the packages <a
  191. href="http://rpmfind.net/linux/RPM/libxml.html">libxml</a> and <a
  192. href="http://rpmfind.net/linux/RPM/libxml2.html">libxml2</a> are
  193. compatible (this is not the case for development packages).</li>
  194. <li>If you are a developer and your system provides separate packaging
  195. for shared libraries and the development components, it is possible
  196. to install libxml and libxml2, and also <a
  197. href="http://rpmfind.net/linux/RPM/libxml-devel.html">libxml-devel</a>
  198. and <a
  199. href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml2-devel</a>
  200. too for libxml2 &gt;= 2.3.0</li>
  201. <li>If you are developing a new application, please develop against
  202. libxml2(-devel)</li>
  203. </ul>
  204. </li>
  205. <li><em>I can't install the libxml package, it conflicts with libxml0</em>
  206. <p>You probably have an old libxml0 package used to provide the shared
  207. library for libxml.so.0, you can probably safely remove it. The libxml
  208. packages provided on <a
  209. href="ftp://xmlsoft.org/libxml2/">xmlsoft.org</a> provide
  210. libxml.so.0</p>
  211. </li>
  212. <li><em>I can't install the libxml(2) RPM package due to failed
  213. dependencies</em>
  214. <p>The most generic solution is to re-fetch the latest src.rpm , and
  215. rebuild it locally with</p>
  216. <p><code>rpm --rebuild libxml(2)-xxx.src.rpm</code>.</p>
  217. <p>If everything goes well it will generate two binary rpm packages (one
  218. providing the shared libs and xmllint, and the other one, the -devel
  219. package, providing includes, static libraries and scripts needed to build
  220. applications with libxml(2)) that you can install locally.</p>
  221. </li>
  222. </ol>
  223. <h3><a name="Compilatio">Compilation</a></h3>
  224. <ol>
  225. <li><em>What is the process to compile libxml2 ?</em>
  226. <p>As most UNIX libraries libxml2 follows the "standard":</p>
  227. <p><code>gunzip -c xxx.tar.gz | tar xvf -</code></p>
  228. <p><code>cd libxml-xxxx</code></p>
  229. <p><code>./configure --help</code></p>
  230. <p>to see the options, then the compilation/installation proper</p>
  231. <p><code>./configure [possible options]</code></p>
  232. <p><code>make</code></p>
  233. <p><code>make install</code></p>
  234. <p>At that point you may have to rerun ldconfig or a similar utility to
  235. update your list of installed shared libs.</p>
  236. </li>
  237. <li><em>What other libraries are needed to compile/install libxml2 ?</em>
  238. <p>Libxml2 does not require any other library, the normal C ANSI API
  239. should be sufficient (please report any violation to this rule you may
  240. find).</p>
  241. <p>However if found at configuration time libxml2 will detect and use the
  242. following libs:</p>
  243. <ul>
  244. <li><a href="http://www.info-zip.org/pub/infozip/zlib/">libz</a> : a
  245. highly portable and available widely compression library.</li>
  246. <li>iconv: a powerful character encoding conversion library. It is
  247. included by default in recent glibc libraries, so it doesn't need to
  248. be installed specifically on Linux. It now seems a <a
  249. href="http://www.opennc.org/onlinepubs/7908799/xsh/iconv.html">part
  250. of the official UNIX</a> specification. Here is one <a
  251. href="http://www.gnu.org/software/libiconv/">implementation of the
  252. library</a> which source can be found <a
  253. href="ftp://ftp.ilog.fr/pub/Users/haible/gnu/">here</a>.</li>
  254. </ul>
  255. </li>
  256. <p></p>
  257. <li><em>Make check fails on some platforms</em>
  258. <p>Sometimes the regression tests' results don't completely match the
  259. value produced by the parser, and the makefile uses diff to print the
  260. delta. On some platforms the diff return breaks the compilation process;
  261. if the diff is small this is probably not a serious problem.</p>
  262. <p>Sometimes (especially on Solaris) make checks fail due to limitations
  263. in make. Try using GNU-make instead.</p>
  264. </li>
  265. <li><em>I use the SVN version and there is no configure script</em>
  266. <p>The configure script (and other Makefiles) are generated. Use the
  267. autogen.sh script to regenerate the configure script and Makefiles,
  268. like:</p>
  269. <p><code>./autogen.sh --prefix=/usr --disable-shared</code></p>
  270. </li>
  271. <li><em>I have troubles when running make tests with gcc-3.0</em>
  272. <p>It seems the initial release of gcc-3.0 has a problem with the
  273. optimizer which miscompiles the URI module. Please use another
  274. compiler.</p>
  275. </li>
  276. </ol>
  277. <h3><a name="Developer">Developer</a> corner</h3>
  278. <ol>
  279. <li><em>Troubles compiling or linking programs using libxml2</em>
  280. <p>Usually the problem comes from the fact that the compiler doesn't get
  281. the right compilation or linking flags. There is a small shell script
  282. <code>xml2-config</code> which is installed as part of libxml2 usual
  283. install process which provides those flags. Use</p>
  284. <p><code>xml2-config --cflags</code></p>
  285. <p>to get the compilation flags and</p>
  286. <p><code>xml2-config --libs</code></p>
  287. <p>to get the linker flags. Usually this is done directly from the
  288. Makefile as:</p>
  289. <p><code>CFLAGS=`xml2-config --cflags`</code></p>
  290. <p><code>LIBS=`xml2-config --libs`</code></p>
  291. </li>
  292. <li><em>I want to install my own copy of libxml2 in my home directory and
  293. link my programs against it, but it doesn't work</em>
  294. <p>There are many different ways to accomplish this. Here is one way to
  295. do this under Linux. Suppose your home directory is <code>/home/user.
  296. </code>Then:</p>
  297. <ul>
  298. <li>Create a subdirectory, let's call it <code>myxml</code></li>
  299. <li>unpack the libxml2 distribution into that subdirectory</li>
  300. <li>chdir into the unpacked distribution
  301. (<code>/home/user/myxml/libxml2 </code>)</li>
  302. <li>configure the library using the "<code>--prefix</code>" switch,
  303. specifying an installation subdirectory in
  304. <code>/home/user/myxml</code>, e.g.
  305. <p><code>./configure --prefix /home/user/myxml/xmlinst</code> {other
  306. configuration options}</p>
  307. </li>
  308. <li>now run <code>make</code> followed by <code>make install</code></li>
  309. <li>At this point, the installation subdirectory contains the complete
  310. "private" include files, library files and binary program files (e.g.
  311. xmllint), located in
  312. <p><code>/home/user/myxml/xmlinst/lib,
  313. /home/user/myxml/xmlinst/include </code> and <code>
  314. /home/user/myxml/xmlinst/bin</code></p>
  315. respectively.</li>
  316. <li>In order to use this "private" library, you should first add it to
  317. the beginning of your default PATH (so that your own private program
  318. files such as xmllint will be used instead of the normal system
  319. ones). To do this, the Bash command would be
  320. <p><code>export PATH=/home/user/myxml/xmlinst/bin:$PATH</code></p>
  321. </li>
  322. <li>Now suppose you have a program <code>test1.c</code> that you would
  323. like to compile with your "private" library. Simply compile it using
  324. the command
  325. <p><code>gcc `xml2-config --cflags --libs` -o test test.c</code></p>
  326. Note that, because your PATH has been set with <code>
  327. /home/user/myxml/xmlinst/bin</code> at the beginning, the xml2-config
  328. program which you just installed will be used instead of the system
  329. default one, and this will <em>automatically</em> get the correct
  330. libraries linked with your program.</li>
  331. </ul>
  332. </li>
  333. <p></p>
  334. <li><em>xmlDocDump() generates output on one line.</em>
  335. <p>Libxml2 will not <strong>invent</strong> spaces in the content of a
  336. document since <strong>all spaces in the content of a document are
  337. significant</strong>. If you build a tree from the API and want
  338. indentation:</p>
  339. <ol>
  340. <li>the correct way is to generate those yourself too.</li>
  341. <li>the dangerous way is to ask libxml2 to add those blanks to your
  342. content <strong>modifying the content of your document in the
  343. process</strong>. The result may not be what you expect. There is
  344. <strong>NO</strong> way to guarantee that such a modification won't
  345. affect other parts of the content of your document. See <a
  346. href="http://xmlsoft.org/html/libxml-parser.html#xmlKeepBlanksDefault">xmlKeepBlanksDefault
  347. ()</a> and <a
  348. href="http://xmlsoft.org/html/libxml-tree.html#xmlSaveFormatFile">xmlSaveFormatFile
  349. ()</a></li>
  350. </ol>
  351. </li>
  352. <p></p>
  353. <li><em>Extra nodes in the document:</em>
  354. <p><em>For an XML file as below:</em></p>
  355. <pre>&lt;?xml version="1.0"?&gt;
  356. &lt;PLAN xmlns="http://www.argus.ca/autotest/1.0/"&gt;
  357. &lt;NODE CommFlag="0"/&gt;
  358. &lt;NODE CommFlag="1"/&gt;
  359. &lt;/PLAN&gt;</pre>
  360. <p><em>after parsing it with the function
  361. pxmlDoc=xmlParseFile(...);</em></p>
  362. <p><em>I want to the get the content of the first node (node with the
  363. CommFlag="0")</em></p>
  364. <p><em>so I did it as following;</em></p>
  365. <pre>xmlNodePtr pnode;
  366. pnode=pxmlDoc-&gt;children-&gt;children;</pre>
  367. <p><em>but it does not work. If I change it to</em></p>
  368. <pre>pnode=pxmlDoc-&gt;children-&gt;children-&gt;next;</pre>
  369. <p><em>then it works. Can someone explain it to me.</em></p>
  370. <p></p>
  371. <p>In XML all characters in the content of the document are significant
  372. <strong>including blanks and formatting line breaks</strong>.</p>
  373. <p>The extra nodes you are wondering about are just that, text nodes with
  374. the formatting spaces which are part of the document but that people tend
  375. to forget. There is a function <a
  376. href="http://xmlsoft.org/html/libxml-parser.html">xmlKeepBlanksDefault
  377. ()</a> to remove those at parse time, but that's an heuristic, and its
  378. use should be limited to cases where you are certain there is no
  379. mixed-content in the document.</p>
  380. </li>
  381. <li><em>I get compilation errors of existing code like when accessing
  382. <strong>root</strong> or <strong>child fields</strong> of nodes.</em>
  383. <p>You are compiling code developed for libxml version 1 and using a
  384. libxml2 development environment. Either switch back to libxml v1 devel or
  385. even better fix the code to compile with libxml2 (or both) by <a
  386. href="upgrade.html">following the instructions</a>.</p>
  387. </li>
  388. <li><em>I get compilation errors about non existing
  389. <strong>xmlRootNode</strong> or <strong>xmlChildrenNode</strong>
  390. fields.</em>
  391. <p>The source code you are using has been <a
  392. href="upgrade.html">upgraded</a> to be able to compile with both libxml
  393. and libxml2, but you need to install a more recent version:
  394. libxml(-devel) &gt;= 1.8.8 or libxml2(-devel) &gt;= 2.1.0</p>
  395. </li>
  396. <li><em>Random crashes in threaded applications</em>
  397. <p>Read and follow all advices on the <a href="threads.html">thread
  398. safety</a> page, and make 100% sure you never call xmlCleanupParser()
  399. while the library or an XML document might still be in use by another
  400. thread.</p>
  401. </li>
  402. <li><em>The example provided in the web page does not compile.</em>
  403. <p>It's hard to maintain the documentation in sync with the code
  404. &lt;grin/&gt; ...</p>
  405. <p>Check the previous points 1/ and 2/ raised before, and please send
  406. patches.</p>
  407. </li>
  408. <li><em>Where can I get more examples and information than provided on the
  409. web page?</em>
  410. <p>Ideally a libxml2 book would be nice. I have no such plan ... But you
  411. can:</p>
  412. <ul>
  413. <li>check more deeply the <a href="html/libxml-lib.html">existing
  414. generated doc</a></li>
  415. <li>have a look at <a href="examples/index.html">the set of
  416. examples</a>.</li>
  417. <li>look for examples of use for libxml2 function using the Gnome code
  418. or by asking on Google.</li>
  419. <li><a
  420. href="http://svn.gnome.org/viewvc/libxml2/trunk/">Browse
  421. the libxml2 source</a> , I try to write code as clean and documented
  422. as possible, so looking at it may be helpful. In particular the code
  423. of <a href="http://svn.gnome.org/viewvc/libxml2/trunk/xmllint.c?view=markup">xmllint.c</a> and of the various testXXX.c test programs should
  424. provide good examples of how to do things with the library.</li>
  425. </ul>
  426. </li>
  427. <p></p>
  428. <li><em>What about C++ ?</em>
  429. <p>libxml2 is written in pure C in order to allow easy reuse on a number
  430. of platforms, including embedded systems. I don't intend to convert to
  431. C++.</p>
  432. <p>There is however a C++ wrapper which may fulfill your needs:</p>
  433. <ul>
  434. <li>by Ari Johnson &lt;ari@btigate.com&gt;:
  435. <p>Website: <a
  436. href="http://libxmlplusplus.sourceforge.net/">http://libxmlplusplus.sourceforge.net/</a></p>
  437. <p>Download: <a
  438. href="http://sourceforge.net/project/showfiles.php?group_id=12999">http://sourceforge.net/project/showfiles.php?group_id=12999</a></p>
  439. </li>
  440. </ul>
  441. </li>
  442. <li><em>How to validate a document a posteriori ?</em>
  443. <p>It is possible to validate documents which had not been validated at
  444. initial parsing time or documents which have been built from scratch
  445. using the API. Use the <a
  446. href="http://xmlsoft.org/html/libxml-valid.html#xmlValidateDtd">xmlValidateDtd()</a>
  447. function. It is also possible to simply add a DTD to an existing
  448. document:</p>
  449. <pre>xmlDocPtr doc; /* your existing document */
  450. xmlDtdPtr dtd = xmlParseDTD(NULL, filename_of_dtd); /* parse the DTD */
  451. dtd-&gt;name = xmlStrDup((xmlChar*)"root_name"); /* use the given root */
  452. doc-&gt;intSubset = dtd;
  453. if (doc-&gt;children == NULL) xmlAddChild((xmlNodePtr)doc, (xmlNodePtr)dtd);
  454. else xmlAddPrevSibling(doc-&gt;children, (xmlNodePtr)dtd);
  455. </pre>
  456. </li>
  457. <li><em>So what is this funky "xmlChar" used all the time?</em>
  458. <p>It is a null terminated sequence of utf-8 characters. And only utf-8!
  459. You need to convert strings encoded in different ways to utf-8 before
  460. passing them to the API. This can be accomplished with the iconv library
  461. for instance.</p>
  462. </li>
  463. <li>etc ...</li>
  464. </ol>
  465. <p></p>
  466. <h2><a name="Documentat">Developer Menu</a></h2>
  467. <p>There are several on-line resources related to using libxml:</p>
  468. <ol>
  469. <li>Use the <a href="search.php">search engine</a> to look up
  470. information.</li>
  471. <li>Check the <a href="FAQ.html">FAQ.</a></li>
  472. <li>Check the <a href="http://xmlsoft.org/html/libxml-lib.html">extensive
  473. documentation</a> automatically extracted from code comments.</li>
  474. <li>Look at the documentation about <a href="encoding.html">libxml
  475. internationalization support</a>.</li>
  476. <li>This page provides a global overview and <a href="example.html">some
  477. examples</a> on how to use libxml.</li>
  478. <li><a href="examples/index.html">Code examples</a></li>
  479. <li>John Fleck's libxml2 tutorial: <a href="tutorial/index.html">html</a>
  480. or <a href="tutorial/xmltutorial.pdf">pdf</a>.</li>
  481. <li>If you need to parse large files, check the <a
  482. href="xmlreader.html">xmlReader</a> API tutorial</li>
  483. <li><a href="mailto:james@daa.com.au">James Henstridge</a> wrote <a
  484. href="http://www.daa.com.au/~james/gnome/xml-sax/xml-sax.html">some nice
  485. documentation</a> explaining how to use the libxml SAX interface.</li>
  486. <li>George Lebl wrote <a
  487. href="http://www-106.ibm.com/developerworks/library/l-gnome3/">an article
  488. for IBM developerWorks</a> about using libxml.</li>
  489. <li>Check <a href="http://svn.gnome.org/viewvc/libxml2/trunk/TODO?view=markup">the TODO
  490. file</a>.</li>
  491. <li>Read the <a href="upgrade.html">1.x to 2.x upgrade path</a>
  492. description. If you are starting a new project using libxml you should
  493. really use the 2.x version.</li>
  494. <li>And don't forget to look at the <a
  495. href="http://mail.gnome.org/archives/xml/">mailing-list archive</a>.</li>
  496. </ol>
  497. <h2><a name="Reporting">Reporting bugs and getting help</a></h2>
  498. <p>Well, bugs or missing features are always possible, and I will make a
  499. point of fixing them in a timely fashion. The best way to report a bug is to
  500. use the <a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Gnome
  501. bug tracking database</a> (make sure to use the "libxml2" module name). I
  502. look at reports there regularly and it's good to have a reminder when a bug
  503. is still open. Be sure to specify that the bug is for the package libxml2.</p>
  504. <p>For small problems you can try to get help on IRC, the #xml channel on
  505. irc.gnome.org (port 6667) usually have a few person subscribed which may help
  506. (but there is no guarantee and if a real issue is raised it should go on the
  507. mailing-list for archival).</p>
  508. <p>There is also a mailing-list <a
  509. href="mailto:xml@gnome.org">xml@gnome.org</a> for libxml, with an <a
  510. href="http://mail.gnome.org/archives/xml/">on-line archive</a> (<a
  511. href="http://xmlsoft.org/messages">old</a>). To subscribe to this list,
  512. please visit the <a
  513. href="http://mail.gnome.org/mailman/listinfo/xml">associated Web</a> page and
  514. follow the instructions. <strong>Do not send code, I won't debug it</strong>
  515. (but patches are really appreciated!).</p>
  516. <p>Please note that with the current amount of virus and SPAM, sending mail
  517. to the list without being subscribed won't work. There is *far too many
  518. bounces* (in the order of a thousand a day !) I cannot approve them manually
  519. anymore. If your mail to the list bounced waiting for administrator approval,
  520. it is LOST ! Repost it and fix the problem triggering the error. Also please
  521. note that <span style="color: #FF0000; background-color: #FFFFFF">emails with
  522. a legal warning asking to not copy or redistribute freely the information
  523. they contain</span> are <strong>NOT</strong> acceptable for the mailing-list,
  524. such mail will as much as possible be discarded automatically, and are less
  525. likely to be answered if they made it to the list, <strong>DO NOT</strong>
  526. post to the list from an email address where such legal requirements are
  527. automatically added, get private paying support if you can't share
  528. information.</p>
  529. <p>Check the following <strong><span style="color: #FF0000">before
  530. posting</span></strong>:</p>
  531. <ul>
  532. <li>Read the <a href="FAQ.html">FAQ</a> and <a href="search.php">use the
  533. search engine</a> to get information related to your problem.</li>
  534. <li>Make sure you are <a href="ftp://xmlsoft.org/libxml2/">using a recent
  535. version</a>, and that the problem still shows up in a recent version.</li>
  536. <li>Check the <a href="http://mail.gnome.org/archives/xml/">list
  537. archives</a> to see if the problem was reported already. In this case
  538. there is probably a fix available, similarly check the <a
  539. href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">registered
  540. open bugs</a>.</li>
  541. <li>Make sure you can reproduce the bug with xmllint or one of the test
  542. programs found in source in the distribution.</li>
  543. <li>Please send the command showing the error as well as the input (as an
  544. attachment)</li>
  545. </ul>
  546. <p>Then send the bug with associated information to reproduce it to the <a
  547. href="mailto:xml@gnome.org">xml@gnome.org</a> list; if it's really libxml
  548. related I will approve it. Please do not send mail to me directly, it makes
  549. things really hard to track and in some cases I am not the best person to
  550. answer a given question, ask on the list.</p>
  551. <p>To <span style="color: #E50000">be really clear about support</span>:</p>
  552. <ul>
  553. <li>Support or help <span style="color: #E50000">requests MUST be sent to
  554. the list or on bugzilla</span> in case of problems, so that the Question
  555. and Answers can be shared publicly. Failing to do so carries the implicit
  556. message "I want free support but I don't want to share the benefits with
  557. others" and is not welcome. I will automatically Carbon-Copy the
  558. xml@gnome.org mailing list for any technical reply made about libxml2 or
  559. libxslt.</li>
  560. <li>There is <span style="color: #E50000">no guarantee of support</span>. If
  561. your question remains unanswered after a week, repost it, making sure you
  562. gave all the detail needed and the information requested.</li>
  563. <li>Failing to provide information as requested or double checking first
  564. for prior feedback also carries the implicit message "the time of the
  565. library maintainers is less valuable than my time" and might not be
  566. welcome.</li>
  567. </ul>
  568. <p>Of course, bugs reported with a suggested patch for fixing them will
  569. probably be processed faster than those without.</p>
  570. <p>If you're looking for help, a quick look at <a
  571. href="http://mail.gnome.org/archives/xml/">the list archive</a> may actually
  572. provide the answer. I usually send source samples when answering libxml2
  573. usage questions. The <a
  574. href="http://xmlsoft.org/html/book1.html">auto-generated documentation</a> is
  575. not as polished as I would like (i need to learn more about DocBook), but
  576. it's a good starting point.</p>
  577. <h2><a name="help">How to help</a></h2>
  578. <p>You can help the project in various ways, the best thing to do first is to
  579. subscribe to the mailing-list as explained before, check the <a
  580. href="http://mail.gnome.org/archives/xml/">archives </a>and the <a
  581. href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Gnome bug
  582. database</a>:</p>
  583. <ol>
  584. <li>Provide patches when you find problems.</li>
  585. <li>Provide the diffs when you port libxml2 to a new platform. They may not
  586. be integrated in all cases but help pinpointing portability problems
  587. and</li>
  588. <li>Provide documentation fixes (either as patches to the code comments or
  589. as HTML diffs).</li>
  590. <li>Provide new documentations pieces (translations, examples, etc
  591. ...).</li>
  592. <li>Check the TODO file and try to close one of the items.</li>
  593. <li>Take one of the points raised in the archive or the bug database and
  594. provide a fix. <a href="mailto:daniel@veillard.com">Get in touch with me
  595. </a>before to avoid synchronization problems and check that the suggested
  596. fix will fit in nicely :-)</li>
  597. </ol>
  598. <h2><a name="Downloads">Downloads</a></h2>
  599. <p>The latest versions of libxml2 can be found on the <a
  600. href="ftp://xmlsoft.org/libxml2/">xmlsoft.org</a> server ( <a
  601. href="ftp://xmlsoft.org/libxml2/">FTP</a> and rsync are available), there are also
  602. mirrors (<a href="ftp://fr.rpmfind.net/pub/libxml/">France</a> and
  603. Antonin Sprinzl also provide <a href="ftp://gd.tuwien.ac.at/pub/libxml/">a
  604. mirror in Austria</a>). (NOTE that you need both the <a
  605. href="http://rpmfind.net/linux/RPM/libxml2.html">libxml(2)</a> and <a
  606. href="http://rpmfind.net/linux/RPM/libxml2-devel.html">libxml(2)-devel</a>
  607. packages installed to compile applications using libxml if using RPMs.)</p>
  608. <p>You can find all the history of libxml(2) and libxslt releases in the <a
  609. href="http://xmlsoft.org/sources/old/">old</a> directory. The precompiled
  610. Windows binaries made by Igor Zlatovic are available in the <a
  611. href="http://xmlsoft.org/sources/win32/">win32</a> directory.</p>
  612. <p>Binary ports:</p>
  613. <ul>
  614. <li>RPMs for x86_64 are available directly on <a
  615. href="ftp://xmlsoft.org/libxml2/">xmlsoft.org</a>, the source RPM will compile on
  616. any architecture supported.</li>
  617. <li><a href="mailto:igor@zlatkovic.com">Igor Zlatkovic</a> is now the
  618. maintainer of the Windows port, <a
  619. href="http://www.zlatkovic.com/projects/libxml/index.html">he provides
  620. binaries</a>.</li>
  621. <li>OpenCSW provides <a
  622. href="http://opencsw.org/packages/libxml2">Solaris
  623. binaries</a>.</li>
  624. <li><a href="mailto:Steve.Ball@explain.com.au">Steve Ball</a> provides <a
  625. href="http://www.explain.com.au/oss/libxml2xslt.html">Mac Os X
  626. binaries</a>.</li>
  627. <li>The HP-UX porting center provides <a
  628. href="http://hpux.connect.org.uk/hppd/hpux/Gnome/">HP-UX binaries</a></li>
  629. <li>Bull provides precompiled <a
  630. href="http://gnome.bullfreeware.com/new_index.html">RPMs for AIX</a> as
  631. patr of their GNOME packages</li>
  632. </ul>
  633. <p>If you know other supported binary ports, please <a
  634. href="http://veillard.com/">contact me</a>.</p>
  635. <p><a name="Snapshot">Snapshot:</a></p>
  636. <ul>
  637. <li>Code from the GNOME GIT base libxml2 module, updated hourly <a
  638. href="ftp://xmlsoft.org/libxml2/libxml2-git-snapshot.tar.gz">libxml2-git-snapshot.tar.gz</a>.</li>
  639. <li>Docs, content of the web site, the list archive included <a
  640. href="ftp://xmlsoft.org/libxml2/libxml-docs.tar.gz">libxml-docs.tar.gz</a>.</li>
  641. </ul>
  642. <p><a name="Contribs">Contributions:</a></p>
  643. <p>I do accept external contributions, especially if compiling on another
  644. platform, get in touch with the list to upload the package, wrappers for
  645. various languages have been provided, and can be found in the <a
  646. href="python.html">bindings section</a></p>
  647. <p>Libxml2 is also available from GIT:</p>
  648. <ul>
  649. <li><p>See <a href="http://git.gnome.org/cgit/libxml2/">libxml2 Git web</a>.
  650. To checkout a local tree use:</p>
  651. <pre>git clone git://git.gnome.org/libxml2</pre>
  652. </li>
  653. <li>The <strong>libxslt</strong> module is also present there</li>
  654. </ul>
  655. <h2><a name="News">Releases</a></h2>
  656. <p>Items not finished and worked on, get in touch with the list if you want
  657. to help those</p>
  658. <ul>
  659. <li>More testing on RelaxNG</li>
  660. <li>Finishing up <a href="http://www.w3.org/TR/xmlschema-1/">XML
  661. Schemas</a></li>
  662. </ul>
  663. <p>The <a href="ChangeLog.html">change log</a> describes the recents commits
  664. to the <a href="http://svn.gnome.org/viewvc/libxml2/trunk/">SVN</a> code base.</p>
  665. <p>Here is the list of public releases:</p>
  666. <h3>2.7.6: Oct 6 2009</h3>
  667. <ul>
  668. <li> Bug Fixes:
  669. Restore thread support in default configuration (Andrew W. Nosenko),
  670. URI with no path parsing problem (Daniel Veillard),
  671. Minor patch for conditional defines in threads.c (Eric Zurcher)
  672. </li>
  673. </ul>
  674. <h3>2.7.5: Sep 24 2009</h3>
  675. <ul>
  676. <li> Bug Fixes:
  677. Restore behavior of --with-threads without argument (Andrew W. Nosenko),
  678. Fix memory leak when doc is NULL (Rob Richards),
  679. 595792 fixing a RelaxNG bug introduced in 2.7.4 (Daniel Veillard),
  680. Fix a Relaxng bug raised by libvirt test suite (Daniel Veillard),
  681. Fix a parsing problem with little data at startup (Daniel Veillard),
  682. link python module with python library (Frederic Crozat),
  683. 594874 Forgot an fclose in xmllint (Daniel Veillard)
  684. </li>
  685. <li> Cleanup:
  686. Adding symbols.xml to EXTRA_DIST (Daniel Veillard)
  687. </li>
  688. </ul>
  689. <h3>2.7.4: Sep 10 2009</h3>
  690. <ul>
  691. <li>Improvements:
  692. Switch to GIT (GNOME),
  693. Add symbol versioning to libxml2 shared libs (Daniel Veillard)
  694. </li>
  695. <li>Portability:
  696. 593857 try to work around thread pbm MinGW 4.4 (Daniel Veillard),
  697. 594250 rename ATTRIBUTE_ALLOC_SIZE to avoid clashes (Daniel Veillard),
  698. Fix Windows build * relaxng.c: fix windows build (Rob Richards),
  699. Fix the globals.h to use XMLPUBFUN (Paul Smith),
  700. Problem with extern extern in header (Daniel Veillard),
  701. Add -lnetwork for compiling on Haiku (Scott McCreary),
  702. Runtest portability patch for Solaris (Tim Rice),
  703. Small patch to accomodate the Haiku OS (Scott McCreary),
  704. 584605 package VxWorks folder in the distribution (Daniel Veillard),
  705. 574017 Realloc too expensive on most platform (Daniel Veillard),
  706. Fix windows build (Rob Richards),
  707. 545579 doesn't compile without schema support (Daniel Veillard),
  708. xmllint use xmlGetNodePath when not compiled in (Daniel Veillard),
  709. Try to avoid __imp__xmlFree link trouble on msys (Daniel Veillard),
  710. Allow to select the threading system on Windows (LRN),
  711. Fix Solaris binary links, cleanups (Daniel Veillard),
  712. Bug 571059 – MSVC doesn't work with the bakefile (Intron),
  713. fix ATTRIBUTE_PRINTF header clash (Belgabor and Mike Hommey),
  714. fixes for Borland/CodeGear/Embarcadero compilers (Eric Zurcher)
  715. </li>
  716. <li>Documentation:
  717. 544910 typo: "renciliateNs" (Leonid Evdokimov),
  718. Add VxWorks to list of OSes (Daniel Veillard),
  719. Regenerate the documentation and update for git (Daniel Veillard),
  720. 560524 ¿ xmlTextReaderLocalName description (Daniel Veillard),
  721. Added sponsoring by AOE media for the server (Daniel Veillard),
  722. updated URLs for GNOME (Vincent Lefevre),
  723. more warnings about xmlCleanupThreads and xmlCleanupParser (Daniel Veillard)
  724. </li>
  725. <li>Bug fixes:
  726. 594514 memory leaks - duplicate initialization (MOD),
  727. Wrong block opening in htmlNodeDumpOutputInternal (Daniel Veillard),
  728. 492317 Fix Relax-NG validation problems (Daniel Veillard),
  729. 558452 fight with reg test and error report (Daniel Veillard),
  730. 558452 RNG compilation of optional multiple child (Daniel Veillard),
  731. 579746 XSD validation not correct / nilable groups (Daniel Veillard),
  732. 502960 provide namespace stack when parsing entity (Daniel Veillard),
  733. 566012 part 2 fix regresion tests and push mode (Daniel Veillard),
  734. 566012 autodetected encoding and encoding conflict (Daniel Veillard),
  735. 584220 xpointer(/) and xinclude problems (Daniel Veillard),
  736. 587663 Incorrect Attribute-Value Normalization (Daniel Veillard),
  737. 444994 HTML chunked failure for attribute with &lt;&gt; (Daniel Veillard),
  738. Fix end of buffer char being split in XML parser (Daniel Veillard),
  739. Non ASCII character may be split at buffer end (Adiel Mittmann),
  740. 440226 Add xmlXIncludeProcessTreeFlagsData API (Stefan Behnel),
  741. 572129 speed up parsing of large HTML text nodes (Markus Kull),
  742. Fix HTML parsing with 0 character in CDATA (Daniel Veillard),
  743. Fix SetGenericErrorFunc and SetStructured clash (Wang Lam),
  744. 566012 Incomplete EBCDIC parsing support (Martin Kogler),
  745. 541335 HTML avoid creating 2 head or 2 body element (Daniel Veillard),
  746. 541237 error correcting missing end tags in HTML (Daniel Veillard),
  747. 583439 missing line numbers in push mode (Daniel Veillard),
  748. 587867 xmllint --html --xmlout serializing as HTML (Daniel Veillard),
  749. 559501 avoid select and use poll for nanohttp (Raphael Prevost),
  750. 559410 - Regexp bug on (...)? constructs (Daniel Veillard),
  751. Fix a small problem on previous HTML parser patch (Daniel Veillard),
  752. 592430 - HTML parser runs into endless loop (Daniel Veillard),
  753. 447899 potential double free in xmlFreeTextReader (Daniel Veillard),
  754. 446613 small validation bug mixed content with NS (Daniel Veillard),
  755. Fix the problem of revalidating a doc with RNG (Daniel Veillard),
  756. Fix xmlKeepBlanksDefault to not break indent (Nick Wellnhofer),
  757. 512131 refs from externalRef part need to be added (Daniel Veillard),
  758. 512131 crash in xmlRelaxNGValidateFullElement (Daniel Veillard),
  759. 588441 allow '.' in HTML Names even if invalid (Daniel Veillard),
  760. 582913 Fix htmlSetMetaEncoding() to be nicer (Daniel Veillard),
  761. 579317 Try to find the HTML encoding information (Daniel Veillard),
  762. 575875 don't output charset=html (Daniel Veillard),
  763. 571271 fix semantic of xsd:all with minOccurs=0 (Daniel Veillard),
  764. 570702 fix a bug in regexp determinism checking (Daniel Veillard),
  765. 567619 xmlValidateNotationUse missing param test (Daniel Veillard),
  766. 574393 ¿ utf-8 filename magic for compressed files (Hans Breuer),
  767. Fix a couple of problems in the parser (Daniel Veillard),
  768. 585505 ¿ Document ids and refs populated by XSD (Wayne Jensen),
  769. 582906 XSD validating multiple imports of the same schema (Jason Childs),
  770. Bug 582887 ¿ problems validating complex schemas (Jason Childs),
  771. Bug 579729 ¿ fix XSD schemas parsing crash (Miroslav Bajtos),
  772. 576368 ¿ htmlChunkParser with special attributes (Jiri Netolicky),
  773. Bug 565747 ¿ relax anyURI data character checking (Vincent Lefevre),
  774. Preserve attributes of include start on tree copy (Petr Pajas),
  775. Skip silently unrecognized XPointer schemes (Jakub Wilk),
  776. Fix leak on SAX1, xmllint --sax1 option and debug (Daniel Veillard),
  777. potential NULL dereference on non-glibc (Jim Meyering),
  778. Fix an XSD validation crash (Daniel Veillard),
  779. Fix a regression in streaming entities support (Daniel Veillard),
  780. Fix a couple of ABI issues with C14N 1.1 (Aleksey Sanin),
  781. Aleksey Sanin support for c14n 1.1 (Aleksey Sanin),
  782. reader bug fix with entities (Daniel Veillard),
  783. use options from current parser ctxt for external entities (Rob Richards),
  784. 581612 use %s to printf strings (Christian Persch),
  785. 584605 change the threading initialization sequence (Igor Novoseltsev),
  786. 580705 keep line numbers in HTML parser (Aaron Patterson),
  787. 581803 broken HTML table attributes init (Roland Steiner),
  788. do not set error code in xmlNsWarn (Rob Richards),
  789. 564217 fix structured error handling problems,
  790. reuse options from current parser for entities (Rob Richards),
  791. xmlXPathRegisterNs should not allow enpty prefixes (Daniel Veillard),
  792. add a missing check in xmlAddSibling (Kris Breuker),
  793. avoid leaks on errors (Jinmei Tatuya)
  794. </li>
  795. <li>Cleanup:
  796. Chasing dead assignments reported by clang-scan (Daniel Veillard),
  797. A few more safety cleanup raised by scan (Daniel Veillard),
  798. Fixing assorted potential problems raised by scan (Daniel Veillard),
  799. Potential uninitialized arguments raised by scan (Daniel Veillard),
  800. Fix a bunch of scan 'dead increments' and cleanup (Daniel Veillard),
  801. Remove a pedantic warning (Daniel Veillard),
  802. 555833 always use rm -f in uninstall-local (Daniel Veillard),
  803. 542394 xmlRegisterOutputCallbacks MAX_INPUT_CALLBACK (Daniel Veillard),
  804. Autoregenerate libxml2.syms automated checkings (Daniel Veillard),
  805. Make xmlRecoverDoc const (Martin Trappel) (Daniel Veillard),
  806. Both args of xmlStrcasestr are const (Daniel Veillard),
  807. hide the nbParse* variables used for debugging (Mike Hommey),
  808. 570806 changed include of config.h (William M. Brack),
  809. cleanups and error reports when xmlTextWriterVSprintf fails (Jinmei Tatuya)
  810. </li>
  811. </ul>
  812. <h3>2.7.3: Jan 18 2009</h3>
  813. <ul>
  814. <li>Build fix: fix build when HTML support is not included.</li>
  815. <li>Bug fixes: avoid memory overflow in gigantic text nodes,
  816. indentation problem on the writed (Rob Richards),
  817. xmlAddChildList pointer problem (Rob Richards and Kevin Milburn),
  818. xmlAddChild problem with attribute (Rob Richards and Kris Breuker),
  819. avoid a memory leak in an edge case (Daniel Zimmermann),
  820. deallocate some pthread data (Alex Ott).</li>
  821. <li>Improvements: configure option to avoid rebuilding docs (Adrian Bunk),
  822. limit text nodes to 10MB max by default, add element traversal
  823. APIs, add a parser option to enable pre 2.7 SAX behavior (Rob Richards),
  824. add gcc malloc checking (Marcus Meissner), add gcc printf like functions
  825. parameters checking (Marcus Meissner).</li>
  826. </ul>
  827. <h3>2.7.2: Oct 3 2008</h3>
  828. <ul>
  829. <li>Portability fix: fix solaris compilation problem, fix compilation
  830. if XPath is not configured in</li>
  831. <li>Bug fixes: nasty entity bug introduced in 2.7.0, restore old behaviour
  832. when saving an HTML doc with an xml dump function, HTML UTF-8 parsing
  833. bug, fix reader custom error handlers (Riccardo Scussat)
  834. <li>Improvement: xmlSave options for more flexibility to save as
  835. XML/HTML/XHTML, handle leading BOM in HTML documents</li>
  836. </ul>
  837. <h3>2.7.1: Sep 1 2008</h3>
  838. <ul>
  839. <li>Portability fix: Borland C fix (Moritz Both)</li>
  840. <li>Bug fixes: python serialization wrappers, XPath QName corner
  841. case handking and leaks (Martin)</li>
  842. <li>Improvement: extend the xmlSave to handle HTML documents and trees</li>
  843. <li>Cleanup: python serialization wrappers</li>
  844. </ul>
  845. <h3>2.7.0: Aug 30 2008</h3>
  846. <ul>
  847. <li>Documentation: switch ChangeLog to UTF-8, improve mutithreads and
  848. xmlParserCleanup docs</li>
  849. <li>Portability fixes: Older Win32 platforms (Rob Richards), MSVC
  850. porting fix (Rob Richards), Mac OS X regression tests (Sven Herzberg),
  851. non GNUCC builds (Rob Richards), compilation on Haiku (Andreas Färber)
  852. </li>
  853. <li>Bug fixes: various realloc problems (Ashwin), potential double-free
  854. (Ashwin), regexp crash, icrash with invalid whitespace facets (Rob
  855. Richards), pattern fix when streaming (William Brack), various XML
  856. parsing and validation fixes based on the W3C regression tests, reader
  857. tree skipping function fix (Ashwin), Schemas regexps escaping fix
  858. (Volker Grabsch), handling of entity push errors (Ashwin), fix a slowdown
  859. when encoder cant serialize characters on output</li>
  860. <li>Code cleanup: compilation fix without the reader, without the output
  861. (Robert Schwebel), python whitespace (Martin), many space/tabs cleanups,
  862. serious cleanup of the entity handling code</li>
  863. <li>Improvement: switch parser to XML-1.0 5th edition, add parsing flags
  864. for old versions, switch URI parsing to RFC 3986,
  865. add xmlSchemaValidCtxtGetParserCtxt (Holger Kaelberer),
  866. new hashing functions for dictionnaries (based on Stefan Behnel work),
  867. improve handling of misplaced html/head/body in HTML parser, better
  868. regression test tools and code coverage display, better algorithms
  869. to detect various versions of the billion laughts attacks, make
  870. arbitrary parser limits avoidable as a parser option</li>
  871. </ul>
  872. <h3>2.6.32: Apr 8 2008</h3>
  873. <ul>
  874. <li>Documentation: returning heap memory to kernel (Wolfram Sang),
  875. trying to clarify xmlCleanupParser() use, xmlXPathContext improvement
  876. (Jack Jansen), improve the *Recover* functions documentation,
  877. XmlNodeType doc link fix (Martijn Arts)</li>
  878. <li>Bug fixes: internal subset memory leak (Ashwin), avoid problem with
  879. paths starting with // (Petr Sumbera), streaming XSD validation callback
  880. patches (Ashwin), fix redirection on port other than 80 (William Brack),
  881. SAX2 leak (Ashwin), XInclude fragment of own document (Chris Ryan),
  882. regexp bug with '.' (Andrew Tosh), flush the writer at the end of the
  883. document (Alfred Mickautsch), output I/O bug fix (William Brack),
  884. writer CDATA output after a text node (Alex Khesin), UTF-16 encoding
  885. detection (William Brack), fix handling of empty CDATA nodes for Safari
  886. team, python binding problem with namespace nodes, improve HTML parsing
  887. (Arnold Hendriks), regexp automata build bug, memory leak fix (Vasily
  888. Chekalkin), XSD test crash, weird system parameter entity parsing problem,
  889. allow save to file:///X:/ windows paths, various attribute normalisation
  890. problems, externalSubsetSplit fix (Ashwin), attribute redefinition in
  891. the DTD (Ashwin), fix in char ref parsing check (Alex Khesin), many
  892. out of memory handling fixes (Ashwin), XPath out of memory handling fixes
  893. (Alvaro Herrera), various realloc problems (Ashwin), UCS4 encoding
  894. conversion buffer size (Christian Fruth), problems with EatName
  895. functions on memory errors, BOM handling in external parsed entities
  896. (Mark Rowe)</li>
  897. <li>Code cleanup: fix build under VS 2008 (David Wimsey), remove useless
  898. mutex in xmlDict (Florent Guilian), Mingw32 compilation fix (Carlo
  899. Bramini), Win and MacOS EOL cleanups (Florent Guiliani), iconv need
  900. a const detection (Roumen Petrov), simplify xmlSetProp (Julien Charbon),
  901. cross compilation fixes for Mingw (Roumen Petrov), SCO Openserver build
  902. fix (Florent Guiliani), iconv uses const on Win32 (Rob Richards),
  903. duplicate code removal (Ashwin), missing malloc test and error reports
  904. (Ashwin), VMS makefile fix (Tycho Hilhorst)</li>
  905. <li>improvements: better plug of schematron in the normal error handling
  906. (Tobias Minich)</li>
  907. </ul>
  908. <h3>2.6.31: Jan 11 2008</h3>
  909. <ul>
  910. <li>Security fix: missing of checks in UTF-8 parsing</li>
  911. <li>Bug fixes: regexp bug, dump attribute from XHTML document, fix
  912. xmlFree(NULL) to not crash in debug mode, Schematron parsing crash
  913. (Rob Richards), global lock free on Windows (Marc-Antoine Ruel),
  914. XSD crash due to double free (Rob Richards), indentation fix in
  915. xmlTextWriterFullEndElement (Felipe Pena), error in attribute type
  916. parsing if attribute redeclared, avoid crash in hash list scanner if
  917. deleting elements, column counter bug fix (Christian Schmidt),
  918. HTML embed element saving fix (Stefan Behnel), avoid -L/usr/lib
  919. output from xml2-config (Fred Crozat), avoid an xmllint crash
  920. (Stefan Kost), don't stop HTML parsing on out of range chars.
  921. </li>
  922. <li>Code cleanup: fix open() call third argument, regexp cut'n paste
  923. copy error, unused variable in __xmlGlobalInitMutexLock (Hannes Eder),
  924. some make distcheck realted fixes (John Carr)</li>
  925. <li>Improvements: HTTP Header: includes port number (William Brack),
  926. testURI --debug option, </li>
  927. </ul>
  928. <h3>2.6.30: Aug 23 2007</h3>
  929. <ul>
  930. <li>Portability: Solaris crash on error handling, windows path fixes
  931. (Roland Schwarz and Rob Richards), mingw build (Roland Schwarz)</li>
  932. <li>Bugfixes: xmlXPathNodeSetSort problem (William Brack), leak when
  933. reusing a writer for a new document (Dodji Seketeli), Schemas
  934. xsi:nil handling patch (Frank Gross), relative URI build problem
  935. (Patrik Fimml), crash in xmlDocFormatDump, invalid char in comment
  936. detection bug, fix disparity with xmlSAXUserParseMemory, automata
  937. generation for complex regexp counts problems, Schemas IDC import
  938. problems (Frank Gross), xpath predicate evailation error handling
  939. (William Brack)</li>
  940. </ul>
  941. <h3>2.6.29: Jun 12 2007</h3>
  942. <ul>
  943. <li>Portability: patches from Andreas Stricke for WinCEi,
  944. fix compilation warnings (William Brack), avoid warnings on Apple OS/X
  945. (Wendy Doyle and Mark Rowe), Windows compilation and threading
  946. improvements (Rob Richards), compilation against old Python versions,
  947. new GNU tar changes (Ryan Hill)</li>
  948. <li>Documentation: xmlURIUnescapeString comment, </li>
  949. <li>Bugfixes: xmlBufferAdd problem (Richard Jones), 'make valgrind'
  950. flag fix (Richard Jones), regexp interpretation of \,
  951. htmlCreateDocParserCtxt (Jean-Daniel Dupas), configure.in
  952. typo (Bjorn Reese), entity content failure, xmlListAppend() fix
  953. (Georges-André Silber), XPath number serialization (William Brack),
  954. nanohttp gzipped stream fix (William Brack and Alex Cornejo),
  955. xmlCharEncFirstLine typo (Mark Rowe), uri bug (François Delyon),
  956. XPath string value of PI nodes (William Brack), XPath node set
  957. sorting bugs (William Brack), avoid outputting namespace decl
  958. dups in the writer (Rob Richards), xmlCtxtReset bug, UTF-8 encoding
  959. error handling, recustion on next in catalogs, fix a Relax-NG crash,
  960. workaround wrong file: URIs, htmlNodeDumpFormatOutput on attributes,
  961. invalid character in attribute detection bug, big comments before
  962. internal subset streaming bug, HTML parsing of attributes with : in
  963. the name, IDness of name in HTML (Dagfinn I. Mannsåker) </li>
  964. <li>Improvement: keep URI query parts in raw form (Richard Jones),
  965. embed tag support in HTML (Michael Day) </li>
  966. </ul>
  967. <h3>2.6.28: Apr 17 2007</h3>
  968. <ul>
  969. <li>Documentation: comment fixes (Markus Keim), xpath comments fixes too
  970. (James Dennett)</li>
  971. <li>Bug fixes: XPath bug (William Brack), HTML parser autoclose stack usage
  972. (Usamah Malik), various regexp bug fixes (DV and William), path conversion
  973. on Windows (Igor Zlatkovic), htmlCtxtReset fix (Michael Day), XPath
  974. principal node of axis bug, HTML serialization of some codepoint
  975. (Steven Rainwater), user data propagation in XInclude (Michael Day),
  976. standalone and XML decl detection (Michael Day), Python id ouptut
  977. for some id, fix the big python string memory leak, URI parsing fixes
  978. (Stéphane Bidoul and William), long comments parsing bug (William),
  979. concurrent threads initialization (Ted Phelps), invalid char
  980. in text XInclude (William), XPath memory leak (William), tab in
  981. python problems (Andreas Hanke), XPath node comparison error
  982. (Oleg Paraschenko), cleanup patch for reader (Julien Reichel),
  983. XML Schemas attribute group (William), HTML parsing problem (William),
  984. fix char 0x2d in regexps (William), regexp quantifier range with
  985. min occurs of 0 (William), HTML script/style parsing (Mike Day)</li>
  986. <li>Improvement: make xmlTextReaderSetup() public</li>
  987. <li>Compilation and postability: fix a missing include problem (William),
  988. __ss_familly on AIX again (Björn Wiberg), compilation without zlib
  989. (Michael Day), catalog patch for Win32 (Christian Ehrlicher),
  990. Windows CE fixes (Andreas Stricke)</li>
  991. <li>Various CVS to SVN infrastructure changes</li>
  992. </ul>
  993. <h3>2.6.27: Oct 25 2006</h3>
  994. <ul>
  995. <li>Portability fixes: file names on windows (Roland Schwingel,
  996. Emelyanov Alexey), windows compile fixup (Rob Richards),
  997. AIX iconv() is apparently case sensitive</li>
  998. <li>improvements: Python XPath types mapping (Nic Ferrier), XPath optimization
  999. (Kasimier), add xmlXPathCompiledEvalToBoolean (Kasimier), Python node
  1000. equality and comparison (Andreas Pakulat), xmlXPathCollectAndTest
  1001. improvememt (Kasimier), expose if library was compiled with zlib
  1002. support (Andrew Nosenko), cache for xmlSchemaIDCMatcher structs
  1003. (Kasimier), xmlTextConcat should work with comments and PIs (Rob
  1004. Richards), export htmlNewParserCtxt needed by Michael Day, refactoring
  1005. of catalog entity loaders (Michael Day), add XPointer support to
  1006. python bindings (Ross Reedstrom, Brian West and Stefan Anca),
  1007. try to sort out most file path to URI conversions and xmlPathToUri,
  1008. add --html --memory case to xmllint</li>
  1009. <li>building fix: fix --with-minimum (Felipe Contreras), VMS fix,
  1010. const'ification of HTML parser structures (Matthias Clasen),
  1011. portability fix (Emelyanov Alexey), wget autodetection (Peter
  1012. Breitenlohner), remove the build path recorded in the python
  1013. shared module, separate library flags for shared and static builds
  1014. (Mikhail Zabaluev), fix --with-minimum --with-sax1 builds, fix
  1015. --with-minimum --with-schemas builds</li>
  1016. <li>bug fix: xmlGetNodePath fix (Kasimier), xmlDOMWrapAdoptNode and
  1017. attribute (Kasimier), crash when using the recover mode,
  1018. xmlXPathEvalExpr problem (Kasimier), xmlXPathCompExprAdd bug (Kasimier),
  1019. missing destry in xmlFreeRMutex (Andrew Nosenko), XML Schemas fixes
  1020. (Kasimier), warning on entities processing, XHTML script and style
  1021. serialization (Kasimier), python generator for long types, bug in
  1022. xmlSchemaClearValidCtxt (Bertrand Fritsch), xmlSchemaXPathEvaluate
  1023. allocation bug (Marton Illes), error message end of line (Rob Richards),
  1024. fix attribute serialization in writer (Rob Richards), PHP4 DTD validation
  1025. crasher, parser safety patch (Ben Darnell), _private context propagation
  1026. when parsing entities (with Michael Day), fix entities behaviour when
  1027. using SAX, URI to file path fix (Mikhail Zabaluev), disapearing validity
  1028. context, arg error in SAX callback (Mike Hommey), fix mixed-content
  1029. autodetect when using --noblanks, fix xmlIOParseDTD error handling,
  1030. fix bug in xmlSplitQName on special Names, fix Relax-NG element content
  1031. validation bug, fix xmlReconciliateNs bug, fix potential attribute
  1032. XML parsing bug, fix line/column accounting in XML parser, chunking bug
  1033. in the HTML parser on script, try to detect obviously buggy HTML
  1034. meta encoding indications, bugs with encoding BOM and xmlSaveDoc,
  1035. HTML entities in attributes parsing, HTML minimized attribute values,
  1036. htmlReadDoc and htmlReadIO were broken, error handling bug in
  1037. xmlXPathEvalExpression (Olaf Walkowiak), fix a problem in
  1038. htmlCtxtUseOptions, xmlNewInputFromFile could leak (Marius Konitzer),
  1039. bug on misformed SSD regexps (Christopher Boumenot)
  1040. </li>
  1041. <li>documentation: warning about XML_PARSE_COMPACT (Kasimier Buchcik),
  1042. fix xmlXPathCastToString documentation, improve man pages for
  1043. xmllitn and xmlcatalog (Daniel Leidert), fixed comments of a few
  1044. functions</li>
  1045. </ul>
  1046. <h3>2.6.26: Jun 6 2006</h3>
  1047. <ul>
  1048. <li>portability fixes: Python detection (Joseph Sacco), compilation
  1049. error(William Brack and Graham Bennett), LynxOS patch (Olli Savia)</li>
  1050. <li>bug fixes: encoding buffer problem, mix of code and data in
  1051. xmlIO.c(Kjartan Maraas), entities in XSD validation (Kasimier Buchcik),
  1052. variousXSD validation fixes (Kasimier), memory leak in pattern (Rob
  1053. Richards andKasimier), attribute with colon in name (Rob Richards), XPath
  1054. leak inerror reporting (Aleksey Sanin), XInclude text include of
  1055. selfdocument.</li>
  1056. <li>improvements: Xpath optimizations (Kasimier), XPath object
  1057. cache(Kasimier)</li>
  1058. </ul>
  1059. <h3>2.6.25: Jun 6 2006:</h3>
  1060. <p>Do not use or package 2.6.25</p>
  1061. <h3>2.6.24: Apr 28 2006</h3>
  1062. <ul>
  1063. <li>Portability fixes: configure on Windows, testapi compile on windows
  1064. (Kasimier Buchcik, venkat naidu), Borland C++ 6 compile (Eric Zurcher),
  1065. HP-UX compiler workaround (Rick Jones), xml2-config bugfix, gcc-4.1
  1066. cleanups, Python detection scheme (Joseph Sacco), UTF-8 file paths on
  1067. Windows (Roland Schwingel).
  1068. </li>
  1069. <li>Improvements: xmlDOMWrapReconcileNamespaces xmlDOMWrapCloneNode (Kasimier
  1070. Buchcik), XML catalog debugging (Rick Jones), update to Unicode 4.01.</li>
  1071. <li>Bug fixes: xmlParseChunk() problem in 2.6.23, xmlParseInNodeContext()
  1072. on HTML docs, URI behaviour on Windows (Rob Richards), comment streaming
  1073. bug, xmlParseComment (with William Brack), regexp bug fixes (DV &amp;
  1074. Youri Golovanov), xmlGetNodePath on text/CDATA (Kasimier),
  1075. one Relax-NG interleave bug, xmllint --path and --valid,
  1076. XSD bugfixes (Kasimier), remove debug
  1077. left in Python bindings (Nic Ferrier), xmlCatalogAdd bug (Martin Cole),
  1078. xmlSetProp fixes (Rob Richards), HTML IDness (Rob Richards), a large
  1079. number of cleanups and small fixes based on Coverity reports, bug
  1080. in character ranges, Unicode tables const (Aivars Kalvans), schemas
  1081. fix (Stefan Kost), xmlRelaxNGParse error deallocation,
  1082. xmlSchemaAddSchemaDoc error deallocation, error handling on unallowed
  1083. code point, ixmllint --nonet to never reach the net (Gary Coady),
  1084. line break in writer after end PI (Jason Viers). </li>
  1085. <li>Documentation: man pages updates and cleanups (Daniel Leidert).</li>
  1086. <li>New features: Relax NG structure error handlers.</li>
  1087. </ul>
  1088. <h3>2.6.23: Jan 5 2006</h3>
  1089. <ul>
  1090. <li>portability fixes: Windows (Rob Richards), getaddrinfo on Windows
  1091. (Kolja Nowak, Rob Richards), icc warnings (Kjartan Maraas),
  1092. --with-minimum compilation fixes (William Brack), error case handling fix
  1093. on Solaris (Albert Chin), don't use 'list' as parameter name reported by
  1094. Samuel Diaz Garcia, more old Unices portability fixes (Albert Chin),
  1095. MinGW compilation (Mark Junker), HP-UX compiler warnings (Rick
  1096. Jones),</li>
  1097. <li>code cleanup: xmlReportError (Adrian Mouat), remove xmlBufferClose
  1098. (Geert Jansen), unreachable code (Oleksandr Kononenko), refactoring
  1099. parsing code (Bjorn Reese)</li>
  1100. <li>bug fixes: xmlBuildRelativeURI and empty path (William Brack),
  1101. combinatory explosion and performances in regexp code, leak in
  1102. xmlTextReaderReadString(), xmlStringLenDecodeEntities problem (Massimo
  1103. Morara), Identity Constraints bugs and a segfault (Kasimier Buchcik),
  1104. XPath pattern based evaluation bugs (DV &amp; Kasimier),
  1105. xmlSchemaContentModelDump() memory leak (Kasimier), potential leak in
  1106. xmlSchemaCheckCSelectorXPath(), xmlTextWriterVSprintf() misuse of
  1107. vsnprintf (William Brack), XHTML serialization fix (Rob Richards), CRLF
  1108. split problem (William), issues with non-namespaced attributes in
  1109. xmlAddChild() xmlAddNextSibling() and xmlAddPrevSibling() (Rob Richards),
  1110. HTML parsing of script, Python must not output to stdout (Nic Ferrier),
  1111. exclusive C14N namespace visibility (Aleksey Sanin), XSD dataype
  1112. totalDigits bug (Kasimier Buchcik), error handling when writing to an
  1113. xmlBuffer (Rob Richards), runtest schemas error not reported (Hisashi
  1114. Fujinaka), signed/unsigned problem in date/time code (Albert Chin), fix
  1115. XSI driven XSD validation (Kasimier), parsing of xs:decimal (Kasimier),
  1116. fix DTD writer output (Rob Richards), leak in xmlTextReaderReadInnerXml
  1117. (Gary Coady), regexp bug affecting schemas (Kasimier), configuration of
  1118. runtime debugging (Kasimier), xmlNodeBufGetContent bug on entity refs
  1119. (Oleksandr Kononenko), xmlRegExecPushString2 bug (Sreeni Nair),
  1120. compilation and build fixes (Michael Day), removed dependancies on
  1121. xmlSchemaValidError (Kasimier), bug with &lt;xml:foo/&gt;, more XPath
  1122. pattern based evaluation fixes (Kasimier)</li>
  1123. <li>improvements: XSD Schemas redefinitions/restrictions (Kasimier
  1124. Buchcik), node copy checks and fix for attribute (Rob Richards), counted
  1125. transition bug in regexps, ctxt-&gt;standalone = -2 to indicate no
  1126. standalone attribute was found, add xmlSchemaSetParserStructuredErrors()
  1127. (Kasimier Buchcik), add xmlTextReaderSchemaValidateCtxt() to API
  1128. (Kasimier), handle gzipped HTTP resources (Gary Coady), add
  1129. htmlDocDumpMemoryFormat. (Rob Richards),</li>
  1130. <li>documentation: typo (Michael Day), libxml man page (Albert Chin), save
  1131. function to XML buffer (Geert Jansen), small doc fix (Aron Stansvik),</li>
  1132. </ul>
  1133. <h3>2.6.22: Sep 12 2005</h3>
  1134. <ul>
  1135. <li>build fixes: compile without schematron (Stéphane Bidoul)</li>
  1136. <li>bug fixes: xmlDebugDumpNode on namespace node (Oleg Paraschenko)i,
  1137. CDATA push parser bug, xmlElemDump problem with XHTML1 doc,
  1138. XML_FEATURE_xxx clash with expat headers renamed XML_WITH_xxx, fix some
  1139. output formatting for meta element (Rob Richards), script and style
  1140. XHTML1 serialization (David Madore), Attribute derivation fixups in XSD
  1141. (Kasimier Buchcik), better IDC error reports (Kasimier Buchcik)</li>
  1142. <li>improvements: add XML_SAVE_NO_EMPTY xmlSaveOption (Rob Richards), add
  1143. XML_SAVE_NO_XHTML xmlSaveOption, XML Schemas improvements preparing for
  1144. derive (Kasimier Buchcik).</li>
  1145. <li>documentation: generation of gtk-doc like docs, integration with
  1146. devhelp.</li>
  1147. </ul>
  1148. <h3>2.6.21: Sep 4 2005</h3>
  1149. <ul>
  1150. <li>build fixes: Cygwin portability fixes (Gerrit P. Haase), calling
  1151. convention problems on Windows (Marcus Boerger), cleanups based on Linus'
  1152. sparse tool, update of win32/configure.js (Rob Richards), remove warnings
  1153. on Windows(Marcus Boerger), compilation without SAX1, detection of the
  1154. Python binary, use $GCC inestad of $CC = 'gcc' (Andrew W. Nosenko),
  1155. compilation/link with threads and old gcc, compile problem by C370 on
  1156. Z/OS,</li>
  1157. <li>bug fixes: http_proxy environments (Peter Breitenlohner), HTML UTF-8
  1158. bug (Jiri Netolicky), XPath NaN compare bug (William Brack),
  1159. htmlParseScript potential bug, Schemas regexp handling of spaces, Base64
  1160. Schemas comparisons NIST passes, automata build error xsd:all,
  1161. xmlGetNodePath for namespaced attributes (Alexander Pohoyda), xmlSchemas
  1162. foreign namespaces handling, XML Schemas facet comparison (Kupriyanov
  1163. Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier Buchcik), xml:
  1164. namespace ahndling in Schemas (Kasimier), empty model group in Schemas
  1165. (Kasimier), wilcard in Schemas (Kasimier), URI composition (William),
  1166. xs:anyType in Schemas (Kasimier), Python resolver emmitting error
  1167. messages directly, Python xmlAttr.parent (Jakub Piotr Clapa), trying to
  1168. fix the file path/URI conversion, xmlTextReaderGetAttribute fix (Rob
  1169. Richards), xmlSchemaFreeAnnot memleak (Kasimier), HTML UTF-8
  1170. serialization, streaming XPath, Schemas determinism detection problem,
  1171. XInclude bug, Schemas context type (Dean Hill), validation fix (Derek
  1172. Poon), xmlTextReaderGetAttribute[Ns] namespaces (Rob Richards), Schemas
  1173. type fix (Kuba Nowakowski), UTF-8 parser bug, error in encoding handling,
  1174. xmlGetLineNo fixes, bug on entities handling, entity name extraction in
  1175. error handling with XInclude, text nodes in HTML body tags (Gary Coady),
  1176. xml:id and IDness at the treee level fixes, XPath streaming patterns
  1177. bugs.</li>
  1178. <li>improvements: structured interfaces for schemas and RNG error reports
  1179. (Marcus Boerger), optimization of the char data inner loop parsing
  1180. (thanks to Behdad Esfahbod for the idea), schematron validation though
  1181. not finished yet, xmlSaveOption to omit XML declaration, keyref match
  1182. error reports (Kasimier), formal expression handling code not plugged
  1183. yet, more lax mode for the HTML parser, parser XML_PARSE_COMPACT option
  1184. for text nodes allocation.</li>
  1185. <li>documentation: xmllint man page had --nonet duplicated</li>
  1186. </ul>
  1187. <h3>2.6.20: Jul 10 2005</h3>
  1188. <ul>
  1189. <li>build fixes: Windows build (Rob Richards), Mingw compilation (Igor
  1190. Zlatkovic), Windows Makefile (Igor), gcc warnings (Kasimier and
  1191. andriy@google.com), use gcc weak references to pthread to avoid the
  1192. pthread dependancy on Linux, compilation problem (Steve Nairn), compiling
  1193. of subset (Morten Welinder), IPv6/ss_family compilation (William Brack),
  1194. compilation when disabling parts of the library, standalone test
  1195. distribution.</li>
  1196. <li>bug fixes: bug in lang(), memory cleanup on errors (William Brack),
  1197. HTTP query strings (Aron Stansvik), memory leak in DTD (William), integer
  1198. overflow in XPath (William), nanoftp buffer size, pattern "." apth fixup
  1199. (Kasimier), leak in tree reported by Malcolm Rowe, replaceNode patch
  1200. (Brent Hendricks), CDATA with NULL content (Mark Vakoc), xml:base fixup
  1201. on XInclude (William), pattern fixes (William), attribute bug in
  1202. exclusive c14n (Aleksey Sanin), xml:space and xml:lang with SAX2 (Rob
  1203. Richards), namespace trouble in complex parsing (Malcolm Rowe), XSD type
  1204. QNames fixes (Kasimier), XPath streaming fixups (William), RelaxNG bug
  1205. (Rob Richards), Schemas for Schemas fixes (Kasimier), removal of ID (Rob
  1206. Richards), a small RelaxNG leak, HTML parsing in push mode bug (James
  1207. Bursa), failure to detect UTF-8 parsing bugs in CDATA sections,
  1208. areBlanks() heuristic failure, duplicate attributes in DTD bug
  1209. (William).</li>
  1210. <li>improvements: lot of work on Schemas by Kasimier Buchcik both on
  1211. conformance and streaming, Schemas validation messages (Kasimier Buchcik,
  1212. Matthew Burgess), namespace removal at the python level (Brent
  1213. Hendricks), Update to new Schemas regression tests from W3C/Nist
  1214. (Kasimier), xmlSchemaValidateFile() (Kasimier), implementation of
  1215. xmlTextReaderReadInnerXml and xmlTextReaderReadOuterXml (James Wert),
  1216. standalone test framework and programs, new DOM import APIs
  1217. xmlDOMWrapReconcileNamespaces() xmlDOMWrapAdoptNode() and
  1218. xmlDOMWrapRemoveNode(), extension of xmllint capabilities for SAX and
  1219. Schemas regression tests, xmlStopParser() available in pull mode too,
  1220. ienhancement to xmllint --shell namespaces support, Windows port of the
  1221. standalone testing tools (Kasimier and William),
  1222. xmlSchemaValidateStream() xmlSchemaSAXPlug() and xmlSchemaSAXUnplug() SAX
  1223. Schemas APIs, Schemas xmlReader support.</li>
  1224. </ul>
  1225. <h3>2.6.19: Apr 02 2005</h3>
  1226. <ul>
  1227. <li>build fixes: drop .la from RPMs, --with-minimum build fix (William
  1228. Brack), use XML_SOCKLEN_T instead of SOCKLEN_T because it breaks with AIX
  1229. 5.3 compiler, fixed elfgcchack.h generation and PLT reduction code on
  1230. Linux/ELF/gcc4</li>
  1231. <li>bug fixes: schemas type decimal fixups (William Brack), xmmlint return
  1232. code (Gerry Murphy), small schemas fixes (Matthew Burgess and GUY
  1233. Fabrice), workaround "DAV:" namespace brokeness in c14n (Aleksey Sanin),
  1234. segfault in Schemas (Kasimier Buchcik), Schemas attribute validation
  1235. (Kasimier), Prop related functions and xmlNewNodeEatName (Rob Richards),
  1236. HTML serialization of name attribute on a elements, Python error handlers
  1237. leaks and improvement (Brent Hendricks), uninitialized variable in
  1238. encoding code, Relax-NG validation bug, potential crash if
  1239. gnorableWhitespace is NULL, xmlSAXParseDoc and xmlParseDoc signatures,
  1240. switched back to assuming UTF-8 in case no encoding is given at
  1241. serialization time</li>
  1242. <li>improvements: lot of work on Schemas by Kasimier Buchcik on facets
  1243. checking and also mixed handling.</li>
  1244. <li></li>
  1245. </ul>
  1246. <h3>2.6.18: Mar 13 2005</h3>
  1247. <ul>
  1248. <li>build fixes: warnings (Peter Breitenlohner), testapi.c generation,
  1249. Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed),
  1250. some gcc4 fixes, HP-UX portability fixes (Rick Jones).</li>
  1251. <li>bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and
  1252. xmlreader stopping on non-fatal errors, thread support for dictionnaries
  1253. reference counting (Gary Coady), internal subset and push problem, URL
  1254. saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths
  1255. fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix
  1256. (Mike Hommey), warning should not count as error (William Brack),
  1257. xmlCreatePushParser empty chunk, XInclude parser flags (William), cleanup
  1258. FTP and HTTP code to reuse the uri parsing and IPv6 (William),
  1259. xmlTextWriterStartAttributeNS fix (Rob Richards), XMLLINT_INDENT being
  1260. empty (William), xmlWriter bugs (Rob Richards), multithreading on Windows
  1261. (Rich Salz), xmlSearchNsByHref fix (Kasimier), Python binding leak (Brent
  1262. Hendricks), aliasing bug exposed by gcc4 on s390, xmlTextReaderNext bug
  1263. (Rob Richards), Schemas decimal type fixes (William Brack),
  1264. xmlByteConsumed static buffer (Ben Maurer).</li>
  1265. <li>improvement: speedup parsing comments and DTDs, dictionnary support for
  1266. hash tables, Schemas Identity constraints (Kasimier), streaming XPath
  1267. subset, xmlTextReaderReadString added (Bjorn Reese), Schemas canonical
  1268. values handling (Kasimier), add xmlTextReaderByteConsumed (Aron
  1269. Stansvik),</li>
  1270. <li>Documentation: Wiki support (Joel Reed)</li>
  1271. </ul>
  1272. <h3>2.6.17: Jan 16 2005</h3>
  1273. <ul>
  1274. <li>build fixes: Windows, warnings removal (William Brack),
  1275. maintainer-clean dependency(William), build in a different directory
  1276. (William), fixing --with-minimum configure build (William), BeOS build
  1277. (Marcin Konicki), Python-2.4 detection (William), compilation on AIX (Dan
  1278. McNichol)</li>
  1279. <li>bug fixes: xmlTextReaderHasAttributes (Rob Richards), xmlCtxtReadFile()
  1280. to use the catalog(s), loop on output (William Brack), XPath memory leak,
  1281. ID deallocation problem (Steve Shepard), debugDumpNode crash (William),
  1282. warning not using error callback (William), xmlStopParser bug (William),
  1283. UTF-16 with BOM on DTDs (William), namespace bug on empty elements in
  1284. push mode (Rob Richards), line and col computations fixups (Aleksey
  1285. Sanin), xmlURIEscape fix (William), xmlXPathErr on bad range (William),
  1286. patterns with too many steps, bug in RNG choice optimization, line number
  1287. sometimes missing.</li>
  1288. <li>improvements: XSD Schemas (Kasimier Buchcik), python generator
  1289. (William), xmlUTF8Strpos speedup (William), unicode Python strings
  1290. (William), XSD error reports (Kasimier Buchcik), Python __str__ call
  1291. serialize().</li>
  1292. <li>new APIs: added xmlDictExists(), GetLineNumber and GetColumnNumber for
  1293. the xmlReader (Aleksey Sanin), Dynamic Shared Libraries APIs (mostly Joel
  1294. Reed), error extraction API from regexps, new XMLSave option for format
  1295. (Phil Shafer)</li>
  1296. <li>documentation: site improvement (John Fleck), FAQ entries
  1297. (William).</li>
  1298. </ul>
  1299. <h3>2.6.16: Nov 10 2004</h3>
  1300. <ul>
  1301. <li>general hardening and bug fixing crossing all the API based on new
  1302. automated regression testing</li>
  1303. <li>build fix: IPv6 build and test on AIX (Dodji Seketeli)</li>
  1304. <li>bug fixes: problem with XML::Libxml reported by Petr Pajas, encoding
  1305. conversion functions return values, UTF-8 bug affecting XPath reported by
  1306. Markus Bertheau, catalog problem with NULL entries (William Brack)</li>
  1307. <li>documentation: fix to xmllint man page, some API function descritpion
  1308. were updated.</li>
  1309. <li>improvements: DTD validation APIs provided at the Python level (Brent
  1310. Hendricks)</li>
  1311. </ul>
  1312. <h3>2.6.15: Oct 27 2004</h3>
  1313. <ul>
  1314. <li>security fixes on the nanoftp and nanohttp modules</li>
  1315. <li>build fixes: xmllint detection bug in configure, building outside the
  1316. source tree (Thomas Fitzsimmons)</li>
  1317. <li>bug fixes: HTML parser on broken ASCII chars in names (William), Python
  1318. paths (Malcolm Tredinnick), xmlHasNsProp and default namespace (William),
  1319. saving to python file objects (Malcolm Tredinnick), DTD lookup fix
  1320. (Malcolm), save back &lt;group&gt; in catalogs (William), tree build
  1321. fixes (DV and Rob Richards), Schemas memory bug, structured error handler
  1322. on Python 64bits, thread local memory deallocation, memory leak reported
  1323. by Volker Roth, xmlValidateDtd in the presence of an internal subset,
  1324. entities and _private problem (William), xmlBuildRelativeURI error
  1325. (William).</li>
  1326. <li>improvements: better XInclude error reports (William), tree debugging
  1327. module and tests, convenience functions at the Reader API (Graham
  1328. Bennett), add support for PI in the HTML parser.</li>
  1329. </ul>
  1330. <h3>2.6.14: Sep 29 2004</h3>
  1331. <ul>
  1332. <li>build fixes: configure paths for xmllint and xsltproc, compilation
  1333. without HTML parser, compilation warning cleanups (William Brack &amp;
  1334. Malcolm Tredinnick), VMS makefile update (Craig Berry),</li>
  1335. <li>bug fixes: xmlGetUTF8Char (William Brack), QName properties (Kasimier
  1336. Buchcik), XInclude testing, Notation serialization, UTF8ToISO8859x
  1337. transcoding (Mark Itzcovitz), lots of XML Schemas cleanup and fixes
  1338. (Kasimier), ChangeLog cleanup (Stepan Kasal), memory fixes (Mark Vakoc),
  1339. handling of failed realloc(), out of bound array adressing in Schemas
  1340. date handling, Python space/tabs cleanups (Malcolm Tredinnick), NMTOKENS
  1341. E20 validation fix (Malcolm),</li>
  1342. <li>improvements: added W3C XML Schemas testsuite (Kasimier Buchcik), add
  1343. xmlSchemaValidateOneElement (Kasimier), Python exception hierearchy
  1344. (Malcolm Tredinnick), Python libxml2 driver improvement (Malcolm
  1345. Tredinnick), Schemas support for xsi:schemaLocation,
  1346. xsi:noNamespaceSchemaLocation, xsi:type (Kasimier Buchcik)</li>
  1347. </ul>
  1348. <h3>2.6.13: Aug 31 2004</h3>
  1349. <ul>
  1350. <li>build fixes: Windows and zlib (Igor Zlatkovic), -O flag with gcc,
  1351. Solaris compiler warning, fixing RPM BuildRequires,</li>
  1352. <li>fixes: DTD loading on Windows (Igor), Schemas error reports APIs
  1353. (Kasimier Buchcik), Schemas validation crash, xmlCheckUTF8 (William Brack
  1354. and Julius Mittenzwei), Schemas facet check (Kasimier), default namespace
  1355. problem (William), Schemas hexbinary empty values, encoding error could
  1356. genrate a serialization loop.</li>
  1357. <li>Improvements: Schemas validity improvements (Kasimier), added --path
  1358. and --load-trace options to xmllint</li>
  1359. <li>documentation: tutorial update (John Fleck)</li>
  1360. </ul>
  1361. <h3>2.6.12: Aug 22 2004</h3>
  1362. <ul>
  1363. <li>build fixes: fix --with-minimum, elfgcchack.h fixes (Peter
  1364. Breitenlohner), perl path lookup (William), diff on Solaris (Albert
  1365. Chin), some 64bits cleanups.</li>
  1366. <li>Python: avoid a warning with 2.3 (William Brack), tab and space mixes
  1367. (William), wrapper generator fixes (William), Cygwin support (Gerrit P.
  1368. Haase), node wrapper fix (Marc-Antoine Parent), XML Schemas support
  1369. (Torkel Lyng)</li>
  1370. <li>Schemas: a lot of bug fixes and improvements from Kasimier Buchcik</li>
  1371. <li>fixes: RVT fixes (William), XPath context resets bug (William), memory
  1372. debug (Steve Hay), catalog white space handling (Peter Breitenlohner),
  1373. xmlReader state after attribute reading (William), structured error
  1374. handler (William), XInclude generated xml:base fixup (William), Windows
  1375. memory reallocation problem (Steve Hay), Out of Memory conditions
  1376. handling (William and Olivier Andrieu), htmlNewDoc() charset bug,
  1377. htmlReadMemory init (William), a posteriori validation DTD base
  1378. (William), notations serialization missing, xmlGetNodePath (Dodji),
  1379. xmlCheckUTF8 (Diego Tartara), missing line numbers on entity
  1380. (William)</li>
  1381. <li>improvements: DocBook catalog build scrip (William), xmlcatalog tool
  1382. (Albert Chin), xmllint --c14n option, no_proxy environment (Mike Hommey),
  1383. xmlParseInNodeContext() addition, extend xmllint --shell, allow XInclude
  1384. to not generate start/end nodes, extend xmllint --version to include CVS
  1385. tag (William)</li>
  1386. <li>documentation: web pages fixes, validity API docs fixes (William)
  1387. schemas API fix (Eric Haszlakiewicz), xmllint man page (John Fleck)</li>
  1388. </ul>
  1389. <h3>2.6.11: July 5 2004</h3>
  1390. <ul>
  1391. <li>Schemas: a lot of changes and improvements by Kasimier Buchcik for
  1392. attributes, namespaces and simple types.</li>
  1393. <li>build fixes: --with-minimum (William Brack), some gcc cleanup
  1394. (William), --with-thread-alloc (William)</li>
  1395. <li>portability: Windows binary package change (Igor Zlatkovic), Catalog
  1396. path on Windows</li>
  1397. <li>documentation: update to the tutorial (John Fleck), xmllint return code
  1398. (John Fleck), man pages (Ville Skytta),</li>
  1399. <li>bug fixes: C14N bug serializing namespaces (Aleksey Sanin), testSAX
  1400. properly initialize the library (William), empty node set in XPath
  1401. (William), xmlSchemas errors (William), invalid charref problem pointed
  1402. by Morus Walter, XInclude xml:base generation (William), Relax-NG bug
  1403. with div processing (William), XPointer and xml:base problem(William),
  1404. Reader and entities, xmllint return code for schemas (William), reader
  1405. streaming problem (Steve Ball), DTD serialization problem (William),
  1406. libxml.m4 fixes (Mike Hommey), do not provide destructors as methods on
  1407. Python classes, xmlReader buffer bug, Python bindings memory interfaces
  1408. improvement (with Stéphane Bidoul), Fixed the push parser to be back to
  1409. synchronous behaviour.</li>
  1410. <li>improvement: custom per-thread I/O enhancement (Rob Richards), register
  1411. namespace in debug shell (Stefano Debenedetti), Python based regression
  1412. test for non-Unix users (William), dynamically increase the number of
  1413. XPath extension functions in Python and fix a memory leak (Marc-Antoine
  1414. Parent and William)</li>
  1415. <li>performance: hack done with Arjan van de Ven to reduce ELF footprint
  1416. and generated code on Linux, plus use gcc runtime profiling to optimize
  1417. the code generated in the RPM packages.</li>
  1418. </ul>
  1419. <h3>2.6.10: May 17 2004</h3>
  1420. <ul>
  1421. <li>Web page generated for ChangeLog</li>
  1422. <li>build fixes: --without-html problems, make check without make all</li>
  1423. <li>portability: problem with xpath.c on Windows (MSC and Borland), memcmp
  1424. vs. strncmp on Solaris, XPath tests on Windows (Mark Vakoc), C++ do not
  1425. use "list" as parameter name, make tests work with Python 1.5 (Ed
  1426. Davis),</li>
  1427. <li>improvements: made xmlTextReaderMode public, small buffers resizing
  1428. (Morten Welinder), add --maxmem option to xmllint, add
  1429. xmlPopInputCallback() for Matt Sergeant, refactoring of serialization
  1430. escaping, added escaping customization</li>
  1431. <li>bugfixes: xsd:extension (Taihei Goi), assorted regexp bugs (William
  1432. Brack), xmlReader end of stream problem, node deregistration with reader,
  1433. URI escaping and filemanes, XHTML1 formatting (Nick Wellnhofer), regexp
  1434. transition reduction (William), various XSD Schemas fixes (Kasimier
  1435. Buchcik), XInclude fallback problem (William), weird problems with DTD
  1436. (William), structured error handler callback context (William), reverse
  1437. xmlEncodeSpecialChars() behaviour back to escaping '"'</li>
  1438. </ul>
  1439. <h3>2.6.9: Apr 18 2004</h3>
  1440. <ul>
  1441. <li>implement xml:id Working Draft, relaxed XPath id() checking</li>
  1442. <li>bugfixes: xmlCtxtReset (Brent Hendricks), line number and CDATA (Dave
  1443. Beckett), Relax-NG compilation (William Brack), Regexp patches (with
  1444. William), xmlUriEscape (Mark Vakoc), a Relax-NG notAllowed problem (with
  1445. William), Relax-NG name classes compares (William), XInclude duplicate
  1446. fallback (William), external DTD encoding detection (William), a DTD
  1447. validation bug (William), xmlReader Close() fix, recusive extention
  1448. schemas</li>
  1449. <li>improvements: use xmlRead* APIs in test tools (Mark Vakoc), indenting
  1450. save optimization, better handle IIS broken HTTP redirect behaviour (Ian
  1451. Hummel), HTML parser frameset (James Bursa), libxml2-python RPM
  1452. dependancy, XML Schemas union support (Kasimier Buchcik), warning removal
  1453. clanup (William), keep ChangeLog compressed when installing from RPMs</li>
  1454. <li>documentation: examples and xmlDocDumpMemory docs (John Fleck), new
  1455. example (load, xpath, modify, save), xmlCatalogDump() comments,</li>
  1456. <li>Windows: Borland C++ builder (Eric Zurcher), work around Microsoft
  1457. compiler NaN handling bug (Mark Vakoc)</li>
  1458. </ul>
  1459. <h3>2.6.8: Mar 23 2004</h3>
  1460. <ul>
  1461. <li>First step of the cleanup of the serialization code and APIs</li>
  1462. <li>XML Schemas: mixed content (Adam Dickmeiss), QName handling fixes (Adam
  1463. Dickmeiss), anyURI for "" (John Belmonte)</li>
  1464. <li>Python: Canonicalization C14N support added (Anthony Carrico)</li>
  1465. <li>xmlDocCopyNode() extension (William)</li>
  1466. <li>Relax-NG: fix when processing XInclude results (William), external
  1467. reference in interleave (William), missing error on &lt;choice&gt;
  1468. failure (William), memory leak in schemas datatype facets.</li>
  1469. <li>xmlWriter: patch for better DTD support (Alfred Mickautsch)</li>
  1470. <li>bug fixes: xmlXPathLangFunction memory leak (Mike Hommey and William
  1471. Brack), no ID errors if using HTML_PARSE_NOERROR, xmlcatalog fallbacks to
  1472. URI on SYSTEM lookup failure, XInclude parse flags inheritance (William),
  1473. XInclude and XPointer fixes for entities (William), XML parser bug
  1474. reported by Holger Rauch, nanohttp fd leak (William), regexps char
  1475. groups '-' handling (William), dictionnary reference counting problems,
  1476. do not close stderr.</li>
  1477. <li>performance patches from Petr Pajas</li>
  1478. <li>Documentation fixes: XML_CATALOG_FILES in man pages (Mike Hommey)</li>
  1479. <li>compilation and portability fixes: --without-valid, catalog cleanups
  1480. (Peter Breitenlohner), MingW patch (Roland Schwingel), cross-compilation
  1481. to Windows (Christophe de Vienne), --with-html-dir fixup (Julio Merino
  1482. Vidal), Windows build (Eric Zurcher)</li>
  1483. </ul>
  1484. <h3>2.6.7: Feb 23 2004</h3>
  1485. <ul>
  1486. <li>documentation: tutorial updates (John Fleck), benchmark results</li>
  1487. <li>xmlWriter: updates and fixes (Alfred Mickautsch, Lucas Brasilino)</li>
  1488. <li>XPath optimization (Petr Pajas)</li>
  1489. <li>DTD ID handling optimization</li>
  1490. <li>bugfixes: xpath number with &gt; 19 fractional (William Brack), push
  1491. mode with unescaped '&gt;' characters, fix xmllint --stream --timing, fix
  1492. xmllint --memory --stream memory usage, xmlAttrSerializeTxtContent
  1493. handling NULL, trying to fix Relax-NG/Perl interface.</li>
  1494. <li>python: 2.3 compatibility, whitespace fixes (Malcolm Tredinnick)</li>
  1495. <li>Added relaxng option to xmllint --shell</li>
  1496. </ul>
  1497. <h3>2.6.6: Feb 12 2004</h3>
  1498. <ul>
  1499. <li>nanohttp and nanoftp: buffer overflow error on URI parsing (Igor and
  1500. William) reported by Yuuichi Teranishi</li>
  1501. <li>bugfixes: make test and path issues, xmlWriter attribute serialization
  1502. (William Brack), xmlWriter indentation (William), schemas validation
  1503. (Eric Haszlakiewicz), XInclude dictionnaries issues (William and Oleg
  1504. Paraschenko), XInclude empty fallback (William), HTML warnings (William),
  1505. XPointer in XInclude (William), Python namespace serialization,
  1506. isolat1ToUTF8 bound error (Alfred Mickautsch), output of parameter
  1507. entities in internal subset (William), internal subset bug in push mode,
  1508. &lt;xs:all&gt; fix (Alexey Sarytchev)</li>
  1509. <li>Build: fix for automake-1.8 (Alexander Winston), warnings removal
  1510. (Philip Ludlam), SOCKLEN_T detection fixes (Daniel Richard), fix
  1511. --with-minimum configuration.</li>
  1512. <li>XInclude: allow the 2001 namespace without warning.</li>
  1513. <li>Documentation: missing example/index.html (John Fleck), version
  1514. dependancies (John Fleck)</li>
  1515. <li>reader API: structured error reporting (Steve Ball)</li>
  1516. <li>Windows compilation: mingw, msys (Mikhail Grushinskiy), function
  1517. prototype (Cameron Johnson), MSVC6 compiler warnings, _WINSOCKAPI_
  1518. patch</li>
  1519. <li>Parsers: added xmlByteConsumed(ctxt) API to get the byte offest in
  1520. input.</li>
  1521. </ul>
  1522. <h3>2.6.5: Jan 25 2004</h3>
  1523. <ul>
  1524. <li>Bugfixes: dictionnaries for schemas (William Brack), regexp segfault
  1525. (William), xs:all problem (William), a number of XPointer bugfixes
  1526. (William), xmllint error go to stderr, DTD validation problem with
  1527. namespace, memory leak (William), SAX1 cleanup and minimal options fixes
  1528. (Mark Vadoc), parser context reset on error (Shaun McCance), XPath union
  1529. evaluation problem (William) , xmlReallocLoc with NULL (Aleksey Sanin),
  1530. XML Schemas double free (Steve Ball), XInclude with no href, argument
  1531. callbacks order for XPath callbacks (Frederic Peters)</li>
  1532. <li>Documentation: python scripts (William Brack), xslt stylesheets (John
  1533. Fleck), doc (Sven Zimmerman), I/O example.</li>
  1534. <li>Python bindings: fixes (William), enum support (Stéphane Bidoul),
  1535. structured error reporting (Stéphane Bidoul)</li>
  1536. <li>XInclude: various fixes for conformance, problem related to dictionnary
  1537. references (William &amp; me), recursion (William)</li>
  1538. <li>xmlWriter: indentation (Lucas Brasilino), memory leaks (Alfred
  1539. Mickautsch),</li>
  1540. <li>xmlSchemas: normalizedString datatype (John Belmonte)</li>
  1541. <li>code cleanup for strings functions (William)</li>
  1542. <li>Windows: compiler patches (Mark Vakoc)</li>
  1543. <li>Parser optimizations, a few new XPath and dictionnary APIs for future
  1544. XSLT optimizations.</li>
  1545. </ul>
  1546. <h3>2.6.4: Dec 24 2003</h3>
  1547. <ul>
  1548. <li>Windows build fixes (Igor Zlatkovic)</li>
  1549. <li>Some serious XInclude problems reported by Oleg Paraschenko and</li>
  1550. <li>Unix and Makefile packaging fixes (me, William Brack,</li>
  1551. <li>Documentation improvements (John Fleck, William Brack), example fix
  1552. (Lucas Brasilino)</li>
  1553. <li>bugfixes: xmlTextReaderExpand() with xmlReaderWalker, XPath handling of
  1554. NULL strings (William Brack) , API building reader or parser from
  1555. filedescriptor should not close it, changed XPath sorting to be stable
  1556. again (William Brack), xmlGetNodePath() generating '(null)' (William
  1557. Brack), DTD validation and namespace bug (William Brack), XML Schemas
  1558. double inclusion behaviour</li>
  1559. </ul>
  1560. <h3>2.6.3: Dec 10 2003</h3>
  1561. <ul>
  1562. <li>documentation updates and cleanup (DV, William Brack, John Fleck)</li>
  1563. <li>added a repository of examples, examples from Aleksey Sanin, Dodji
  1564. Seketeli, Alfred Mickautsch</li>
  1565. <li>Windows updates: Mark Vakoc, Igor Zlatkovic, Eric Zurcher, Mingw
  1566. (Kenneth Haley)</li>
  1567. <li>Unicode range checking (William Brack)</li>
  1568. <li>code cleanup (William Brack)</li>
  1569. <li>Python bindings: doc (John Fleck), bug fixes</li>
  1570. <li>UTF-16 cleanup and BOM issues (William Brack)</li>
  1571. <li>bug fixes: ID and xmlReader validation, XPath (William Brack),
  1572. xmlWriter (Alfred Mickautsch), hash.h inclusion problem, HTML parser
  1573. (James Bursa), attribute defaulting and validation, some serialization
  1574. cleanups, XML_GET_LINE macro, memory debug when using threads (William
  1575. Brack), serialization of attributes and entities content, xmlWriter
  1576. (Daniel Schulman)</li>
  1577. <li>XInclude bugfix, new APIs and update to the last version including the
  1578. namespace change.</li>
  1579. <li>XML Schemas improvements: include (Robert Stepanek), import and
  1580. namespace handling, fixed the regression tests troubles, added examples
  1581. based on Eric van der Vlist book, regexp fixes</li>
  1582. <li>preliminary pattern support for streaming (needed for schemas
  1583. constraints), added xmlTextReaderPreservePattern() to collect subdocument
  1584. when streaming.</li>
  1585. <li>various fixes in the structured error handling</li>
  1586. </ul>
  1587. <h3>2.6.2: Nov 4 2003</h3>
  1588. <ul>
  1589. <li>XPath context unregistration fixes</li>
  1590. <li>text node coalescing fixes (Mark Lilback)</li>
  1591. <li>API to screate a W3C Schemas from an existing document (Steve Ball)</li>
  1592. <li>BeOS patches (Marcin 'Shard' Konicki)</li>
  1593. <li>xmlStrVPrintf function added (Aleksey Sanin)</li>
  1594. <li>compilation fixes (Mark Vakoc)</li>
  1595. <li>stdin parsing fix (William Brack)</li>
  1596. <li>a posteriori DTD validation fixes</li>
  1597. <li>xmlReader bug fixes: Walker fixes, python bindings</li>
  1598. <li>fixed xmlStopParser() to really stop the parser and errors</li>
  1599. <li>always generate line numbers when using the new xmlReadxxx
  1600. functions</li>
  1601. <li>added XInclude support to the xmlReader interface</li>
  1602. <li>implemented XML_PARSE_NONET parser option</li>
  1603. <li>DocBook XSLT processing bug fixed</li>
  1604. <li>HTML serialization for &lt;p&gt; elements (William Brack and me)</li>
  1605. <li>XPointer failure in XInclude are now handled as resource errors</li>
  1606. <li>fixed xmllint --html to use the HTML serializer on output (added
  1607. --xmlout to implement the previous behaviour of saving it using the XML
  1608. serializer)</li>
  1609. </ul>
  1610. <h3>2.6.1: Oct 28 2003</h3>
  1611. <ul>
  1612. <li>Mostly bugfixes after the big 2.6.0 changes</li>
  1613. <li>Unix compilation patches: libxml.m4 (Patrick Welche), warnings cleanup
  1614. (William Brack)</li>
  1615. <li>Windows compilation patches (Joachim Bauch, Stephane Bidoul, Igor
  1616. Zlatkovic)</li>
  1617. <li>xmlWriter bugfix (Alfred Mickautsch)</li>
  1618. <li>chvalid.[ch]: couple of fixes from Stephane Bidoul</li>
  1619. <li>context reset: error state reset, push parser reset (Graham
  1620. Bennett)</li>
  1621. <li>context reuse: generate errors if file is not readable</li>
  1622. <li>defaulted attributes for element coming from internal entities
  1623. (Stephane Bidoul)</li>
  1624. <li>Python: tab and spaces mix (William Brack)</li>
  1625. <li>Error handler could crash in DTD validation in 2.6.0</li>
  1626. <li>xmlReader: do not use the document or element _private field</li>
  1627. <li>testSAX.c: avoid a problem with some PIs (Massimo Morara)</li>
  1628. <li>general bug fixes: mandatory encoding in text decl, serializing
  1629. Document Fragment nodes, xmlSearchNs 2.6.0 problem (Kasimier Buchcik),
  1630. XPath errors not reported, slow HTML parsing of large documents.</li>
  1631. </ul>
  1632. <h3>2.6.0: Oct 20 2003</h3>
  1633. <ul>
  1634. <li>Major revision release: should be API and ABI compatible but got a lot
  1635. of change</li>
  1636. <li>Increased the library modularity, far more options can be stripped out,
  1637. a --with-minimum configuration will weight around 160KBytes</li>
  1638. <li>Use per parser and per document dictionnary, allocate names and small
  1639. text nodes from the dictionnary</li>
  1640. <li>Switch to a SAX2 like parser rewrote most of the XML parser core,
  1641. provides namespace resolution and defaulted attributes, minimize memory
  1642. allocations and copies, namespace checking and specific error handling,
  1643. immutable buffers, make predefined entities static structures, etc...</li>
  1644. <li>rewrote all the error handling in the library, all errors can be
  1645. intercepted at a structured level, with precise information
  1646. available.</li>
  1647. <li>New simpler and more generic XML and HTML parser APIs, allowing to
  1648. easilly modify the parsing options and reuse parser context for multiple
  1649. consecutive documents.</li>
  1650. <li>Similar new APIs for the xmlReader, for options and reuse, provided new
  1651. functions to access content as const strings, use them for Python
  1652. bindings</li>
  1653. <li>a lot of other smaller API improvements: xmlStrPrintf (Aleksey Sanin),
  1654. Walker i.e. reader on a document tree based on Alfred Mickautsch code,
  1655. make room in nodes for line numbers, reference counting and future PSVI
  1656. extensions, generation of character ranges to be checked with faster
  1657. algorithm (William), xmlParserMaxDepth (Crutcher Dunnavant), buffer
  1658. access</li>
  1659. <li>New xmlWriter API provided by Alfred Mickautsch</li>
  1660. <li>Schemas: base64 support by Anthony Carrico</li>
  1661. <li>Parser&lt;-&gt;HTTP integration fix, proper processing of the Mime-Type
  1662. and charset information if available.</li>
  1663. <li>Relax-NG: bug fixes including the one reported by Martijn Faassen and
  1664. zeroOrMore, better error reporting.</li>
  1665. <li>Python bindings (Stéphane Bidoul), never use stdout for errors
  1666. output</li>
  1667. <li>Portability: all the headers have macros for export and calling
  1668. convention definitions (Igor Zlatkovic), VMS update (Craig A. Berry),
  1669. Windows: threads (Jesse Pelton), Borland compiler (Eric Zurcher, Igor),
  1670. Mingw (Igor), typos (Mark Vakoc), beta version (Stephane Bidoul),
  1671. warning cleanups on AIX and MIPS compilers (William Brack), BeOS (Marcin
  1672. 'Shard' Konicki)</li>
  1673. <li>Documentation fixes and README (William Brack), search fix (William),
  1674. tutorial updates (John Fleck), namespace docs (Stefan Kost)</li>
  1675. <li>Bug fixes: xmlCleanupParser (Dave Beckett), threading uninitialized
  1676. mutexes, HTML doctype lowercase, SAX/IO (William), compression detection
  1677. and restore (William), attribute declaration in DTDs (William), namespace
  1678. on attribute in HTML output (William), input filename (Rob Richards),
  1679. namespace DTD validation, xmlReplaceNode (Chris Ryland), I/O callbacks
  1680. (Markus Keim), CDATA serialization (Shaun McCance), xmlReader (Peter
  1681. Derr), high codepoint charref like &amp;#x10FFFF;, buffer access in push
  1682. mode (Justin Fletcher), TLS threads on Windows (Jesse Pelton), XPath bug
  1683. (William), xmlCleanupParser (Marc Liyanage), CDATA output (William), HTTP
  1684. error handling.</li>
  1685. <li>xmllint options: --dtdvalidfpi for Tobias Reif, --sax1 for compat
  1686. testing, --nodict for building without tree dictionnary, --nocdata to
  1687. replace CDATA by text, --nsclean to remove surperfluous namespace
  1688. declarations</li>
  1689. <li>added xml2-config --libtool-libs option from Kevin P. Fleming</li>
  1690. <li>a lot of profiling and tuning of the code, speedup patch for
  1691. xmlSearchNs() by Luca Padovani. The xmlReader should do far less
  1692. allocation and it speed should get closer to SAX. Chris Anderson worked
  1693. on speeding and cleaning up repetitive checking code.</li>
  1694. <li>cleanup of "make tests"</li>
  1695. <li>libxml-2.0-uninstalled.pc from Malcolm Tredinnick</li>
  1696. <li>deactivated the broken docBook SGML parser code and plugged the XML
  1697. parser instead.</li>
  1698. </ul>
  1699. <h3>2.5.11: Sep 9 2003</h3>
  1700. <p>A bugfix only release:</p>
  1701. <ul>
  1702. <li>risk of crash in Relax-NG</li>
  1703. <li>risk of crash when using multithreaded programs</li>
  1704. </ul>
  1705. <h3>2.5.10: Aug 15 2003</h3>
  1706. <p>A bugfixes only release</p>
  1707. <ul>
  1708. <li>Windows Makefiles (William Brack)</li>
  1709. <li>UTF-16 support fixes (Mark Itzcovitz)</li>
  1710. <li>Makefile and portability (William Brack) automake, Linux alpha, Mingw
  1711. on Windows (Mikhail Grushinskiy)</li>
  1712. <li>HTML parser (Oliver Stoeneberg)</li>
  1713. <li>XInclude performance problem reported by Kevin Ruscoe</li>
  1714. <li>XML parser performance problem reported by Grant Goodale</li>
  1715. <li>xmlSAXParseDTD() bug fix from Malcolm Tredinnick</li>
  1716. <li>and a couple other cleanup</li>
  1717. </ul>
  1718. <h3>2.5.9: Aug 9 2003</h3>
  1719. <ul>
  1720. <li>bugfixes: IPv6 portability, xmlHasNsProp (Markus Keim), Windows build
  1721. (Wiliam Brake, Jesse Pelton, Igor), Schemas (Peter Sobisch), threading
  1722. (Rob Richards), hexBinary type (), UTF-16 BOM (Dodji Seketeli),
  1723. xmlReader, Relax-NG schemas compilation, namespace handling, EXSLT (Sean
  1724. Griffin), HTML parsing problem (William Brack), DTD validation for mixed
  1725. content + namespaces, HTML serialization, library initialization,
  1726. progressive HTML parser</li>
  1727. <li>better interfaces for Relax-NG error handling (Joachim Bauch, )</li>
  1728. <li>adding xmlXIncludeProcessTree() for XInclud'ing in a subtree</li>
  1729. <li>doc fixes and improvements (John Fleck)</li>
  1730. <li>configure flag for -with-fexceptions when embedding in C++</li>
  1731. <li>couple of new UTF-8 helper functions (William Brack)</li>
  1732. <li>general encoding cleanup + ISO-8859-x without iconv (Peter Jacobi)</li>
  1733. <li>xmlTextReader cleanup + enum for node types (Bjorn Reese)</li>
  1734. <li>general compilation/warning cleanup Solaris/HP-UX/... (William
  1735. Brack)</li>
  1736. </ul>
  1737. <h3>2.5.8: Jul 6 2003</h3>
  1738. <ul>
  1739. <li>bugfixes: XPath, XInclude, file/URI mapping, UTF-16 save (Mark
  1740. Itzcovitz), UTF-8 checking, URI saving, error printing (William Brack),
  1741. PI related memleak, compilation without schemas or without xpath (Joerg
  1742. Schmitz-Linneweber/Garry Pennington), xmlUnlinkNode problem with DTDs,
  1743. rpm problem on , i86_64, removed a few compilation problems from 2.5.7,
  1744. xmlIOParseDTD, and xmlSAXParseDTD (Malcolm Tredinnick)</li>
  1745. <li>portability: DJGPP (MsDos) , OpenVMS (Craig A. Berry)</li>
  1746. <li>William Brack fixed multithreading lock problems</li>
  1747. <li>IPv6 patch for FTP and HTTP accesses (Archana Shah/Wipro)</li>
  1748. <li>Windows fixes (Igor Zlatkovic, Eric Zurcher), threading (Stéphane
  1749. Bidoul)</li>
  1750. <li>A few W3C Schemas Structure improvements</li>
  1751. <li>W3C Schemas Datatype improvements (Charlie Bozeman)</li>
  1752. <li>Python bindings for thread globals (Stéphane Bidoul), and method/class
  1753. generator</li>
  1754. <li>added --nonet option to xmllint</li>
  1755. <li>documentation improvements (John Fleck)</li>
  1756. </ul>
  1757. <h3>2.5.7: Apr 25 2003</h3>
  1758. <ul>
  1759. <li>Relax-NG: Compiling to regexp and streaming validation on top of the
  1760. xmlReader interface, added to xmllint --stream</li>
  1761. <li>xmlReader: Expand(), Next() and DOM access glue, bug fixes</li>
  1762. <li>Support for large files: RGN validated a 4.5GB instance</li>
  1763. <li>Thread support is now configured in by default</li>
  1764. <li>Fixes: update of the Trio code (Bjorn), WXS Date and Duration fixes
  1765. (Charles Bozeman), DTD and namespaces (Brent Hendricks), HTML push parser
  1766. and zero bytes handling, some missing Windows file path conversions,
  1767. behaviour of the parser and validator in the presence of "out of memory"
  1768. error conditions</li>
  1769. <li>extended the API to be able to plug a garbage collecting memory
  1770. allocator, added xmlMallocAtomic() and modified the allocations
  1771. accordingly.</li>
  1772. <li>Performances: removed excessive malloc() calls, speedup of the push and
  1773. xmlReader interfaces, removed excessive thread locking</li>
  1774. <li>Documentation: man page (John Fleck), xmlReader documentation</li>
  1775. <li>Python: adding binding for xmlCatalogAddLocal (Brent M Hendricks)</li>
  1776. </ul>
  1777. <h3>2.5.6: Apr 1 2003</h3>
  1778. <ul>
  1779. <li>Fixed W3C XML Schemas datatype, should be compliant now except for
  1780. binHex and base64 which are not supported yet.</li>
  1781. <li>bug fixes: non-ASCII IDs, HTML output, XInclude on large docs and
  1782. XInclude entities handling, encoding detection on external subsets, XML
  1783. Schemas bugs and memory leaks, HTML parser (James Bursa)</li>
  1784. <li>portability: python/trio (Albert Chin), Sun compiler warnings</li>
  1785. <li>documentation: added --relaxng option to xmllint man page (John)</li>
  1786. <li>improved error reporting: xml:space, start/end tag mismatches, Relax NG
  1787. errors</li>
  1788. </ul>
  1789. <h3>2.5.5: Mar 24 2003</h3>
  1790. <ul>
  1791. <li>Lot of fixes on the Relax NG implementation. More testing including
  1792. DocBook and TEI examples.</li>
  1793. <li>Increased the support for W3C XML Schemas datatype</li>
  1794. <li>Several bug fixes in the URI handling layer</li>
  1795. <li>Bug fixes: HTML parser, xmlReader, DTD validation, XPath, encoding
  1796. conversion, line counting in the parser.</li>
  1797. <li>Added support for $XMLLINT_INDENT environment variable, FTP delete</li>
  1798. <li>Fixed the RPM spec file name</li>
  1799. </ul>
  1800. <h3>2.5.4: Feb 20 2003</h3>
  1801. <ul>
  1802. <li>Conformance testing and lot of fixes on Relax NG and XInclude
  1803. implementation</li>
  1804. <li>Implementation of XPointer element() scheme</li>
  1805. <li>Bug fixes: XML parser, XInclude entities merge, validity checking on
  1806. namespaces,
  1807. <p>2 serialization bugs, node info generation problems, a DTD regexp
  1808. generation problem.</p>
  1809. </li>
  1810. <li>Portability: windows updates and path canonicalization (Igor)</li>
  1811. <li>A few typo fixes (Kjartan Maraas)</li>
  1812. <li>Python bindings generator fixes (Stephane Bidoul)</li>
  1813. </ul>
  1814. <h3>2.5.3: Feb 10 2003</h3>
  1815. <ul>
  1816. <li>RelaxNG and XML Schemas datatypes improvements, and added a first
  1817. version of RelaxNG Python bindings</li>
  1818. <li>Fixes: XLink (Sean Chittenden), XInclude (Sean Chittenden), API fix for
  1819. serializing namespace nodes, encoding conversion bug, XHTML1
  1820. serialization</li>
  1821. <li>Portability fixes: Windows (Igor), AMD 64bits RPM spec file</li>
  1822. </ul>
  1823. <h3>2.5.2: Feb 5 2003</h3>
  1824. <ul>
  1825. <li>First implementation of RelaxNG, added --relaxng flag to xmllint</li>
  1826. <li>Schemas support now compiled in by default.</li>
  1827. <li>Bug fixes: DTD validation, namespace checking, XInclude and entities,
  1828. delegateURI in XML Catalogs, HTML parser, XML reader (Stéphane Bidoul),
  1829. XPath parser and evaluation, UTF8ToUTF8 serialization, XML reader memory
  1830. consumption, HTML parser, HTML serialization in the presence of
  1831. namespaces</li>
  1832. <li>added an HTML API to check elements and attributes.</li>
  1833. <li>Documentation improvement, PDF for the tutorial (John Fleck), doc
  1834. patches (Stefan Kost)</li>
  1835. <li>Portability fixes: NetBSD (Julio Merino), Windows (Igor Zlatkovic)</li>
  1836. <li>Added python bindings for XPointer, contextual error reporting
  1837. (Stéphane Bidoul)</li>
  1838. <li>URI/file escaping problems (Stefano Zacchiroli)</li>
  1839. </ul>
  1840. <h3>2.5.1: Jan 8 2003</h3>
  1841. <ul>
  1842. <li>Fixes a memory leak and configuration/compilation problems in 2.5.0</li>
  1843. <li>documentation updates (John)</li>
  1844. <li>a couple of XmlTextReader fixes</li>
  1845. </ul>
  1846. <h3>2.5.0: Jan 6 2003</h3>
  1847. <ul>
  1848. <li>New <a href="xmlreader.html">XmltextReader interface</a> based on C#
  1849. API (with help of Stéphane Bidoul)</li>
  1850. <li>Windows: more exports, including the new API (Igor)</li>
  1851. <li>XInclude fallback fix</li>
  1852. <li>Python: bindings for the new API, packaging (Stéphane Bidoul),
  1853. drv_libxml2.py Python xml.sax driver (Stéphane Bidoul), fixes, speedup
  1854. and iterators for Python-2.2 (Hannu Krosing)</li>
  1855. <li>Tutorial fixes (john Fleck and Niraj Tolia) xmllint man update
  1856. (John)</li>
  1857. <li>Fix an XML parser bug raised by Vyacheslav Pindyura</li>
  1858. <li>Fix for VMS serialization (Nigel Hall) and config (Craig A. Berry)</li>
  1859. <li>Entities handling fixes</li>
  1860. <li>new API to optionally track node creation and deletion (Lukas
  1861. Schroeder)</li>
  1862. <li>Added documentation for the XmltextReader interface and some <a
  1863. href="guidelines.html">XML guidelines</a></li>
  1864. </ul>
  1865. <h3>2.4.30: Dec 12 2002</h3>
  1866. <ul>
  1867. <li>2.4.29 broke the python bindings, rereleasing</li>
  1868. <li>Improvement/fixes of the XML API generator, and couple of minor code
  1869. fixes.</li>
  1870. </ul>
  1871. <h3>2.4.29: Dec 11 2002</h3>
  1872. <ul>
  1873. <li>Windows fixes (Igor): Windows CE port, pthread linking, python bindings
  1874. (Stéphane Bidoul), Mingw (Magnus Henoch), and export list updates</li>
  1875. <li>Fix for prev in python bindings (ERDI Gergo)</li>
  1876. <li>Fix for entities handling (Marcus Clarke)</li>
  1877. <li>Refactored the XML and HTML dumps to a single code path, fixed XHTML1
  1878. dump</li>
  1879. <li>Fix for URI parsing when handling URNs with fragment identifiers</li>
  1880. <li>Fix for HTTP URL escaping problem</li>
  1881. <li>added an TextXmlReader (C#) like API (work in progress)</li>
  1882. <li>Rewrote the API in XML generation script, includes a C parser and saves
  1883. more information needed for C# bindings</li>
  1884. </ul>
  1885. <h3>2.4.28: Nov 22 2002</h3>
  1886. <ul>
  1887. <li>a couple of python binding fixes</li>
  1888. <li>2 bug fixes in the XML push parser</li>
  1889. <li>potential memory leak removed (Martin Stoilov)</li>
  1890. <li>fix to the configure script for Unix (Dimitri Papadopoulos)</li>
  1891. <li>added encoding support for XInclude parse="text"</li>
  1892. <li>autodetection of XHTML1 and specific serialization rules added</li>
  1893. <li>nasty threading bug fixed (William Brack)</li>
  1894. </ul>
  1895. <h3>2.4.27: Nov 17 2002</h3>
  1896. <ul>
  1897. <li>fixes for the Python bindings</li>
  1898. <li>a number of bug fixes: SGML catalogs, xmlParseBalancedChunkMemory(),
  1899. HTML parser, Schemas (Charles Bozeman), document fragment support
  1900. (Christian Glahn), xmlReconciliateNs (Brian Stafford), XPointer,
  1901. xmlFreeNode(), xmlSAXParseMemory (Peter Jones), xmlGetNodePath (Petr
  1902. Pajas), entities processing</li>
  1903. <li>added grep to xmllint --shell</li>
  1904. <li>VMS update patch from Craig A. Berry</li>
  1905. <li>cleanup of the Windows build with support for more compilers (Igor),
  1906. better thread support on Windows</li>
  1907. <li>cleanup of Unix Makefiles and spec file</li>
  1908. <li>Improvements to the documentation (John Fleck)</li>
  1909. </ul>
  1910. <h3>2.4.26: Oct 18 2002</h3>
  1911. <ul>
  1912. <li>Patches for Windows CE port, improvements on Windows paths handling</li>
  1913. <li>Fixes to the validation code (DTD and Schemas), xmlNodeGetPath() ,
  1914. HTML serialization, Namespace compliance, and a number of small
  1915. problems</li>
  1916. </ul>
  1917. <h3>2.4.25: Sep 26 2002</h3>
  1918. <ul>
  1919. <li>A number of bug fixes: XPath, validation, Python bindings, DOM and
  1920. tree, xmlI/O, Html</li>
  1921. <li>Serious rewrite of XInclude</li>
  1922. <li>Made XML Schemas regexp part of the default build and APIs, small fix
  1923. and improvement of the regexp core</li>
  1924. <li>Changed the validation code to reuse XML Schemas regexp APIs</li>
  1925. <li>Better handling of Windows file paths, improvement of Makefiles (Igor,
  1926. Daniel Gehriger, Mark Vakoc)</li>
  1927. <li>Improved the python I/O bindings, the tests, added resolver and regexp
  1928. APIs</li>
  1929. <li>New logos from Marc Liyanage</li>
  1930. <li>Tutorial improvements: John Fleck, Christopher Harris</li>
  1931. <li>Makefile: Fixes for AMD x86_64 (Mandrake), DESTDIR (Christophe
  1932. Merlet)</li>
  1933. <li>removal of all stderr/perror use for error reporting</li>
  1934. <li>Better error reporting: XPath and DTD validation</li>
  1935. <li>update of the trio portability layer (Bjorn Reese)</li>
  1936. </ul>
  1937. <p><strong>2.4.24: Aug 22 2002</strong></p>
  1938. <ul>
  1939. <li>XPath fixes (William), xf:escape-uri() (Wesley Terpstra)</li>
  1940. <li>Python binding fixes: makefiles (William), generator, rpm build, x86-64
  1941. (fcrozat)</li>
  1942. <li>HTML &lt;style&gt; and boolean attributes serializer fixes</li>
  1943. <li>C14N improvements by Aleksey</li>
  1944. <li>doc cleanups: Rick Jones</li>
  1945. <li>Windows compiler makefile updates: Igor and Elizabeth Barham</li>
  1946. <li>XInclude: implementation of fallback and xml:base fixup added</li>
  1947. </ul>
  1948. <h3>2.4.23: July 6 2002</h3>
  1949. <ul>
  1950. <li>performances patches: Peter Jacobi</li>
  1951. <li>c14n fixes, testsuite and performances: Aleksey Sanin</li>
  1952. <li>added xmlDocFormatDump: Chema Celorio</li>
  1953. <li>new tutorial: John Fleck</li>
  1954. <li>new hash functions and performances: Sander Vesik, portability fix from
  1955. Peter Jacobi</li>
  1956. <li>a number of bug fixes: XPath (William Brack, Richard Jinks), XML and
  1957. HTML parsers, ID lookup function</li>
  1958. <li>removal of all remaining sprintf: Aleksey Sanin</li>
  1959. </ul>
  1960. <h3>2.4.22: May 27 2002</h3>
  1961. <ul>
  1962. <li>a number of bug fixes: configure scripts, base handling, parser, memory
  1963. usage, HTML parser, XPath, documentation (Christian Cornelssen),
  1964. indentation, URI parsing</li>
  1965. <li>Optimizations for XMLSec, fixing and making public some of the network
  1966. protocol handlers (Aleksey)</li>
  1967. <li>performance patch from Gary Pennington</li>
  1968. <li>Charles Bozeman provided date and time support for XML Schemas
  1969. datatypes</li>
  1970. </ul>
  1971. <h3>2.4.21: Apr 29 2002</h3>
  1972. <p>This release is both a bug fix release and also contains the early XML
  1973. Schemas <a href="http://www.w3.org/TR/xmlschema-1/">structures</a> and <a
  1974. href="http://www.w3.org/TR/xmlschema-2/">datatypes</a> code, beware, all
  1975. interfaces are likely to change, there is huge holes, it is clearly a work in
  1976. progress and don't even think of putting this code in a production system,
  1977. it's actually not compiled in by default. The real fixes are:</p>
  1978. <ul>
  1979. <li>a couple of bugs or limitations introduced in 2.4.20</li>
  1980. <li>patches for Borland C++ and MSC by Igor</li>
  1981. <li>some fixes on XPath strings and conformance patches by Richard
  1982. Jinks</li>
  1983. <li>patch from Aleksey for the ExcC14N specification</li>
  1984. <li>OSF/1 bug fix by Bjorn</li>
  1985. </ul>
  1986. <h3>2.4.20: Apr 15 2002</h3>
  1987. <ul>
  1988. <li>bug fixes: file descriptor leak, XPath, HTML output, DTD validation</li>
  1989. <li>XPath conformance testing by Richard Jinks</li>
  1990. <li>Portability fixes: Solaris, MPE/iX, Windows, OSF/1, python bindings,
  1991. libxml.m4</li>
  1992. </ul>
  1993. <h3>2.4.19: Mar 25 2002</h3>
  1994. <ul>
  1995. <li>bug fixes: half a dozen XPath bugs, Validation, ISO-Latin to UTF8
  1996. encoder</li>
  1997. <li>portability fixes in the HTTP code</li>
  1998. <li>memory allocation checks using valgrind, and profiling tests</li>
  1999. <li>revamp of the Windows build and Makefiles</li>
  2000. </ul>
  2001. <h3>2.4.18: Mar 18 2002</h3>
  2002. <ul>
  2003. <li>bug fixes: tree, SAX, canonicalization, validation, portability,
  2004. XPath</li>
  2005. <li>removed the --with-buffer option it was becoming unmaintainable</li>
  2006. <li>serious cleanup of the Python makefiles</li>
  2007. <li>speedup patch to XPath very effective for DocBook stylesheets</li>
  2008. <li>Fixes for Windows build, cleanup of the documentation</li>
  2009. </ul>
  2010. <h3>2.4.17: Mar 8 2002</h3>
  2011. <ul>
  2012. <li>a lot of bug fixes, including "namespace nodes have no parents in
  2013. XPath"</li>
  2014. <li>fixed/improved the Python wrappers, added more examples and more
  2015. regression tests, XPath extension functions can now return node-sets</li>
  2016. <li>added the XML Canonicalization support from Aleksey Sanin</li>
  2017. </ul>
  2018. <h3>2.4.16: Feb 20 2002</h3>
  2019. <ul>
  2020. <li>a lot of bug fixes, most of them were triggered by the XML Testsuite
  2021. from OASIS and W3C. Compliance has been significantly improved.</li>
  2022. <li>a couple of portability fixes too.</li>
  2023. </ul>
  2024. <h3>2.4.15: Feb 11 2002</h3>
  2025. <ul>
  2026. <li>Fixed the Makefiles, especially the python module ones</li>
  2027. <li>A few bug fixes and cleanup</li>
  2028. <li>Includes cleanup</li>
  2029. </ul>
  2030. <h3>2.4.14: Feb 8 2002</h3>
  2031. <ul>
  2032. <li>Change of License to the <a
  2033. href="http://www.opensource.org/licenses/mit-license.html">MIT
  2034. License</a> basically for integration in XFree86 codebase, and removing
  2035. confusion around the previous dual-licensing</li>
  2036. <li>added Python bindings, beta software but should already be quite
  2037. complete</li>
  2038. <li>a large number of fixes and cleanups, especially for all tree
  2039. manipulations</li>
  2040. <li>cleanup of the headers, generation of a reference API definition in
  2041. XML</li>
  2042. </ul>
  2043. <h3>2.4.13: Jan 14 2002</h3>
  2044. <ul>
  2045. <li>update of the documentation: John Fleck and Charlie Bozeman</li>
  2046. <li>cleanup of timing code from Justin Fletcher</li>
  2047. <li>fixes for Windows and initial thread support on Win32: Igor and Serguei
  2048. Narojnyi</li>
  2049. <li>Cygwin patch from Robert Collins</li>
  2050. <li>added xmlSetEntityReferenceFunc() for Keith Isdale work on xsldbg</li>
  2051. </ul>
  2052. <h3>2.4.12: Dec 7 2001</h3>
  2053. <ul>
  2054. <li>a few bug fixes: thread (Gary Pennington), xmllint (Geert Kloosterman),
  2055. XML parser (Robin Berjon), XPointer (Danny Jamshy), I/O cleanups
  2056. (robert)</li>
  2057. <li>Eric Lavigne contributed project files for MacOS</li>
  2058. <li>some makefiles cleanups</li>
  2059. </ul>
  2060. <h3>2.4.11: Nov 26 2001</h3>
  2061. <ul>
  2062. <li>fixed a couple of errors in the includes, fixed a few bugs, some code
  2063. cleanups</li>
  2064. <li>xmllint man pages improvement by Heiko Rupp</li>
  2065. <li>updated VMS build instructions from John A Fotheringham</li>
  2066. <li>Windows Makefiles updates from Igor</li>
  2067. </ul>
  2068. <h3>2.4.10: Nov 10 2001</h3>
  2069. <ul>
  2070. <li>URI escaping fix (Joel Young)</li>
  2071. <li>added xmlGetNodePath() (for paths or XPointers generation)</li>
  2072. <li>Fixes namespace handling problems when using DTD and validation</li>
  2073. <li>improvements on xmllint: Morus Walter patches for --format and
  2074. --encode, Stefan Kost and Heiko Rupp improvements on the --shell</li>
  2075. <li>fixes for xmlcatalog linking pointed by Weiqi Gao</li>
  2076. <li>fixes to the HTML parser</li>
  2077. </ul>
  2078. <h3>2.4.9: Nov 6 2001</h3>
  2079. <ul>
  2080. <li>fixes more catalog bugs</li>
  2081. <li>avoid a compilation problem, improve xmlGetLineNo()</li>
  2082. </ul>
  2083. <h3>2.4.8: Nov 4 2001</h3>
  2084. <ul>
  2085. <li>fixed SGML catalogs broken in previous release, updated xmlcatalog
  2086. tool</li>
  2087. <li>fixed a compile errors and some includes troubles.</li>
  2088. </ul>
  2089. <h3>2.4.7: Oct 30 2001</h3>
  2090. <ul>
  2091. <li>exported some debugging interfaces</li>
  2092. <li>serious rewrite of the catalog code</li>
  2093. <li>integrated Gary Pennington thread safety patch, added configure option
  2094. and regression tests</li>
  2095. <li>removed an HTML parser bug</li>
  2096. <li>fixed a couple of potentially serious validation bugs</li>
  2097. <li>integrated the SGML DocBook support in xmllint</li>
  2098. <li>changed the nanoftp anonymous login passwd</li>
  2099. <li>some I/O cleanup and a couple of interfaces for Perl wrapper</li>
  2100. <li>general bug fixes</li>
  2101. <li>updated xmllint man page by John Fleck</li>
  2102. <li>some VMS and Windows updates</li>
  2103. </ul>
  2104. <h3>2.4.6: Oct 10 2001</h3>
  2105. <ul>
  2106. <li>added an updated man pages by John Fleck</li>
  2107. <li>portability and configure fixes</li>
  2108. <li>an infinite loop on the HTML parser was removed (William)</li>
  2109. <li>Windows makefile patches from Igor</li>
  2110. <li>fixed half a dozen bugs reported for libxml or libxslt</li>
  2111. <li>updated xmlcatalog to be able to modify SGML super catalogs</li>
  2112. </ul>
  2113. <h3>2.4.5: Sep 14 2001</h3>
  2114. <ul>
  2115. <li>Remove a few annoying bugs in 2.4.4</li>
  2116. <li>forces the HTML serializer to output decimal charrefs since some
  2117. version of Netscape can't handle hexadecimal ones</li>
  2118. </ul>
  2119. <h3>1.8.16: Sep 14 2001</h3>
  2120. <ul>
  2121. <li>maintenance release of the old libxml1 branch, couple of bug and
  2122. portability fixes</li>
  2123. </ul>
  2124. <h3>2.4.4: Sep 12 2001</h3>
  2125. <ul>
  2126. <li>added --convert to xmlcatalog, bug fixes and cleanups of XML
  2127. Catalog</li>
  2128. <li>a few bug fixes and some portability changes</li>
  2129. <li>some documentation cleanups</li>
  2130. </ul>
  2131. <h3>2.4.3: Aug 23 2001</h3>
  2132. <ul>
  2133. <li>XML Catalog support see the doc</li>
  2134. <li>New NaN/Infinity floating point code</li>
  2135. <li>A few bug fixes</li>
  2136. </ul>
  2137. <h3>2.4.2: Aug 15 2001</h3>
  2138. <ul>
  2139. <li>adds xmlLineNumbersDefault() to control line number generation</li>
  2140. <li>lot of bug fixes</li>
  2141. <li>the Microsoft MSC projects files should now be up to date</li>
  2142. <li>inheritance of namespaces from DTD defaulted attributes</li>
  2143. <li>fixes a serious potential security bug</li>
  2144. <li>added a --format option to xmllint</li>
  2145. </ul>
  2146. <h3>2.4.1: July 24 2001</h3>
  2147. <ul>
  2148. <li>possibility to keep line numbers in the tree</li>
  2149. <li>some computation NaN fixes</li>
  2150. <li>extension of the XPath API</li>
  2151. <li>cleanup for alpha and ia64 targets</li>
  2152. <li>patch to allow saving through HTTP PUT or POST</li>
  2153. </ul>
  2154. <h3>2.4.0: July 10 2001</h3>
  2155. <ul>
  2156. <li>Fixed a few bugs in XPath, validation, and tree handling.</li>
  2157. <li>Fixed XML Base implementation, added a couple of examples to the
  2158. regression tests</li>
  2159. <li>A bit of cleanup</li>
  2160. </ul>
  2161. <h3>2.3.14: July 5 2001</h3>
  2162. <ul>
  2163. <li>fixed some entities problems and reduce memory requirement when
  2164. substituting them</li>
  2165. <li>lots of improvements in the XPath queries interpreter can be
  2166. substantially faster</li>
  2167. <li>Makefiles and configure cleanups</li>
  2168. <li>Fixes to XPath variable eval, and compare on empty node set</li>
  2169. <li>HTML tag closing bug fixed</li>
  2170. <li>Fixed an URI reference computation problem when validating</li>
  2171. </ul>
  2172. <h3>2.3.13: June 28 2001</h3>
  2173. <ul>
  2174. <li>2.3.12 configure.in was broken as well as the push mode XML parser</li>
  2175. <li>a few more fixes for compilation on Windows MSC by Yon Derek</li>
  2176. </ul>
  2177. <h3>1.8.14: June 28 2001</h3>
  2178. <ul>
  2179. <li>Zbigniew Chyla gave a patch to use the old XML parser in push mode</li>
  2180. <li>Small Makefile fix</li>
  2181. </ul>
  2182. <h3>2.3.12: June 26 2001</h3>
  2183. <ul>
  2184. <li>lots of cleanup</li>
  2185. <li>a couple of validation fix</li>
  2186. <li>fixed line number counting</li>
  2187. <li>fixed serious problems in the XInclude processing</li>
  2188. <li>added support for UTF8 BOM at beginning of entities</li>
  2189. <li>fixed a strange gcc optimizer bugs in xpath handling of float, gcc-3.0
  2190. miscompile uri.c (William), Thomas Leitner provided a fix for the
  2191. optimizer on Tru64</li>
  2192. <li>incorporated Yon Derek and Igor Zlatkovic fixes and improvements for
  2193. compilation on Windows MSC</li>
  2194. <li>update of libxml-doc.el (Felix Natter)</li>
  2195. <li>fixed 2 bugs in URI normalization code</li>
  2196. </ul>
  2197. <h3>2.3.11: June 17 2001</h3>
  2198. <ul>
  2199. <li>updates to trio, Makefiles and configure should fix some portability
  2200. problems (alpha)</li>
  2201. <li>fixed some HTML serialization problems (pre, script, and block/inline
  2202. handling), added encoding aware APIs, cleanup of this code</li>
  2203. <li>added xmlHasNsProp()</li>
  2204. <li>implemented a specific PI for encoding support in the DocBook SGML
  2205. parser</li>
  2206. <li>some XPath fixes (-Infinity, / as a function parameter and namespaces
  2207. node selection)</li>
  2208. <li>fixed a performance problem and an error in the validation code</li>
  2209. <li>fixed XInclude routine to implement the recursive behaviour</li>
  2210. <li>fixed xmlFreeNode problem when libxml is included statically twice</li>
  2211. <li>added --version to xmllint for bug reports</li>
  2212. </ul>
  2213. <h3>2.3.10: June 1 2001</h3>
  2214. <ul>
  2215. <li>fixed the SGML catalog support</li>
  2216. <li>a number of reported bugs got fixed, in XPath, iconv detection,
  2217. XInclude processing</li>
  2218. <li>XPath string function should now handle unicode correctly</li>
  2219. </ul>
  2220. <h3>2.3.9: May 19 2001</h3>
  2221. <p>Lots of bugfixes, and added a basic SGML catalog support:</p>
  2222. <ul>
  2223. <li>HTML push bugfix #54891 and another patch from Jonas Borgström</li>
  2224. <li>some serious speed optimization again</li>
  2225. <li>some documentation cleanups</li>
  2226. <li>trying to get better linking on Solaris (-R)</li>
  2227. <li>XPath API cleanup from Thomas Broyer</li>
  2228. <li>Validation bug fixed #54631, added a patch from Gary Pennington, fixed
  2229. xmlValidGetValidElements()</li>
  2230. <li>Added an INSTALL file</li>
  2231. <li>Attribute removal added to API: #54433</li>
  2232. <li>added a basic support for SGML catalogs</li>
  2233. <li>fixed xmlKeepBlanksDefault(0) API</li>
  2234. <li>bugfix in xmlNodeGetLang()</li>
  2235. <li>fixed a small configure portability problem</li>
  2236. <li>fixed an inversion of SYSTEM and PUBLIC identifier in HTML document</li>
  2237. </ul>
  2238. <h3>1.8.13: May 14 2001</h3>
  2239. <ul>
  2240. <li>bugfixes release of the old libxml1 branch used by Gnome</li>
  2241. </ul>
  2242. <h3>2.3.8: May 3 2001</h3>
  2243. <ul>
  2244. <li>Integrated an SGML DocBook parser for the Gnome project</li>
  2245. <li>Fixed a few things in the HTML parser</li>
  2246. <li>Fixed some XPath bugs raised by XSLT use, tried to fix the floating
  2247. point portability issue</li>
  2248. <li>Speed improvement (8M/s for SAX, 3M/s for DOM, 1.5M/s for
  2249. DOM+validation using the XML REC as input and a 700MHz celeron).</li>
  2250. <li>incorporated more Windows cleanup</li>
  2251. <li>added xmlSaveFormatFile()</li>
  2252. <li>fixed problems in copying nodes with entities references (gdome)</li>
  2253. <li>removed some troubles surrounding the new validation module</li>
  2254. </ul>
  2255. <h3>2.3.7: April 22 2001</h3>
  2256. <ul>
  2257. <li>lots of small bug fixes, corrected XPointer</li>
  2258. <li>Non deterministic content model validation support</li>
  2259. <li>added xmlDocCopyNode for gdome2</li>
  2260. <li>revamped the way the HTML parser handles end of tags</li>
  2261. <li>XPath: corrections of namespaces support and number formatting</li>
  2262. <li>Windows: Igor Zlatkovic patches for MSC compilation</li>
  2263. <li>HTML output fixes from P C Chow and William M. Brack</li>
  2264. <li>Improved validation speed sensible for DocBook</li>
  2265. <li>fixed a big bug with ID declared in external parsed entities</li>
  2266. <li>portability fixes, update of Trio from Bjorn Reese</li>
  2267. </ul>
  2268. <h3>2.3.6: April 8 2001</h3>
  2269. <ul>
  2270. <li>Code cleanup using extreme gcc compiler warning options, found and
  2271. cleared half a dozen potential problem</li>
  2272. <li>the Eazel team found an XML parser bug</li>
  2273. <li>cleaned up the user of some of the string formatting function. used the
  2274. trio library code to provide the one needed when the platform is missing
  2275. them</li>
  2276. <li>xpath: removed a memory leak and fixed the predicate evaluation
  2277. problem, extended the testsuite and cleaned up the result. XPointer seems
  2278. broken ...</li>
  2279. </ul>
  2280. <h3>2.3.5: Mar 23 2001</h3>
  2281. <ul>
  2282. <li>Biggest change is separate parsing and evaluation of XPath expressions,
  2283. there is some new APIs for this too</li>
  2284. <li>included a number of bug fixes(XML push parser, 51876, notations,
  2285. 52299)</li>
  2286. <li>Fixed some portability issues</li>
  2287. </ul>
  2288. <h3>2.3.4: Mar 10 2001</h3>
  2289. <ul>
  2290. <li>Fixed bugs #51860 and #51861</li>
  2291. <li>Added a global variable xmlDefaultBufferSize to allow default buffer
  2292. size to be application tunable.</li>
  2293. <li>Some cleanup in the validation code, still a bug left and this part
  2294. should probably be rewritten to support ambiguous content model :-\</li>
  2295. <li>Fix a couple of serious bugs introduced or raised by changes in 2.3.3
  2296. parser</li>
  2297. <li>Fixed another bug in xmlNodeGetContent()</li>
  2298. <li>Bjorn fixed XPath node collection and Number formatting</li>
  2299. <li>Fixed a loop reported in the HTML parsing</li>
  2300. <li>blank space are reported even if the Dtd content model proves that they
  2301. are formatting spaces, this is for XML conformance</li>
  2302. </ul>
  2303. <h3>2.3.3: Mar 1 2001</h3>
  2304. <ul>
  2305. <li>small change in XPath for XSLT</li>
  2306. <li>documentation cleanups</li>
  2307. <li>fix in validation by Gary Pennington</li>
  2308. <li>serious parsing performances improvements</li>
  2309. </ul>
  2310. <h3>2.3.2: Feb 24 2001</h3>
  2311. <ul>
  2312. <li>chasing XPath bugs, found a bunch, completed some TODO</li>
  2313. <li>fixed a Dtd parsing bug</li>
  2314. <li>fixed a bug in xmlNodeGetContent</li>
  2315. <li>ID/IDREF support partly rewritten by Gary Pennington</li>
  2316. </ul>
  2317. <h3>2.3.1: Feb 15 2001</h3>
  2318. <ul>
  2319. <li>some XPath and HTML bug fixes for XSLT</li>
  2320. <li>small extension of the hash table interfaces for DOM gdome2
  2321. implementation</li>
  2322. <li>A few bug fixes</li>
  2323. </ul>
  2324. <h3>2.3.0: Feb 8 2001 (2.2.12 was on 25 Jan but I didn't kept track)</h3>
  2325. <ul>
  2326. <li>Lots of XPath bug fixes</li>
  2327. <li>Add a mode with Dtd lookup but without validation error reporting for
  2328. XSLT</li>
  2329. <li>Add support for text node without escaping (XSLT)</li>
  2330. <li>bug fixes for xmlCheckFilename</li>
  2331. <li>validation code bug fixes from Gary Pennington</li>
  2332. <li>Patch from Paul D. Smith correcting URI path normalization</li>
  2333. <li>Patch to allow simultaneous install of libxml-devel and
  2334. libxml2-devel</li>
  2335. <li>the example Makefile is now fixed</li>
  2336. <li>added HTML to the RPM packages</li>
  2337. <li>tree copying bugfixes</li>
  2338. <li>updates to Windows makefiles</li>
  2339. <li>optimization patch from Bjorn Reese</li>
  2340. </ul>
  2341. <h3>2.2.11: Jan 4 2001</h3>
  2342. <ul>
  2343. <li>bunch of bug fixes (memory I/O, xpath, ftp/http, ...)</li>
  2344. <li>added htmlHandleOmittedElem()</li>
  2345. <li>Applied Bjorn Reese's IPV6 first patch</li>
  2346. <li>Applied Paul D. Smith patches for validation of XInclude results</li>
  2347. <li>added XPointer xmlns() new scheme support</li>
  2348. </ul>
  2349. <h3>2.2.10: Nov 25 2000</h3>
  2350. <ul>
  2351. <li>Fix the Windows problems of 2.2.8</li>
  2352. <li>integrate OpenVMS patches</li>
  2353. <li>better handling of some nasty HTML input</li>
  2354. <li>Improved the XPointer implementation</li>
  2355. <li>integrate a number of provided patches</li>
  2356. </ul>
  2357. <h3>2.2.9: Nov 25 2000</h3>
  2358. <ul>
  2359. <li>erroneous release :-(</li>
  2360. </ul>
  2361. <h3>2.2.8: Nov 13 2000</h3>
  2362. <ul>
  2363. <li>First version of <a href="http://www.w3.org/TR/xinclude">XInclude</a>
  2364. support</li>
  2365. <li>Patch in conditional section handling</li>
  2366. <li>updated MS compiler project</li>
  2367. <li>fixed some XPath problems</li>
  2368. <li>added an URI escaping function</li>
  2369. <li>some other bug fixes</li>
  2370. </ul>
  2371. <h3>2.2.7: Oct 31 2000</h3>
  2372. <ul>
  2373. <li>added message redirection</li>
  2374. <li>XPath improvements (thanks TOM !)</li>
  2375. <li>xmlIOParseDTD() added</li>
  2376. <li>various small fixes in the HTML, URI, HTTP and XPointer support</li>
  2377. <li>some cleanup of the Makefile, autoconf and the distribution content</li>
  2378. </ul>
  2379. <h3>2.2.6: Oct 25 2000:</h3>
  2380. <ul>
  2381. <li>Added an hash table module, migrated a number of internal structure to
  2382. those</li>
  2383. <li>Fixed a posteriori validation problems</li>
  2384. <li>HTTP module cleanups</li>
  2385. <li>HTML parser improvements (tag errors, script/style handling, attribute
  2386. normalization)</li>
  2387. <li>coalescing of adjacent text nodes</li>
  2388. <li>couple of XPath bug fixes, exported the internal API</li>
  2389. </ul>
  2390. <h3>2.2.5: Oct 15 2000:</h3>
  2391. <ul>
  2392. <li>XPointer implementation and testsuite</li>
  2393. <li>Lot of XPath fixes, added variable and functions registration, more
  2394. tests</li>
  2395. <li>Portability fixes, lots of enhancements toward an easy Windows build
  2396. and release</li>
  2397. <li>Late validation fixes</li>
  2398. <li>Integrated a lot of contributed patches</li>
  2399. <li>added memory management docs</li>
  2400. <li>a performance problem when using large buffer seems fixed</li>
  2401. </ul>
  2402. <h3>2.2.4: Oct 1 2000:</h3>
  2403. <ul>
  2404. <li>main XPath problem fixed</li>
  2405. <li>Integrated portability patches for Windows</li>
  2406. <li>Serious bug fixes on the URI and HTML code</li>
  2407. </ul>
  2408. <h3>2.2.3: Sep 17 2000</h3>
  2409. <ul>
  2410. <li>bug fixes</li>
  2411. <li>cleanup of entity handling code</li>
  2412. <li>overall review of all loops in the parsers, all sprintf usage has been
  2413. checked too</li>
  2414. <li>Far better handling of larges Dtd. Validating against DocBook XML Dtd
  2415. works smoothly now.</li>
  2416. </ul>
  2417. <h3>1.8.10: Sep 6 2000</h3>
  2418. <ul>
  2419. <li>bug fix release for some Gnome projects</li>
  2420. </ul>
  2421. <h3>2.2.2: August 12 2000</h3>
  2422. <ul>
  2423. <li>mostly bug fixes</li>
  2424. <li>started adding routines to access xml parser context options</li>
  2425. </ul>
  2426. <h3>2.2.1: July 21 2000</h3>
  2427. <ul>
  2428. <li>a purely bug fixes release</li>
  2429. <li>fixed an encoding support problem when parsing from a memory block</li>
  2430. <li>fixed a DOCTYPE parsing problem</li>
  2431. <li>removed a bug in the function allowing to override the memory
  2432. allocation routines</li>
  2433. </ul>
  2434. <h3>2.2.0: July 14 2000</h3>
  2435. <ul>
  2436. <li>applied a lot of portability fixes</li>
  2437. <li>better encoding support/cleanup and saving (content is now always
  2438. encoded in UTF-8)</li>
  2439. <li>the HTML parser now correctly handles encodings</li>
  2440. <li>added xmlHasProp()</li>
  2441. <li>fixed a serious problem with &amp;#38;</li>
  2442. <li>propagated the fix to FTP client</li>
  2443. <li>cleanup, bugfixes, etc ...</li>
  2444. <li>Added a page about <a href="encoding.html">libxml Internationalization
  2445. support</a></li>
  2446. </ul>
  2447. <h3>1.8.9: July 9 2000</h3>
  2448. <ul>
  2449. <li>fixed the spec the RPMs should be better</li>
  2450. <li>fixed a serious bug in the FTP implementation, released 1.8.9 to solve
  2451. rpmfind users problem</li>
  2452. </ul>
  2453. <h3>2.1.1: July 1 2000</h3>
  2454. <ul>
  2455. <li>fixes a couple of bugs in the 2.1.0 packaging</li>
  2456. <li>improvements on the HTML parser</li>
  2457. </ul>
  2458. <h3>2.1.0 and 1.8.8: June 29 2000</h3>
  2459. <ul>
  2460. <li>1.8.8 is mostly a commodity package for upgrading to libxml2 according
  2461. to <a href="upgrade.html">new instructions</a>. It fixes a nasty problem
  2462. about &amp;#38; charref parsing</li>
  2463. <li>2.1.0 also ease the upgrade from libxml v1 to the recent version. it
  2464. also contains numerous fixes and enhancements:
  2465. <ul>
  2466. <li>added xmlStopParser() to stop parsing</li>
  2467. <li>improved a lot parsing speed when there is large CDATA blocs</li>
  2468. <li>includes XPath patches provided by Picdar Technology</li>
  2469. <li>tried to fix as much as possible DTD validation and namespace
  2470. related problems</li>
  2471. <li>output to a given encoding has been added/tested</li>
  2472. <li>lot of various fixes</li>
  2473. </ul>
  2474. </li>
  2475. </ul>
  2476. <h3>2.0.0: Apr 12 2000</h3>
  2477. <ul>
  2478. <li>First public release of libxml2. If you are using libxml, it's a good
  2479. idea to check the 1.x to 2.x upgrade instructions. NOTE: while initially
  2480. scheduled for Apr 3 the release occurred only on Apr 12 due to massive
  2481. workload.</li>
  2482. <li>The include are now located under $prefix/include/libxml (instead of
  2483. $prefix/include/gnome-xml), they also are referenced by
  2484. <pre>#include &lt;libxml/xxx.h&gt;</pre>
  2485. <p>instead of</p>
  2486. <pre>#include "xxx.h"</pre>
  2487. </li>
  2488. <li>a new URI module for parsing URIs and following strictly RFC 2396</li>
  2489. <li>the memory allocation routines used by libxml can now be overloaded
  2490. dynamically by using xmlMemSetup()</li>
  2491. <li>The previously CVS only tool tester has been renamed
  2492. <strong>xmllint</strong> and is now installed as part of the libxml2
  2493. package</li>
  2494. <li>The I/O interface has been revamped. There is now ways to plug in
  2495. specific I/O modules, either at the URI scheme detection level using
  2496. xmlRegisterInputCallbacks() or by passing I/O functions when creating a
  2497. parser context using xmlCreateIOParserCtxt()</li>
  2498. <li>there is a C preprocessor macro LIBXML_VERSION providing the version
  2499. number of the libxml module in use</li>
  2500. <li>a number of optional features of libxml can now be excluded at
  2501. configure time (FTP/HTTP/HTML/XPath/Debug)</li>
  2502. </ul>
  2503. <h3>2.0.0beta: Mar 14 2000</h3>
  2504. <ul>
  2505. <li>This is a first Beta release of libxml version 2</li>
  2506. <li>It's available only from<a href="ftp://xmlsoft.org/libxml2/">xmlsoft.org
  2507. FTP</a>, it's packaged as libxml2-2.0.0beta and available as tar and
  2508. RPMs</li>
  2509. <li>This version is now the head in the Gnome CVS base, the old one is
  2510. available under the tag LIB_XML_1_X</li>
  2511. <li>This includes a very large set of changes. From a programmatic point
  2512. of view applications should not have to be modified too much, check the
  2513. <a href="upgrade.html">upgrade page</a></li>
  2514. <li>Some interfaces may changes (especially a bit about encoding).</li>
  2515. <li>the updates includes:
  2516. <ul>
  2517. <li>fix I18N support. ISO-Latin-x/UTF-8/UTF-16 (nearly) seems correctly
  2518. handled now</li>
  2519. <li>Better handling of entities, especially well-formedness checking
  2520. and proper PEref extensions in external subsets</li>
  2521. <li>DTD conditional sections</li>
  2522. <li>Validation now correctly handle entities content</li>
  2523. <li><a href="http://rpmfind.net/tools/gdome/messages/0039.html">change
  2524. structures to accommodate DOM</a></li>
  2525. </ul>
  2526. </li>
  2527. <li>Serious progress were made toward compliance, <a
  2528. href="conf/result.html">here are the result of the test</a> against the
  2529. OASIS testsuite (except the Japanese tests since I don't support that
  2530. encoding yet). This URL is rebuilt every couple of hours using the CVS
  2531. head version.</li>
  2532. </ul>
  2533. <h3>1.8.7: Mar 6 2000</h3>
  2534. <ul>
  2535. <li>This is a bug fix release:</li>
  2536. <li>It is possible to disable the ignorable blanks heuristic used by
  2537. libxml-1.x, a new function xmlKeepBlanksDefault(0) will allow this. Note
  2538. that for adherence to XML spec, this behaviour will be disabled by
  2539. default in 2.x . The same function will allow to keep compatibility for
  2540. old code.</li>
  2541. <li>Blanks in &lt;a&gt; &lt;/a&gt; constructs are not ignored anymore,
  2542. avoiding heuristic is really the Right Way :-\</li>
  2543. <li>The unchecked use of snprintf which was breaking libxml-1.8.6
  2544. compilation on some platforms has been fixed</li>
  2545. <li>nanoftp.c nanohttp.c: Fixed '#' and '?' stripping when processing
  2546. URIs</li>
  2547. </ul>
  2548. <h3>1.8.6: Jan 31 2000</h3>
  2549. <ul>
  2550. <li>added a nanoFTP transport module, debugged until the new version of <a
  2551. href="http://rpmfind.net/linux/rpm2html/rpmfind.html">rpmfind</a> can use
  2552. it without troubles</li>
  2553. </ul>
  2554. <h3>1.8.5: Jan 21 2000</h3>
  2555. <ul>
  2556. <li>adding APIs to parse a well balanced chunk of XML (production <a
  2557. href="http://www.w3.org/TR/REC-xml#NT-content">[43] content</a> of the
  2558. XML spec)</li>
  2559. <li>fixed a hideous bug in xmlGetProp pointed by Rune.Djurhuus@fast.no</li>
  2560. <li>Jody Goldberg &lt;jgoldberg@home.com&gt; provided another patch trying
  2561. to solve the zlib checks problems</li>
  2562. <li>The current state in gnome CVS base is expected to ship as 1.8.5 with
  2563. gnumeric soon</li>
  2564. </ul>
  2565. <h3>1.8.4: Jan 13 2000</h3>
  2566. <ul>
  2567. <li>bug fixes, reintroduced xmlNewGlobalNs(), fixed xmlNewNs()</li>
  2568. <li>all exit() call should have been removed from libxml</li>
  2569. <li>fixed a problem with INCLUDE_WINSOCK on WIN32 platform</li>
  2570. <li>added newDocFragment()</li>
  2571. </ul>
  2572. <h3>1.8.3: Jan 5 2000</h3>
  2573. <ul>
  2574. <li>a Push interface for the XML and HTML parsers</li>
  2575. <li>a shell-like interface to the document tree (try tester --shell :-)</li>
  2576. <li>lots of bug fixes and improvement added over XMas holidays</li>
  2577. <li>fixed the DTD parsing code to work with the xhtml DTD</li>
  2578. <li>added xmlRemoveProp(), xmlRemoveID() and xmlRemoveRef()</li>
  2579. <li>Fixed bugs in xmlNewNs()</li>
  2580. <li>External entity loading code has been revamped, now it uses
  2581. xmlLoadExternalEntity(), some fix on entities processing were added</li>
  2582. <li>cleaned up WIN32 includes of socket stuff</li>
  2583. </ul>
  2584. <h3>1.8.2: Dec 21 1999</h3>
  2585. <ul>
  2586. <li>I got another problem with includes and C++, I hope this issue is fixed
  2587. for good this time</li>
  2588. <li>Added a few tree modification functions: xmlReplaceNode,
  2589. xmlAddPrevSibling, xmlAddNextSibling, xmlNodeSetName and
  2590. xmlDocSetRootElement</li>
  2591. <li>Tried to improve the HTML output with help from <a
  2592. href="mailto:clahey@umich.edu">Chris Lahey</a></li>
  2593. </ul>
  2594. <h3>1.8.1: Dec 18 1999</h3>
  2595. <ul>
  2596. <li>various patches to avoid troubles when using libxml with C++ compilers
  2597. the "namespace" keyword and C escaping in include files</li>
  2598. <li>a problem in one of the core macros IS_CHAR was corrected</li>
  2599. <li>fixed a bug introduced in 1.8.0 breaking default namespace processing,
  2600. and more specifically the Dia application</li>
  2601. <li>fixed a posteriori validation (validation after parsing, or by using a
  2602. Dtd not specified in the original document)</li>
  2603. <li>fixed a bug in</li>
  2604. </ul>
  2605. <h3>1.8.0: Dec 12 1999</h3>
  2606. <ul>
  2607. <li>cleanup, especially memory wise</li>
  2608. <li>the parser should be more reliable, especially the HTML one, it should
  2609. not crash, whatever the input !</li>
  2610. <li>Integrated various patches, especially a speedup improvement for large
  2611. dataset from <a href="mailto:cnygard@bellatlantic.net">Carl Nygard</a>,
  2612. configure with --with-buffers to enable them.</li>
  2613. <li>attribute normalization, oops should have been added long ago !</li>
  2614. <li>attributes defaulted from DTDs should be available, xmlSetProp() now
  2615. does entities escaping by default.</li>
  2616. </ul>
  2617. <h3>1.7.4: Oct 25 1999</h3>
  2618. <ul>
  2619. <li>Lots of HTML improvement</li>
  2620. <li>Fixed some errors when saving both XML and HTML</li>
  2621. <li>More examples, the regression tests should now look clean</li>
  2622. <li>Fixed a bug with contiguous charref</li>
  2623. </ul>
  2624. <h3>1.7.3: Sep 29 1999</h3>
  2625. <ul>
  2626. <li>portability problems fixed</li>
  2627. <li>snprintf was used unconditionally, leading to link problems on system
  2628. were it's not available, fixed</li>
  2629. </ul>
  2630. <h3>1.7.1: Sep 24 1999</h3>
  2631. <ul>
  2632. <li>The basic type for strings manipulated by libxml has been renamed in
  2633. 1.7.1 from <strong>CHAR</strong> to <strong>xmlChar</strong>. The reason
  2634. is that CHAR was conflicting with a predefined type on Windows. However
  2635. on non WIN32 environment, compatibility is provided by the way of a
  2636. <strong>#define </strong>.</li>
  2637. <li>Changed another error : the use of a structure field called errno, and
  2638. leading to troubles on platforms where it's a macro</li>
  2639. </ul>
  2640. <h3>1.7.0: Sep 23 1999</h3>
  2641. <ul>
  2642. <li>Added the ability to fetch remote DTD or parsed entities, see the <a
  2643. href="html/libxml-nanohttp.html">nanohttp</a> module.</li>
  2644. <li>Added an errno to report errors by another mean than a simple printf
  2645. like callback</li>
  2646. <li>Finished ID/IDREF support and checking when validation</li>
  2647. <li>Serious memory leaks fixed (there is now a <a
  2648. href="html/libxml-xmlmemory.html">memory wrapper</a> module)</li>
  2649. <li>Improvement of <a href="http://www.w3.org/TR/xpath">XPath</a>
  2650. implementation</li>
  2651. <li>Added an HTML parser front-end</li>
  2652. </ul>
  2653. <h2><a name="XML">XML</a></h2>
  2654. <p><a href="http://www.w3.org/TR/REC-xml">XML is a standard</a> for
  2655. markup-based structured documents. Here is <a name="example">an example XML
  2656. document</a>:</p>
  2657. <pre>&lt;?xml version="1.0"?&gt;
  2658. &lt;EXAMPLE prop1="gnome is great" prop2="&amp;amp; linux too"&gt;
  2659. &lt;head&gt;
  2660. &lt;title&gt;Welcome to Gnome&lt;/title&gt;
  2661. &lt;/head&gt;
  2662. &lt;chapter&gt;
  2663. &lt;title&gt;The Linux adventure&lt;/title&gt;
  2664. &lt;p&gt;bla bla bla ...&lt;/p&gt;
  2665. &lt;image href="linus.gif"/&gt;
  2666. &lt;p&gt;...&lt;/p&gt;
  2667. &lt;/chapter&gt;
  2668. &lt;/EXAMPLE&gt;</pre>
  2669. <p>The first line specifies that it is an XML document and gives useful
  2670. information about its encoding. Then the rest of the document is a text
  2671. format whose structure is specified by tags between brackets. <strong>Each
  2672. tag opened has to be closed</strong>. XML is pedantic about this. However, if
  2673. a tag is empty (no content), a single tag can serve as both the opening and
  2674. closing tag if it ends with <code>/&gt;</code> rather than with
  2675. <code>&gt;</code>. Note that, for example, the image tag has no content (just
  2676. an attribute) and is closed by ending the tag with <code>/&gt;</code>.</p>
  2677. <p>XML can be applied successfully to a wide range of tasks, ranging from
  2678. long term structured document maintenance (where it follows the steps of
  2679. SGML) to simple data encoding mechanisms like configuration file formatting
  2680. (glade), spreadsheets (gnumeric), or even shorter lived documents such as
  2681. WebDAV where it is used to encode remote calls between a client and a
  2682. server.</p>
  2683. <h2><a name="XSLT">XSLT</a></h2>
  2684. <p>Check <a href="http://xmlsoft.org/XSLT">the separate libxslt page</a></p>
  2685. <p><a href="http://www.w3.org/TR/xslt">XSL Transformations</a>, is a
  2686. language for transforming XML documents into other XML documents (or
  2687. HTML/textual output).</p>
  2688. <p>A separate library called libxslt is available implementing XSLT-1.0 for
  2689. libxml2. This module "libxslt" too can be found in the Gnome SVN base.</p>
  2690. <p>You can check the progresses on the libxslt <a
  2691. href="http://xmlsoft.org/XSLT/ChangeLog.html">Changelog</a>.</p>
  2692. <h2><a name="Python">Python and bindings</a></h2>
  2693. <p>There are a number of language bindings and wrappers available for
  2694. libxml2, the list below is not exhaustive. Please contact the <a
  2695. href="http://mail.gnome.org/mailman/listinfo/xml-bindings">xml-bindings@gnome.org</a>
  2696. (<a href="http://mail.gnome.org/archives/xml-bindings/">archives</a>) in
  2697. order to get updates to this list or to discuss the specific topic of libxml2
  2698. or libxslt wrappers or bindings:</p>
  2699. <ul>
  2700. <li><a href="http://libxmlplusplus.sourceforge.net/">Libxml++</a> seems the
  2701. most up-to-date C++ bindings for libxml2, check the <a
  2702. href="http://libxmlplusplus.sourceforge.net/reference/html/hierarchy.html">documentation</a>
  2703. and the <a
  2704. href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/libxmlplusplus/libxml%2b%2b/examples/">examples</a>.</li>
  2705. <li>There is another <a href="http://libgdome-cpp.berlios.de/">C++ wrapper
  2706. based on the gdome2 bindings</a> maintained by Tobias Peters.</li>
  2707. <li>and a third C++ wrapper by Peter Jones &lt;pjones@pmade.org&gt;
  2708. <p>Website: <a
  2709. href="http://pmade.org/pjones/software/xmlwrapp/">http://pmade.org/pjones/software/xmlwrapp/</a></p>
  2710. </li>
  2711. <li>XML::LibXML <a href="http://cpan.uwinnipeg.ca/dist/XML-LibXML">Perl
  2712. bindings</a> are available on CPAN, as well as XML::LibXSLT
  2713. <a href="http://cpan.uwinnipeg.ca/dist/XML-LibXSLT">Perl libxslt
  2714. bindings</a>.</li>
  2715. <li>If you're interested into scripting XML processing, have a look at <a
  2716. href="http://xsh.sourceforge.net/">XSH</a> an XML editing shell based on
  2717. Libxml2 Perl bindings.</li>
  2718. <li><a href="mailto:dkuhlman@cutter.rexx.com">Dave Kuhlman</a> provides an
  2719. earlier version of the libxml/libxslt <a
  2720. href="http://www.rexx.com/~dkuhlman">wrappers for Python</a>.</li>
  2721. <li>Gopal.V and Peter Minten develop <a
  2722. href="http://savannah.gnu.org/projects/libxmlsharp">libxml#</a>, a set of
  2723. C# libxml2 bindings.</li>
  2724. <li>Petr Kozelka provides <a
  2725. href="http://sourceforge.net/projects/libxml2-pas">Pascal units to glue
  2726. libxml2</a> with Kylix, Delphi and other Pascal compilers.</li>
  2727. <li>Uwe Fechner also provides <a
  2728. href="http://sourceforge.net/projects/idom2-pas/">idom2</a>, a DOM2
  2729. implementation for Kylix2/D5/D6 from Borland.</li>
  2730. <li>There is <a href="http://libxml.rubyforge.org/">bindings for Ruby</a>
  2731. and libxml2 bindings are also available in Ruby through the <a
  2732. href="http://libgdome-ruby.berlios.de/">libgdome-ruby</a> module
  2733. maintained by Tobias Peters.</li>
  2734. <li>Steve Ball and contributors maintains <a
  2735. href="http://tclxml.sourceforge.net/">libxml2 and libxslt bindings for
  2736. Tcl</a>.</li>
  2737. <li>libxml2 and libxslt are the default XML libraries for PHP5.</li>
  2738. <li><a href="http://savannah.gnu.org/projects/classpathx/">LibxmlJ</a> is
  2739. an effort to create a 100% JAXP-compatible Java wrapper for libxml2 and
  2740. libxslt as part of GNU ClasspathX project.</li>
  2741. <li>Patrick McPhee provides Rexx bindings fof libxml2 and libxslt, look for
  2742. <a href="http://www.interlog.com/~ptjm/software.html">RexxXML</a>.</li>
  2743. <li><a
  2744. href="http://www.satimage.fr/software/en/xml_suite.html">Satimage</a>
  2745. provides <a
  2746. href="http://www.satimage.fr/software/en/downloads_osaxen.html">XMLLib
  2747. osax</a>. This is an osax for Mac OS X with a set of commands to
  2748. implement in AppleScript the XML DOM, XPATH and XSLT. Also includes
  2749. commands for Property-lists (Apple's fast lookup table XML format.)</li>
  2750. <li>Francesco Montorsi developped <a
  2751. href="https://sourceforge.net/project/showfiles.php?group_id=51305&amp;package_id=45182">wxXml2</a>
  2752. wrappers that interface libxml2, allowing wxWidgets applications to
  2753. load/save/edit XML instances.</li>
  2754. </ul>
  2755. <p>The distribution includes a set of Python bindings, which are guaranteed
  2756. to be maintained as part of the library in the future, though the Python
  2757. interface have not yet reached the completeness of the C API.</p>
  2758. <p>Note that some of the Python purist dislike the default set of Python
  2759. bindings, rather than complaining I suggest they have a look at <a
  2760. href="http://codespeak.net/lxml/">lxml the more pythonic bindings for libxml2
  2761. and libxslt</a> and <a
  2762. href="http://codespeak.net/mailman/listinfo/lxml-dev">help Martijn
  2763. Faassen</a> complete those.</p>
  2764. <p><a href="mailto:stephane.bidoul@softwareag.com">Stéphane Bidoul</a>
  2765. maintains <a href="http://users.skynet.be/sbi/libxml-python/">a Windows port
  2766. of the Python bindings</a>.</p>
  2767. <p>Note to people interested in building bindings, the API is formalized as
  2768. <a href="libxml2-api.xml">an XML API description file</a> which allows to
  2769. automate a large part of the Python bindings, this includes function
  2770. descriptions, enums, structures, typedefs, etc... The Python script used to
  2771. build the bindings is python/generator.py in the source distribution.</p>
  2772. <p>To install the Python bindings there are 2 options:</p>
  2773. <ul>
  2774. <li>If you use an RPM based distribution, simply install the <a
  2775. href="http://rpmfind.net/linux/rpm2html/search.php?query=libxml2-python">libxml2-python
  2776. RPM</a> (and if needed the <a
  2777. href="http://rpmfind.net/linux/rpm2html/search.php?query=libxslt-python">libxslt-python
  2778. RPM</a>).</li>
  2779. <li>Otherwise use the <a href="ftp://xmlsoft.org/libxml2/python/">libxml2-python
  2780. module distribution</a> corresponding to your installed version of
  2781. libxml2 and libxslt. Note that to install it you will need both libxml2
  2782. and libxslt installed and run "python setup.py build install" in the
  2783. module tree.</li>
  2784. </ul>
  2785. <p>The distribution includes a set of examples and regression tests for the
  2786. python bindings in the <code>python/tests</code> directory. Here are some
  2787. excerpts from those tests:</p>
  2788. <h3>tst.py:</h3>
  2789. <p>This is a basic test of the file interface and DOM navigation:</p>
  2790. <pre>import libxml2, sys
  2791. doc = libxml2.parseFile("tst.xml")
  2792. if doc.name != "tst.xml":
  2793. print "doc.name failed"
  2794. sys.exit(1)
  2795. root = doc.children
  2796. if root.name != "doc":
  2797. print "root.name failed"
  2798. sys.exit(1)
  2799. child = root.children
  2800. if child.name != "foo":
  2801. print "child.name failed"
  2802. sys.exit(1)
  2803. doc.freeDoc()</pre>
  2804. <p>The Python module is called libxml2; parseFile is the equivalent of
  2805. xmlParseFile (most of the bindings are automatically generated, and the xml
  2806. prefix is removed and the casing convention are kept). All node seen at the
  2807. binding level share the same subset of accessors:</p>
  2808. <ul>
  2809. <li><code>name</code> : returns the node name</li>
  2810. <li><code>type</code> : returns a string indicating the node type</li>
  2811. <li><code>content</code> : returns the content of the node, it is based on
  2812. xmlNodeGetContent() and hence is recursive.</li>
  2813. <li><code>parent</code> , <code>children</code>, <code>last</code>,
  2814. <code>next</code>, <code>prev</code>, <code>doc</code>,
  2815. <code>properties</code>: pointing to the associated element in the tree,
  2816. those may return None in case no such link exists.</li>
  2817. </ul>
  2818. <p>Also note the need to explicitly deallocate documents with freeDoc() .
  2819. Reference counting for libxml2 trees would need quite a lot of work to
  2820. function properly, and rather than risk memory leaks if not implemented
  2821. correctly it sounds safer to have an explicit function to free a tree. The
  2822. wrapper python objects like doc, root or child are them automatically garbage
  2823. collected.</p>
  2824. <h3>validate.py:</h3>
  2825. <p>This test check the validation interfaces and redirection of error
  2826. messages:</p>
  2827. <pre>import libxml2
  2828. #deactivate error messages from the validation
  2829. def noerr(ctx, str):
  2830. pass
  2831. libxml2.registerErrorHandler(noerr, None)
  2832. ctxt = libxml2.createFileParserCtxt("invalid.xml")
  2833. ctxt.validate(1)
  2834. ctxt.parseDocument()
  2835. doc = ctxt.doc()
  2836. valid = ctxt.isValid()
  2837. doc.freeDoc()
  2838. if valid != 0:
  2839. print "validity check failed"</pre>
  2840. <p>The first thing to notice is the call to registerErrorHandler(), it
  2841. defines a new error handler global to the library. It is used to avoid seeing
  2842. the error messages when trying to validate the invalid document.</p>
  2843. <p>The main interest of that test is the creation of a parser context with
  2844. createFileParserCtxt() and how the behaviour can be changed before calling
  2845. parseDocument() . Similarly the information resulting from the parsing phase
  2846. is also available using context methods.</p>
  2847. <p>Contexts like nodes are defined as class and the libxml2 wrappers maps the
  2848. C function interfaces in terms of objects method as much as possible. The
  2849. best to get a complete view of what methods are supported is to look at the
  2850. libxml2.py module containing all the wrappers.</p>
  2851. <h3>push.py:</h3>
  2852. <p>This test show how to activate the push parser interface:</p>
  2853. <pre>import libxml2
  2854. ctxt = libxml2.createPushParser(None, "&lt;foo", 4, "test.xml")
  2855. ctxt.parseChunk("/&gt;", 2, 1)
  2856. doc = ctxt.doc()
  2857. doc.freeDoc()</pre>
  2858. <p>The context is created with a special call based on the
  2859. xmlCreatePushParser() from the C library. The first argument is an optional
  2860. SAX callback object, then the initial set of data, the length and the name of
  2861. the resource in case URI-References need to be computed by the parser.</p>
  2862. <p>Then the data are pushed using the parseChunk() method, the last call
  2863. setting the third argument terminate to 1.</p>
  2864. <h3>pushSAX.py:</h3>
  2865. <p>this test show the use of the event based parsing interfaces. In this case
  2866. the parser does not build a document, but provides callback information as
  2867. the parser makes progresses analyzing the data being provided:</p>
  2868. <pre>import libxml2
  2869. log = ""
  2870. class callback:
  2871. def startDocument(self):
  2872. global log
  2873. log = log + "startDocument:"
  2874. def endDocument(self):
  2875. global log
  2876. log = log + "endDocument:"
  2877. def startElement(self, tag, attrs):
  2878. global log
  2879. log = log + "startElement %s %s:" % (tag, attrs)
  2880. def endElement(self, tag):
  2881. global log
  2882. log = log + "endElement %s:" % (tag)
  2883. def characters(self, data):
  2884. global log
  2885. log = log + "characters: %s:" % (data)
  2886. def warning(self, msg):
  2887. global log
  2888. log = log + "warning: %s:" % (msg)
  2889. def error(self, msg):
  2890. global log
  2891. log = log + "error: %s:" % (msg)
  2892. def fatalError(self, msg):
  2893. global log
  2894. log = log + "fatalError: %s:" % (msg)
  2895. handler = callback()
  2896. ctxt = libxml2.createPushParser(handler, "&lt;foo", 4, "test.xml")
  2897. chunk = " url='tst'&gt;b"
  2898. ctxt.parseChunk(chunk, len(chunk), 0)
  2899. chunk = "ar&lt;/foo&gt;"
  2900. ctxt.parseChunk(chunk, len(chunk), 1)
  2901. reference = "startDocument:startElement foo {'url': 'tst'}:" + \
  2902. "characters: bar:endElement foo:endDocument:"
  2903. if log != reference:
  2904. print "Error got: %s" % log
  2905. print "Expected: %s" % reference</pre>
  2906. <p>The key object in that test is the handler, it provides a number of entry
  2907. points which can be called by the parser as it makes progresses to indicate
  2908. the information set obtained. The full set of callback is larger than what
  2909. the callback class in that specific example implements (see the SAX
  2910. definition for a complete list). The wrapper will only call those supplied by
  2911. the object when activated. The startElement receives the names of the element
  2912. and a dictionary containing the attributes carried by this element.</p>
  2913. <p>Also note that the reference string generated from the callback shows a
  2914. single character call even though the string "bar" is passed to the parser
  2915. from 2 different call to parseChunk()</p>
  2916. <h3>xpath.py:</h3>
  2917. <p>This is a basic test of XPath wrappers support</p>
  2918. <pre>import libxml2
  2919. doc = libxml2.parseFile("tst.xml")
  2920. ctxt = doc.xpathNewContext()
  2921. res = ctxt.xpathEval("//*")
  2922. if len(res) != 2:
  2923. print "xpath query: wrong node set size"
  2924. sys.exit(1)
  2925. if res[0].name != "doc" or res[1].name != "foo":
  2926. print "xpath query: wrong node set value"
  2927. sys.exit(1)
  2928. doc.freeDoc()
  2929. ctxt.xpathFreeContext()</pre>
  2930. <p>This test parses a file, then create an XPath context to evaluate XPath
  2931. expression on it. The xpathEval() method execute an XPath query and returns
  2932. the result mapped in a Python way. String and numbers are natively converted,
  2933. and node sets are returned as a tuple of libxml2 Python nodes wrappers. Like
  2934. the document, the XPath context need to be freed explicitly, also not that
  2935. the result of the XPath query may point back to the document tree and hence
  2936. the document must be freed after the result of the query is used.</p>
  2937. <h3>xpathext.py:</h3>
  2938. <p>This test shows how to extend the XPath engine with functions written in
  2939. python:</p>
  2940. <pre>import libxml2
  2941. def foo(ctx, x):
  2942. return x + 1
  2943. doc = libxml2.parseFile("tst.xml")
  2944. ctxt = doc.xpathNewContext()
  2945. libxml2.registerXPathFunction(ctxt._o, "foo", None, foo)
  2946. res = ctxt.xpathEval("foo(1)")
  2947. if res != 2:
  2948. print "xpath extension failure"
  2949. doc.freeDoc()
  2950. ctxt.xpathFreeContext()</pre>
  2951. <p>Note how the extension function is registered with the context (but that
  2952. part is not yet finalized, this may change slightly in the future).</p>
  2953. <h3>tstxpath.py:</h3>
  2954. <p>This test is similar to the previous one but shows how the extension
  2955. function can access the XPath evaluation context:</p>
  2956. <pre>def foo(ctx, x):
  2957. global called
  2958. #
  2959. # test that access to the XPath evaluation contexts
  2960. #
  2961. pctxt = libxml2.xpathParserContext(_obj=ctx)
  2962. ctxt = pctxt.context()
  2963. called = ctxt.function()
  2964. return x + 1</pre>
  2965. <p>All the interfaces around the XPath parser(or rather evaluation) context
  2966. are not finalized, but it should be sufficient to do contextual work at the
  2967. evaluation point.</p>
  2968. <h3>Memory debugging:</h3>
  2969. <p>last but not least, all tests starts with the following prologue:</p>
  2970. <pre>#memory debug specific
  2971. libxml2.debugMemory(1)</pre>
  2972. <p>and ends with the following epilogue:</p>
  2973. <pre>#memory debug specific
  2974. libxml2.cleanupParser()
  2975. if libxml2.debugMemory(1) == 0:
  2976. print "OK"
  2977. else:
  2978. print "Memory leak %d bytes" % (libxml2.debugMemory(1))
  2979. libxml2.dumpMemory()</pre>
  2980. <p>Those activate the memory debugging interface of libxml2 where all
  2981. allocated block in the library are tracked. The prologue then cleans up the
  2982. library state and checks that all allocated memory has been freed. If not it
  2983. calls dumpMemory() which saves that list in a <code>.memdump</code> file.</p>
  2984. <h2><a name="architecture">libxml2 architecture</a></h2>
  2985. <p>Libxml2 is made of multiple components; some of them are optional, and
  2986. most of the block interfaces are public. The main components are:</p>
  2987. <ul>
  2988. <li>an Input/Output layer</li>
  2989. <li>FTP and HTTP client layers (optional)</li>
  2990. <li>an Internationalization layer managing the encodings support</li>
  2991. <li>a URI module</li>
  2992. <li>the XML parser and its basic SAX interface</li>
  2993. <li>an HTML parser using the same SAX interface (optional)</li>
  2994. <li>a SAX tree module to build an in-memory DOM representation</li>
  2995. <li>a tree module to manipulate the DOM representation</li>
  2996. <li>a validation module using the DOM representation (optional)</li>
  2997. <li>an XPath module for global lookup in a DOM representation
  2998. (optional)</li>
  2999. <li>a debug module (optional)</li>
  3000. </ul>
  3001. <p>Graphically this gives the following:</p>
  3002. <p><img src="libxml.gif" alt="a graphical view of the various"></p>
  3003. <p></p>
  3004. <h2><a name="tree">The tree output</a></h2>
  3005. <p>The parser returns a tree built during the document analysis. The value
  3006. returned is an <strong>xmlDocPtr</strong> (i.e., a pointer to an
  3007. <strong>xmlDoc</strong> structure). This structure contains information such
  3008. as the file name, the document type, and a <strong>children</strong> pointer
  3009. which is the root of the document (or more exactly the first child under the
  3010. root which is the document). The tree is made of <strong>xmlNode</strong>s,
  3011. chained in double-linked lists of siblings and with a children&lt;-&gt;parent
  3012. relationship. An xmlNode can also carry properties (a chain of xmlAttr
  3013. structures). An attribute may have a value which is a list of TEXT or
  3014. ENTITY_REF nodes.</p>
  3015. <p>Here is an example (erroneous with respect to the XML spec since there
  3016. should be only one ELEMENT under the root):</p>
  3017. <p><img src="structure.gif" alt=" structure.gif "></p>
  3018. <p>In the source package there is a small program (not installed by default)
  3019. called <strong>xmllint</strong> which parses XML files given as argument and
  3020. prints them back as parsed. This is useful for detecting errors both in XML
  3021. code and in the XML parser itself. It has an option <strong>--debug</strong>
  3022. which prints the actual in-memory structure of the document; here is the
  3023. result with the <a href="#example">example</a> given before:</p>
  3024. <pre>DOCUMENT
  3025. version=1.0
  3026. standalone=true
  3027. ELEMENT EXAMPLE
  3028. ATTRIBUTE prop1
  3029. TEXT
  3030. content=gnome is great
  3031. ATTRIBUTE prop2
  3032. ENTITY_REF
  3033. TEXT
  3034. content= linux too
  3035. ELEMENT head
  3036. ELEMENT title
  3037. TEXT
  3038. content=Welcome to Gnome
  3039. ELEMENT chapter
  3040. ELEMENT title
  3041. TEXT
  3042. content=The Linux adventure
  3043. ELEMENT p
  3044. TEXT
  3045. content=bla bla bla ...
  3046. ELEMENT image
  3047. ATTRIBUTE href
  3048. TEXT
  3049. content=linus.gif
  3050. ELEMENT p
  3051. TEXT
  3052. content=...</pre>
  3053. <p>This should be useful for learning the internal representation model.</p>
  3054. <h2><a name="interface">The SAX interface</a></h2>
  3055. <p>Sometimes the DOM tree output is just too large to fit reasonably into
  3056. memory. In that case (and if you don't expect to save back the XML document
  3057. loaded using libxml), it's better to use the SAX interface of libxml. SAX is
  3058. a <strong>callback-based interface</strong> to the parser. Before parsing,
  3059. the application layer registers a customized set of callbacks which are
  3060. called by the library as it progresses through the XML input.</p>
  3061. <p>To get more detailed step-by-step guidance on using the SAX interface of
  3062. libxml, see the <a
  3063. href="http://www.daa.com.au/~james/gnome/xml-sax/xml-sax.html">nice
  3064. documentation</a>.written by <a href="mailto:james@daa.com.au">James
  3065. Henstridge</a>.</p>
  3066. <p>You can debug the SAX behaviour by using the <strong>testSAX</strong>
  3067. program located in the gnome-xml module (it's usually not shipped in the
  3068. binary packages of libxml, but you can find it in the tar source
  3069. distribution). Here is the sequence of callbacks that would be reported by
  3070. testSAX when parsing the example XML document shown earlier:</p>
  3071. <pre>SAX.setDocumentLocator()
  3072. SAX.startDocument()
  3073. SAX.getEntity(amp)
  3074. SAX.startElement(EXAMPLE, prop1='gnome is great', prop2='&amp;amp; linux too')
  3075. SAX.characters( , 3)
  3076. SAX.startElement(head)
  3077. SAX.characters( , 4)
  3078. SAX.startElement(title)
  3079. SAX.characters(Welcome to Gnome, 16)
  3080. SAX.endElement(title)
  3081. SAX.characters( , 3)
  3082. SAX.endElement(head)
  3083. SAX.characters( , 3)
  3084. SAX.startElement(chapter)
  3085. SAX.characters( , 4)
  3086. SAX.startElement(title)
  3087. SAX.characters(The Linux adventure, 19)
  3088. SAX.endElement(title)
  3089. SAX.characters( , 4)
  3090. SAX.startElement(p)
  3091. SAX.characters(bla bla bla ..., 15)
  3092. SAX.endElement(p)
  3093. SAX.characters( , 4)
  3094. SAX.startElement(image, href='linus.gif')
  3095. SAX.endElement(image)
  3096. SAX.characters( , 4)
  3097. SAX.startElement(p)
  3098. SAX.characters(..., 3)
  3099. SAX.endElement(p)
  3100. SAX.characters( , 3)
  3101. SAX.endElement(chapter)
  3102. SAX.characters( , 1)
  3103. SAX.endElement(EXAMPLE)
  3104. SAX.endDocument()</pre>
  3105. <p>Most of the other interfaces of libxml2 are based on the DOM tree-building
  3106. facility, so nearly everything up to the end of this document presupposes the
  3107. use of the standard DOM tree build. Note that the DOM tree itself is built by
  3108. a set of registered default callbacks, without internal specific
  3109. interface.</p>
  3110. <h2><a name="Validation">Validation &amp; DTDs</a></h2>
  3111. <p>Table of Content:</p>
  3112. <ol>
  3113. <li><a href="#General5">General overview</a></li>
  3114. <li><a href="#definition">The definition</a></li>
  3115. <li><a href="#Simple">Simple rules</a>
  3116. <ol>
  3117. <li><a href="#reference">How to reference a DTD from a document</a></li>
  3118. <li><a href="#Declaring">Declaring elements</a></li>
  3119. <li><a href="#Declaring1">Declaring attributes</a></li>
  3120. </ol>
  3121. </li>
  3122. <li><a href="#Some">Some examples</a></li>
  3123. <li><a href="#validate">How to validate</a></li>
  3124. <li><a href="#Other">Other resources</a></li>
  3125. </ol>
  3126. <h3><a name="General5">General overview</a></h3>
  3127. <p>Well what is validation and what is a DTD ?</p>
  3128. <p>DTD is the acronym for Document Type Definition. This is a description of
  3129. the content for a family of XML files. This is part of the XML 1.0
  3130. specification, and allows one to describe and verify that a given document
  3131. instance conforms to the set of rules detailing its structure and content.</p>
  3132. <p>Validation is the process of checking a document against a DTD (more
  3133. generally against a set of construction rules).</p>
  3134. <p>The validation process and building DTDs are the two most difficult parts
  3135. of the XML life cycle. Briefly a DTD defines all the possible elements to be
  3136. found within your document, what is the formal shape of your document tree
  3137. (by defining the allowed content of an element; either text, a regular
  3138. expression for the allowed list of children, or mixed content i.e. both text
  3139. and children). The DTD also defines the valid attributes for all elements and
  3140. the types of those attributes.</p>
  3141. <h3><a name="definition1">The definition</a></h3>
  3142. <p>The <a href="http://www.w3.org/TR/REC-xml">W3C XML Recommendation</a> (<a
  3143. href="http://www.xml.com/axml/axml.html">Tim Bray's annotated version of
  3144. Rev1</a>):</p>
  3145. <ul>
  3146. <li><a href="http://www.w3.org/TR/REC-xml#elemdecls">Declaring
  3147. elements</a></li>
  3148. <li><a href="http://www.w3.org/TR/REC-xml#attdecls">Declaring
  3149. attributes</a></li>
  3150. </ul>
  3151. <p>(unfortunately) all this is inherited from the SGML world, the syntax is
  3152. ancient...</p>
  3153. <h3><a name="Simple1">Simple rules</a></h3>
  3154. <p>Writing DTDs can be done in many ways. The rules to build them if you need
  3155. something permanent or something which can evolve over time can be radically
  3156. different. Really complex DTDs like DocBook ones are flexible but quite
  3157. harder to design. I will just focus on DTDs for a formats with a fixed simple
  3158. structure. It is just a set of basic rules, and definitely not exhaustive nor
  3159. usable for complex DTD design.</p>
  3160. <h4><a name="reference1">How to reference a DTD from a document</a>:</h4>
  3161. <p>Assuming the top element of the document is <code>spec</code> and the dtd
  3162. is placed in the file <code>mydtd</code> in the subdirectory
  3163. <code>dtds</code> of the directory from where the document were loaded:</p>
  3164. <p><code>&lt;!DOCTYPE spec SYSTEM "dtds/mydtd"&gt;</code></p>
  3165. <p>Notes:</p>
  3166. <ul>
  3167. <li>The system string is actually an URI-Reference (as defined in <a
  3168. href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>) so you can use a
  3169. full URL string indicating the location of your DTD on the Web. This is a
  3170. really good thing to do if you want others to validate your document.</li>
  3171. <li>It is also possible to associate a <code>PUBLIC</code> identifier (a
  3172. magic string) so that the DTD is looked up in catalogs on the client side
  3173. without having to locate it on the web.</li>
  3174. <li>A DTD contains a set of element and attribute declarations, but they
  3175. don't define what the root of the document should be. This is explicitly
  3176. told to the parser/validator as the first element of the
  3177. <code>DOCTYPE</code> declaration.</li>
  3178. </ul>
  3179. <h4><a name="Declaring2">Declaring elements</a>:</h4>
  3180. <p>The following declares an element <code>spec</code>:</p>
  3181. <p><code>&lt;!ELEMENT spec (front, body, back?)&gt;</code></p>
  3182. <p>It also expresses that the spec element contains one <code>front</code>,
  3183. one <code>body</code> and one optional <code>back</code> children elements in
  3184. this order. The declaration of one element of the structure and its content
  3185. are done in a single declaration. Similarly the following declares
  3186. <code>div1</code> elements:</p>
  3187. <p><code>&lt;!ELEMENT div1 (head, (p | list | note)*, div2?)&gt;</code></p>
  3188. <p>which means div1 contains one <code>head</code> then a series of optional
  3189. <code>p</code>, <code>list</code>s and <code>note</code>s and then an
  3190. optional <code>div2</code>. And last but not least an element can contain
  3191. text:</p>
  3192. <p><code>&lt;!ELEMENT b (#PCDATA)&gt;</code></p>
  3193. <p><code>b</code> contains text or being of mixed content (text and elements
  3194. in no particular order):</p>
  3195. <p><code>&lt;!ELEMENT p (#PCDATA|a|ul|b|i|em)*&gt;</code></p>
  3196. <p><code>p </code>can contain text or <code>a</code>, <code>ul</code>,
  3197. <code>b</code>, <code>i </code>or <code>em</code> elements in no particular
  3198. order.</p>
  3199. <h4><a name="Declaring1">Declaring attributes</a>:</h4>
  3200. <p>Again the attributes declaration includes their content definition:</p>
  3201. <p><code>&lt;!ATTLIST termdef name CDATA #IMPLIED&gt;</code></p>
  3202. <p>means that the element <code>termdef</code> can have a <code>name</code>
  3203. attribute containing text (<code>CDATA</code>) and which is optional
  3204. (<code>#IMPLIED</code>). The attribute value can also be defined within a
  3205. set:</p>
  3206. <p><code>&lt;!ATTLIST list type (bullets|ordered|glossary)
  3207. "ordered"&gt;</code></p>
  3208. <p>means <code>list</code> element have a <code>type</code> attribute with 3
  3209. allowed values "bullets", "ordered" or "glossary" and which default to
  3210. "ordered" if the attribute is not explicitly specified.</p>
  3211. <p>The content type of an attribute can be text (<code>CDATA</code>),
  3212. anchor/reference/references
  3213. (<code>ID</code>/<code>IDREF</code>/<code>IDREFS</code>), entity(ies)
  3214. (<code>ENTITY</code>/<code>ENTITIES</code>) or name(s)
  3215. (<code>NMTOKEN</code>/<code>NMTOKENS</code>). The following defines that a
  3216. <code>chapter</code> element can have an optional <code>id</code> attribute
  3217. of type <code>ID</code>, usable for reference from attribute of type
  3218. IDREF:</p>
  3219. <p><code>&lt;!ATTLIST chapter id ID #IMPLIED&gt;</code></p>
  3220. <p>The last value of an attribute definition can be <code>#REQUIRED
  3221. </code>meaning that the attribute has to be given, <code>#IMPLIED</code>
  3222. meaning that it is optional, or the default value (possibly prefixed by
  3223. <code>#FIXED</code> if it is the only allowed).</p>
  3224. <p>Notes:</p>
  3225. <ul>
  3226. <li>Usually the attributes pertaining to a given element are declared in a
  3227. single expression, but it is just a convention adopted by a lot of DTD
  3228. writers:
  3229. <pre>&lt;!ATTLIST termdef
  3230. id ID #REQUIRED
  3231. name CDATA #IMPLIED&gt;</pre>
  3232. <p>The previous construct defines both <code>id</code> and
  3233. <code>name</code> attributes for the element <code>termdef</code>.</p>
  3234. </li>
  3235. </ul>
  3236. <h3><a name="Some1">Some examples</a></h3>
  3237. <p>The directory <code>test/valid/dtds/</code> in the libxml2 distribution
  3238. contains some complex DTD examples. The example in the file
  3239. <code>test/valid/dia.xml</code> shows an XML file where the simple DTD is
  3240. directly included within the document.</p>
  3241. <h3><a name="validate1">How to validate</a></h3>
  3242. <p>The simplest way is to use the xmllint program included with libxml. The
  3243. <code>--valid</code> option turns-on validation of the files given as input.
  3244. For example the following validates a copy of the first revision of the XML
  3245. 1.0 specification:</p>
  3246. <p><code>xmllint --valid --noout test/valid/REC-xml-19980210.xml</code></p>
  3247. <p>the -- noout is used to disable output of the resulting tree.</p>
  3248. <p>The <code>--dtdvalid dtd</code> allows validation of the document(s)
  3249. against a given DTD.</p>
  3250. <p>Libxml2 exports an API to handle DTDs and validation, check the <a
  3251. href="http://xmlsoft.org/html/libxml-valid.html">associated
  3252. description</a>.</p>
  3253. <h3><a name="Other1">Other resources</a></h3>
  3254. <p>DTDs are as old as SGML. So there may be a number of examples on-line, I
  3255. will just list one for now, others pointers welcome:</p>
  3256. <ul>
  3257. <li><a href="http://www.xml101.com:8081/dtd/">XML-101 DTD</a></li>
  3258. </ul>
  3259. <p>I suggest looking at the examples found under test/valid/dtd and any of
  3260. the large number of books available on XML. The dia example in test/valid
  3261. should be both simple and complete enough to allow you to build your own.</p>
  3262. <p></p>
  3263. <h2><a name="Memory">Memory Management</a></h2>
  3264. <p>Table of Content:</p>
  3265. <ol>
  3266. <li><a href="#General3">General overview</a></li>
  3267. <li><a href="#setting">Setting libxml2 set of memory routines</a></li>
  3268. <li><a href="#cleanup">Cleaning up after using the library</a></li>
  3269. <li><a href="#Debugging">Debugging routines</a></li>
  3270. <li><a href="#General4">General memory requirements</a></li>
  3271. <li><a href="#Compacting">Returning memory to the kernel</a></li>
  3272. </ol>
  3273. <h3><a name="General3">General overview</a></h3>
  3274. <p>The module <code><a
  3275. href="http://xmlsoft.org/html/libxml-xmlmemory.html">xmlmemory.h</a></code>
  3276. provides the interfaces to the libxml2 memory system:</p>
  3277. <ul>
  3278. <li>libxml2 does not use the libc memory allocator directly but xmlFree(),
  3279. xmlMalloc() and xmlRealloc()</li>
  3280. <li>those routines can be reallocated to a specific set of routine, by
  3281. default the libc ones i.e. free(), malloc() and realloc()</li>
  3282. <li>the xmlmemory.c module includes a set of debugging routine</li>
  3283. </ul>
  3284. <h3><a name="setting">Setting libxml2 set of memory routines</a></h3>
  3285. <p>It is sometimes useful to not use the default memory allocator, either for
  3286. debugging, analysis or to implement a specific behaviour on memory management
  3287. (like on embedded systems). Two function calls are available to do so:</p>
  3288. <ul>
  3289. <li><a href="http://xmlsoft.org/html/libxml-xmlmemory.html">xmlMemGet
  3290. ()</a> which return the current set of functions in use by the parser</li>
  3291. <li><a
  3292. href="http://xmlsoft.org/html/libxml-xmlmemory.html">xmlMemSetup()</a>
  3293. which allow to set up a new set of memory allocation functions</li>
  3294. </ul>
  3295. <p>Of course a call to xmlMemSetup() should probably be done before calling
  3296. any other libxml2 routines (unless you are sure your allocations routines are
  3297. compatibles).</p>
  3298. <h3><a name="cleanup">Cleaning up after using the library</a></h3>
  3299. <p>Libxml2 is not stateless, there is a few set of memory structures needing
  3300. allocation before the parser is fully functional (some encoding structures
  3301. for example). This also mean that once parsing is finished there is a tiny
  3302. amount of memory (a few hundred bytes) which can be recollected if you don't
  3303. reuse the library or any document built with it:</p>
  3304. <ul>
  3305. <li><a href="http://xmlsoft.org/html/libxml-parser.html">xmlCleanupParser
  3306. ()</a> is a centralized routine to free the library state and data. Note
  3307. that it won't deallocate any produced tree if any (use the xmlFreeDoc()
  3308. and related routines for this). This should be called only when the library
  3309. is not used anymore.</li>
  3310. <li><a href="http://xmlsoft.org/html/libxml-parser.html">xmlInitParser
  3311. ()</a> is the dual routine allowing to preallocate the parsing state
  3312. which can be useful for example to avoid initialization reentrancy
  3313. problems when using libxml2 in multithreaded applications</li>
  3314. </ul>
  3315. <p>Generally xmlCleanupParser() is safe assuming no parsing is ongoing and
  3316. no document is still being used, if needed the state will be rebuild at the
  3317. next invocation of parser routines (or by xmlInitParser()), but be careful
  3318. of the consequences in multithreaded applications.</p>
  3319. <h3><a name="Debugging">Debugging routines</a></h3>
  3320. <p>When configured using --with-mem-debug flag (off by default), libxml2 uses
  3321. a set of memory allocation debugging routines keeping track of all allocated
  3322. blocks and the location in the code where the routine was called. A couple of
  3323. other debugging routines allow to dump the memory allocated infos to a file
  3324. or call a specific routine when a given block number is allocated:</p>
  3325. <ul>
  3326. <li><a
  3327. href="http://xmlsoft.org/html/libxml-xmlmemory.html">xmlMallocLoc()</a>
  3328. <a
  3329. href="http://xmlsoft.org/html/libxml-xmlmemory.html">xmlReallocLoc()</a>
  3330. and <a
  3331. href="http://xmlsoft.org/html/libxml-xmlmemory.html">xmlMemStrdupLoc()</a>
  3332. are the memory debugging replacement allocation routines</li>
  3333. <li><a href="http://xmlsoft.org/html/libxml-xmlmemory.html">xmlMemoryDump
  3334. ()</a> dumps all the information about the allocated memory block lefts
  3335. in the <code>.memdump</code> file</li>
  3336. </ul>
  3337. <p>When developing libxml2 memory debug is enabled, the tests programs call
  3338. xmlMemoryDump () and the "make test" regression tests will check for any
  3339. memory leak during the full regression test sequence, this helps a lot
  3340. ensuring that libxml2 does not leak memory and bullet proof memory
  3341. allocations use (some libc implementations are known to be far too permissive
  3342. resulting in major portability problems!).</p>
  3343. <p>If the .memdump reports a leak, it displays the allocation function and
  3344. also tries to give some information about the content and structure of the
  3345. allocated blocks left. This is sufficient in most cases to find the culprit,
  3346. but not always. Assuming the allocation problem is reproducible, it is
  3347. possible to find more easily:</p>
  3348. <ol>
  3349. <li>write down the block number xxxx not allocated</li>
  3350. <li>export the environment variable XML_MEM_BREAKPOINT=xxxx , the easiest
  3351. when using GDB is to simply give the command
  3352. <p><code>set environment XML_MEM_BREAKPOINT xxxx</code></p>
  3353. <p>before running the program.</p>
  3354. </li>
  3355. <li>run the program under a debugger and set a breakpoint on
  3356. xmlMallocBreakpoint() a specific function called when this precise block
  3357. is allocated</li>
  3358. <li>when the breakpoint is reached you can then do a fine analysis of the
  3359. allocation an step to see the condition resulting in the missing
  3360. deallocation.</li>
  3361. </ol>
  3362. <p>I used to use a commercial tool to debug libxml2 memory problems but after
  3363. noticing that it was not detecting memory leaks that simple mechanism was
  3364. used and proved extremely efficient until now. Lately I have also used <a
  3365. href="http://developer.kde.org/~sewardj/">valgrind</a> with quite some
  3366. success, it is tied to the i386 architecture since it works by emulating the
  3367. processor and instruction set, it is slow but extremely efficient, i.e. it
  3368. spot memory usage errors in a very precise way.</p>
  3369. <h3><a name="General4">General memory requirements</a></h3>
  3370. <p>How much libxml2 memory require ? It's hard to tell in average it depends
  3371. of a number of things:</p>
  3372. <ul>
  3373. <li>the parser itself should work in a fixed amount of memory, except for
  3374. information maintained about the stacks of names and entities locations.
  3375. The I/O and encoding handlers will probably account for a few KBytes.
  3376. This is true for both the XML and HTML parser (though the HTML parser
  3377. need more state).</li>
  3378. <li>If you are generating the DOM tree then memory requirements will grow
  3379. nearly linear with the size of the data. In general for a balanced
  3380. textual document the internal memory requirement is about 4 times the
  3381. size of the UTF8 serialization of this document (example the XML-1.0
  3382. recommendation is a bit more of 150KBytes and takes 650KBytes of main
  3383. memory when parsed). Validation will add a amount of memory required for
  3384. maintaining the external Dtd state which should be linear with the
  3385. complexity of the content model defined by the Dtd</li>
  3386. <li>If you need to work with fixed memory requirements or don't need the
  3387. full DOM tree then using the <a href="xmlreader.html">xmlReader
  3388. interface</a> is probably the best way to proceed, it still allows to
  3389. validate or operate on subset of the tree if needed.</li>
  3390. <li>If you don't care about the advanced features of libxml2 like
  3391. validation, DOM, XPath or XPointer, don't use entities, need to work with
  3392. fixed memory requirements, and try to get the fastest parsing possible
  3393. then the SAX interface should be used, but it has known restrictions.</li>
  3394. </ul>
  3395. <p></p>
  3396. <h3><a name="Compacting">Returning memory to the kernel</a></h3>
  3397. <p>You may encounter that your process using libxml2 does not have a
  3398. reduced memory usage although you freed the trees. This is because
  3399. libxml2 allocates memory in a number of small chunks. When freeing one
  3400. of those chunks, the OS may decide that giving this little memory back
  3401. to the kernel will cause too much overhead and delay the operation. As
  3402. all chunks are this small, they get actually freed but not returned to
  3403. the kernel. On systems using glibc, there is a function call
  3404. "malloc_trim" from malloc.h which does this missing operation (note that
  3405. it is allowed to fail). Thus, after freeing your tree you may simply try
  3406. "malloc_trim(0);" to really get the memory back. If your OS does not
  3407. provide malloc_trim, try searching for a similar function.</p>
  3408. <p></p>
  3409. <h2><a name="Encodings">Encodings support</a></h2>
  3410. <p>If you are not really familiar with Internationalization (usual shortcut
  3411. is I18N) , Unicode, characters and glyphs, I suggest you read a <a
  3412. href="http://www.tbray.org/ongoing/When/200x/2003/04/06/Unicode">presentation</a>
  3413. by Tim Bray on Unicode and why you should care about it.</p>
  3414. <p>If you don't understand why <b>it does not make sense to have a string
  3415. without knowing what encoding it uses</b>, then as Joel Spolsky said <a
  3416. href="http://www.joelonsoftware.com/articles/Unicode.html">please do not
  3417. write another line of code until you finish reading that article.</a>. It is
  3418. a prerequisite to understand this page, and avoid a lot of problems with
  3419. libxml2, XML or text processing in general.</p>
  3420. <p>Table of Content:</p>
  3421. <ol>
  3422. <li><a href="encoding.html#What">What does internationalization support
  3423. mean ?</a></li>
  3424. <li><a href="encoding.html#internal">The internal encoding, how and
  3425. why</a></li>
  3426. <li><a href="encoding.html#implemente">How is it implemented ?</a></li>
  3427. <li><a href="encoding.html#Default">Default supported encodings</a></li>
  3428. <li><a href="encoding.html#extend">How to extend the existing
  3429. support</a></li>
  3430. </ol>
  3431. <h3><a name="What">What does internationalization support mean ?</a></h3>
  3432. <p>XML was designed from the start to allow the support of any character set
  3433. by using Unicode. Any conformant XML parser has to support the UTF-8 and
  3434. UTF-16 default encodings which can both express the full unicode ranges. UTF8
  3435. is a variable length encoding whose greatest points are to reuse the same
  3436. encoding for ASCII and to save space for Western encodings, but it is a bit
  3437. more complex to handle in practice. UTF-16 use 2 bytes per character (and
  3438. sometimes combines two pairs), it makes implementation easier, but looks a
  3439. bit overkill for Western languages encoding. Moreover the XML specification
  3440. allows the document to be encoded in other encodings at the condition that
  3441. they are clearly labeled as such. For example the following is a wellformed
  3442. XML document encoded in ISO-8859-1 and using accentuated letters that we
  3443. French like for both markup and content:</p>
  3444. <pre>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  3445. &lt;très&gt;là&lt;/très&gt;</pre>
  3446. <p>Having internationalization support in libxml2 means the following:</p>
  3447. <ul>
  3448. <li>the document is properly parsed</li>
  3449. <li>information about it's encoding is saved</li>
  3450. <li>it can be modified</li>
  3451. <li>it can be saved in its original encoding</li>
  3452. <li>it can also be saved in another encoding supported by libxml2 (for
  3453. example straight UTF8 or even an ASCII form)</li>
  3454. </ul>
  3455. <p>Another very important point is that the whole libxml2 API, with the
  3456. exception of a few routines to read with a specific encoding or save to a
  3457. specific encoding, is completely agnostic about the original encoding of the
  3458. document.</p>
  3459. <p>It should be noted too that the HTML parser embedded in libxml2 now obey
  3460. the same rules too, the following document will be (as of 2.2.2) handled in
  3461. an internationalized fashion by libxml2 too:</p>
  3462. <pre>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
  3463. "http://www.w3.org/TR/REC-html40/loose.dtd"&gt;
  3464. &lt;html lang="fr"&gt;
  3465. &lt;head&gt;
  3466. &lt;META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"&gt;
  3467. &lt;/head&gt;
  3468. &lt;body&gt;
  3469. &lt;p&gt;W3C crée des standards pour le Web.&lt;/body&gt;
  3470. &lt;/html&gt;</pre>
  3471. <h3><a name="internal">The internal encoding, how and why</a></h3>
  3472. <p>One of the core decisions was to force all documents to be converted to a
  3473. default internal encoding, and that encoding to be UTF-8, here are the
  3474. rationales for those choices:</p>
  3475. <ul>
  3476. <li>keeping the native encoding in the internal form would force the libxml
  3477. users (or the code associated) to be fully aware of the encoding of the
  3478. original document, for examples when adding a text node to a document,
  3479. the content would have to be provided in the document encoding, i.e. the
  3480. client code would have to check it before hand, make sure it's conformant
  3481. to the encoding, etc ... Very hard in practice, though in some specific
  3482. cases this may make sense.</li>
  3483. <li>the second decision was which encoding. From the XML spec only UTF8 and
  3484. UTF16 really makes sense as being the two only encodings for which there
  3485. is mandatory support. UCS-4 (32 bits fixed size encoding) could be
  3486. considered an intelligent choice too since it's a direct Unicode mapping
  3487. support. I selected UTF-8 on the basis of efficiency and compatibility
  3488. with surrounding software:
  3489. <ul>
  3490. <li>UTF-8 while a bit more complex to convert from/to (i.e. slightly
  3491. more costly to import and export CPU wise) is also far more compact
  3492. than UTF-16 (and UCS-4) for a majority of the documents I see it used
  3493. for right now (RPM RDF catalogs, advogato data, various configuration
  3494. file formats, etc.) and the key point for today's computer
  3495. architecture is efficient uses of caches. If one nearly double the
  3496. memory requirement to store the same amount of data, this will trash
  3497. caches (main memory/external caches/internal caches) and my take is
  3498. that this harms the system far more than the CPU requirements needed
  3499. for the conversion to UTF-8</li>
  3500. <li>Most of libxml2 version 1 users were using it with straight ASCII
  3501. most of the time, doing the conversion with an internal encoding
  3502. requiring all their code to be rewritten was a serious show-stopper
  3503. for using UTF-16 or UCS-4.</li>
  3504. <li>UTF-8 is being used as the de-facto internal encoding standard for
  3505. related code like the <a href="http://www.pango.org/">pango</a>
  3506. upcoming Gnome text widget, and a lot of Unix code (yet another place
  3507. where Unix programmer base takes a different approach from Microsoft
  3508. - they are using UTF-16)</li>
  3509. </ul>
  3510. </li>
  3511. </ul>
  3512. <p>What does this mean in practice for the libxml2 user:</p>
  3513. <ul>
  3514. <li>xmlChar, the libxml2 data type is a byte, those bytes must be assembled
  3515. as UTF-8 valid strings. The proper way to terminate an xmlChar * string
  3516. is simply to append 0 byte, as usual.</li>
  3517. <li>One just need to make sure that when using chars outside the ASCII set,
  3518. the values has been properly converted to UTF-8</li>
  3519. </ul>
  3520. <h3><a name="implemente">How is it implemented ?</a></h3>
  3521. <p>Let's describe how all this works within libxml, basically the I18N
  3522. (internationalization) support get triggered only during I/O operation, i.e.
  3523. when reading a document or saving one. Let's look first at the reading
  3524. sequence:</p>
  3525. <ol>
  3526. <li>when a document is processed, we usually don't know the encoding, a
  3527. simple heuristic allows to detect UTF-16 and UCS-4 from encodings where
  3528. the ASCII range (0-0x7F) maps with ASCII</li>
  3529. <li>the xml declaration if available is parsed, including the encoding
  3530. declaration. At that point, if the autodetected encoding is different
  3531. from the one declared a call to xmlSwitchEncoding() is issued.</li>
  3532. <li>If there is no encoding declaration, then the input has to be in either
  3533. UTF-8 or UTF-16, if it is not then at some point when processing the
  3534. input, the converter/checker of UTF-8 form will raise an encoding error.
  3535. You may end-up with a garbled document, or no document at all ! Example:
  3536. <pre>~/XML -&gt; ./xmllint err.xml
  3537. err.xml:1: error: Input is not proper UTF-8, indicate encoding !
  3538. &lt;très&gt;là&lt;/très&gt;
  3539. ^
  3540. err.xml:1: error: Bytes: 0xE8 0x73 0x3E 0x6C
  3541. &lt;très&gt;là&lt;/très&gt;
  3542. ^</pre>
  3543. </li>
  3544. <li>xmlSwitchEncoding() does an encoding name lookup, canonicalize it, and
  3545. then search the default registered encoding converters for that encoding.
  3546. If it's not within the default set and iconv() support has been compiled
  3547. it, it will ask iconv for such an encoder. If this fails then the parser
  3548. will report an error and stops processing:
  3549. <pre>~/XML -&gt; ./xmllint err2.xml
  3550. err2.xml:1: error: Unsupported encoding UnsupportedEnc
  3551. &lt;?xml version="1.0" encoding="UnsupportedEnc"?&gt;
  3552. ^</pre>
  3553. </li>
  3554. <li>From that point the encoder processes progressively the input (it is
  3555. plugged as a front-end to the I/O module) for that entity. It captures
  3556. and converts on-the-fly the document to be parsed to UTF-8. The parser
  3557. itself just does UTF-8 checking of this input and process it
  3558. transparently. The only difference is that the encoding information has
  3559. been added to the parsing context (more precisely to the input
  3560. corresponding to this entity).</li>
  3561. <li>The result (when using DOM) is an internal form completely in UTF-8
  3562. with just an encoding information on the document node.</li>
  3563. </ol>
  3564. <p>Ok then what happens when saving the document (assuming you
  3565. collected/built an xmlDoc DOM like structure) ? It depends on the function
  3566. called, xmlSaveFile() will just try to save in the original encoding, while
  3567. xmlSaveFileTo() and xmlSaveFileEnc() can optionally save to a given
  3568. encoding:</p>
  3569. <ol>
  3570. <li>if no encoding is given, libxml2 will look for an encoding value
  3571. associated to the document and if it exists will try to save to that
  3572. encoding,
  3573. <p>otherwise everything is written in the internal form, i.e. UTF-8</p>
  3574. </li>
  3575. <li>so if an encoding was specified, either at the API level or on the
  3576. document, libxml2 will again canonicalize the encoding name, lookup for a
  3577. converter in the registered set or through iconv. If not found the
  3578. function will return an error code</li>
  3579. <li>the converter is placed before the I/O buffer layer, as another kind of
  3580. buffer, then libxml2 will simply push the UTF-8 serialization to through
  3581. that buffer, which will then progressively be converted and pushed onto
  3582. the I/O layer.</li>
  3583. <li>It is possible that the converter code fails on some input, for example
  3584. trying to push an UTF-8 encoded Chinese character through the UTF-8 to
  3585. ISO-8859-1 converter won't work. Since the encoders are progressive they
  3586. will just report the error and the number of bytes converted, at that
  3587. point libxml2 will decode the offending character, remove it from the
  3588. buffer and replace it with the associated charRef encoding &amp;#123; and
  3589. resume the conversion. This guarantees that any document will be saved
  3590. without losses (except for markup names where this is not legal, this is
  3591. a problem in the current version, in practice avoid using non-ascii
  3592. characters for tag or attribute names). A special "ascii" encoding name
  3593. is used to save documents to a pure ascii form can be used when
  3594. portability is really crucial</li>
  3595. </ol>
  3596. <p>Here are a few examples based on the same test document:</p>
  3597. <pre>~/XML -&gt; ./xmllint isolat1
  3598. &lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  3599. &lt;très&gt;là&lt;/très&gt;
  3600. ~/XML -&gt; ./xmllint --encode UTF-8 isolat1
  3601. &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  3602. &lt;très&gt;là &nbsp;&lt;/très&gt;
  3603. ~/XML -&gt; </pre>
  3604. <p>The same processing is applied (and reuse most of the code) for HTML I18N
  3605. processing. Looking up and modifying the content encoding is a bit more
  3606. difficult since it is located in a &lt;meta&gt; tag under the &lt;head&gt;,
  3607. so a couple of functions htmlGetMetaEncoding() and htmlSetMetaEncoding() have
  3608. been provided. The parser also attempts to switch encoding on the fly when
  3609. detecting such a tag on input. Except for that the processing is the same
  3610. (and again reuses the same code).</p>
  3611. <h3><a name="Default">Default supported encodings</a></h3>
  3612. <p>libxml2 has a set of default converters for the following encodings
  3613. (located in encoding.c):</p>
  3614. <ol>
  3615. <li>UTF-8 is supported by default (null handlers)</li>
  3616. <li>UTF-16, both little and big endian</li>
  3617. <li>ISO-Latin-1 (ISO-8859-1) covering most western languages</li>
  3618. <li>ASCII, useful mostly for saving</li>
  3619. <li>HTML, a specific handler for the conversion of UTF-8 to ASCII with HTML
  3620. predefined entities like &amp;copy; for the Copyright sign.</li>
  3621. </ol>
  3622. <p>More over when compiled on an Unix platform with iconv support the full
  3623. set of encodings supported by iconv can be instantly be used by libxml. On a
  3624. linux machine with glibc-2.1 the list of supported encodings and aliases fill
  3625. 3 full pages, and include UCS-4, the full set of ISO-Latin encodings, and the
  3626. various Japanese ones.</p>
  3627. <p>To convert from the UTF-8 values returned from the API to another encoding
  3628. then it is possible to use the function provided from <a
  3629. href="html/libxml-encoding.html">the encoding module</a> like <a
  3630. href="html/libxml-encoding.html#UTF8Toisolat1">UTF8Toisolat1</a>, or use the
  3631. POSIX <a
  3632. href="http://www.opengroup.org/onlinepubs/009695399/functions/iconv.html">iconv()</a>
  3633. API directly.</p>
  3634. <h4>Encoding aliases</h4>
  3635. <p>From 2.2.3, libxml2 has support to register encoding names aliases. The
  3636. goal is to be able to parse document whose encoding is supported but where
  3637. the name differs (for example from the default set of names accepted by
  3638. iconv). The following functions allow to register and handle new aliases for
  3639. existing encodings. Once registered libxml2 will automatically lookup the
  3640. aliases when handling a document:</p>
  3641. <ul>
  3642. <li>int xmlAddEncodingAlias(const char *name, const char *alias);</li>
  3643. <li>int xmlDelEncodingAlias(const char *alias);</li>
  3644. <li>const char * xmlGetEncodingAlias(const char *alias);</li>
  3645. <li>void xmlCleanupEncodingAliases(void);</li>
  3646. </ul>
  3647. <h3><a name="extend">How to extend the existing support</a></h3>
  3648. <p>Well adding support for new encoding, or overriding one of the encoders
  3649. (assuming it is buggy) should not be hard, just write input and output
  3650. conversion routines to/from UTF-8, and register them using
  3651. xmlNewCharEncodingHandler(name, xxxToUTF8, UTF8Toxxx), and they will be
  3652. called automatically if the parser(s) encounter such an encoding name
  3653. (register it uppercase, this will help). The description of the encoders,
  3654. their arguments and expected return values are described in the encoding.h
  3655. header.</p>
  3656. <h2><a name="IO">I/O Interfaces</a></h2>
  3657. <p>Table of Content:</p>
  3658. <ol>
  3659. <li><a href="#General1">General overview</a></li>
  3660. <li><a href="#basic">The basic buffer type</a></li>
  3661. <li><a href="#Input">Input I/O handlers</a></li>
  3662. <li><a href="#Output">Output I/O handlers</a></li>
  3663. <li><a href="#entities">The entities loader</a></li>
  3664. <li><a href="#Example2">Example of customized I/O</a></li>
  3665. </ol>
  3666. <h3><a name="General1">General overview</a></h3>
  3667. <p>The module <code><a
  3668. href="http://xmlsoft.org/html/libxml-xmlio.html">xmlIO.h</a></code> provides
  3669. the interfaces to the libxml2 I/O system. This consists of 4 main parts:</p>
  3670. <ul>
  3671. <li>Entities loader, this is a routine which tries to fetch the entities
  3672. (files) based on their PUBLIC and SYSTEM identifiers. The default loader
  3673. don't look at the public identifier since libxml2 do not maintain a
  3674. catalog. You can redefine you own entity loader by using
  3675. <code>xmlGetExternalEntityLoader()</code> and
  3676. <code>xmlSetExternalEntityLoader()</code>. <a href="#entities">Check the
  3677. example</a>.</li>
  3678. <li>Input I/O buffers which are a commodity structure used by the parser(s)
  3679. input layer to handle fetching the information to feed the parser. This
  3680. provides buffering and is also a placeholder where the encoding
  3681. converters to UTF8 are piggy-backed.</li>
  3682. <li>Output I/O buffers are similar to the Input ones and fulfill similar
  3683. task but when generating a serialization from a tree.</li>
  3684. <li>A mechanism to register sets of I/O callbacks and associate them with
  3685. specific naming schemes like the protocol part of the URIs.
  3686. <p>This affect the default I/O operations and allows to use specific I/O
  3687. handlers for certain names.</p>
  3688. </li>
  3689. </ul>
  3690. <p>The general mechanism used when loading http://rpmfind.net/xml.html for
  3691. example in the HTML parser is the following:</p>
  3692. <ol>
  3693. <li>The default entity loader calls <code>xmlNewInputFromFile()</code> with
  3694. the parsing context and the URI string.</li>
  3695. <li>the URI string is checked against the existing registered handlers
  3696. using their match() callback function, if the HTTP module was compiled
  3697. in, it is registered and its match() function will succeeds</li>
  3698. <li>the open() function of the handler is called and if successful will
  3699. return an I/O Input buffer</li>
  3700. <li>the parser will the start reading from this buffer and progressively
  3701. fetch information from the resource, calling the read() function of the
  3702. handler until the resource is exhausted</li>
  3703. <li>if an encoding change is detected it will be installed on the input
  3704. buffer, providing buffering and efficient use of the conversion
  3705. routines</li>
  3706. <li>once the parser has finished, the close() function of the handler is
  3707. called once and the Input buffer and associated resources are
  3708. deallocated.</li>
  3709. </ol>
  3710. <p>The user defined callbacks are checked first to allow overriding of the
  3711. default libxml2 I/O routines.</p>
  3712. <h3><a name="basic">The basic buffer type</a></h3>
  3713. <p>All the buffer manipulation handling is done using the
  3714. <code>xmlBuffer</code> type define in <code><a
  3715. href="http://xmlsoft.org/html/libxml-tree.html">tree.h</a> </code>which is a
  3716. resizable memory buffer. The buffer allocation strategy can be selected to be
  3717. either best-fit or use an exponential doubling one (CPU vs. memory use
  3718. trade-off). The values are <code>XML_BUFFER_ALLOC_EXACT</code> and
  3719. <code>XML_BUFFER_ALLOC_DOUBLEIT</code>, and can be set individually or on a
  3720. system wide basis using <code>xmlBufferSetAllocationScheme()</code>. A number
  3721. of functions allows to manipulate buffers with names starting with the
  3722. <code>xmlBuffer...</code> prefix.</p>
  3723. <h3><a name="Input">Input I/O handlers</a></h3>
  3724. <p>An Input I/O handler is a simple structure
  3725. <code>xmlParserInputBuffer</code> containing a context associated to the
  3726. resource (file descriptor, or pointer to a protocol handler), the read() and
  3727. close() callbacks to use and an xmlBuffer. And extra xmlBuffer and a charset
  3728. encoding handler are also present to support charset conversion when
  3729. needed.</p>
  3730. <h3><a name="Output">Output I/O handlers</a></h3>
  3731. <p>An Output handler <code>xmlOutputBuffer</code> is completely similar to an
  3732. Input one except the callbacks are write() and close().</p>
  3733. <h3><a name="entities">The entities loader</a></h3>
  3734. <p>The entity loader resolves requests for new entities and create inputs for
  3735. the parser. Creating an input from a filename or an URI string is done
  3736. through the xmlNewInputFromFile() routine. The default entity loader do not
  3737. handle the PUBLIC identifier associated with an entity (if any). So it just
  3738. calls xmlNewInputFromFile() with the SYSTEM identifier (which is mandatory in
  3739. XML).</p>
  3740. <p>If you want to hook up a catalog mechanism then you simply need to
  3741. override the default entity loader, here is an example:</p>
  3742. <pre>#include &lt;libxml/xmlIO.h&gt;
  3743. xmlExternalEntityLoader defaultLoader = NULL;
  3744. xmlParserInputPtr
  3745. xmlMyExternalEntityLoader(const char *URL, const char *ID,
  3746. xmlParserCtxtPtr ctxt) {
  3747. xmlParserInputPtr ret;
  3748. const char *fileID = NULL;
  3749. /* lookup for the fileID depending on ID */
  3750. ret = xmlNewInputFromFile(ctxt, fileID);
  3751. if (ret != NULL)
  3752. return(ret);
  3753. if (defaultLoader != NULL)
  3754. ret = defaultLoader(URL, ID, ctxt);
  3755. return(ret);
  3756. }
  3757. int main(..) {
  3758. ...
  3759. /*
  3760. * Install our own entity loader
  3761. */
  3762. defaultLoader = xmlGetExternalEntityLoader();
  3763. xmlSetExternalEntityLoader(xmlMyExternalEntityLoader);
  3764. ...
  3765. }</pre>
  3766. <h3><a name="Example2">Example of customized I/O</a></h3>
  3767. <p>This example come from <a href="http://xmlsoft.org/messages/0708.html">a
  3768. real use case</a>, xmlDocDump() closes the FILE * passed by the application
  3769. and this was a problem. The <a
  3770. href="http://xmlsoft.org/messages/0711.html">solution</a> was to redefine a
  3771. new output handler with the closing call deactivated:</p>
  3772. <ol>
  3773. <li>First define a new I/O output allocator where the output don't close
  3774. the file:
  3775. <pre>xmlOutputBufferPtr
  3776. xmlOutputBufferCreateOwn(FILE *file, xmlCharEncodingHandlerPtr encoder) {
  3777. &nbsp;&nbsp;&nbsp;&nbsp;xmlOutputBufferPtr ret;
  3778. &nbsp;&nbsp;&nbsp;&nbsp;
  3779. &nbsp;&nbsp;&nbsp;&nbsp;if (xmlOutputCallbackInitialized == 0)
  3780. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlRegisterDefaultOutputCallbacks();
  3781. &nbsp;&nbsp;&nbsp;&nbsp;if (file == NULL) return(NULL);
  3782. &nbsp;&nbsp;&nbsp;&nbsp;ret = xmlAllocOutputBuffer(encoder);
  3783. &nbsp;&nbsp;&nbsp;&nbsp;if (ret != NULL) {
  3784. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret-&gt;context = file;
  3785. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret-&gt;writecallback = xmlFileWrite;
  3786. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret-&gt;closecallback = NULL; /* No close callback */
  3787. &nbsp;&nbsp;&nbsp;&nbsp;}
  3788. &nbsp;&nbsp;&nbsp;&nbsp;return(ret);
  3789. } </pre>
  3790. </li>
  3791. <li>And then use it to save the document:
  3792. <pre>FILE *f;
  3793. xmlOutputBufferPtr output;
  3794. xmlDocPtr doc;
  3795. int res;
  3796. f = ...
  3797. doc = ....
  3798. output = xmlOutputBufferCreateOwn(f, NULL);
  3799. res = xmlSaveFileTo(output, doc, NULL);
  3800. </pre>
  3801. </li>
  3802. </ol>
  3803. <h2><a name="Catalog">Catalog support</a></h2>
  3804. <p>Table of Content:</p>
  3805. <ol>
  3806. <li><a href="General2">General overview</a></li>
  3807. <li><a href="#definition">The definition</a></li>
  3808. <li><a href="#Simple">Using catalogs</a></li>
  3809. <li><a href="#Some">Some examples</a></li>
  3810. <li><a href="#reference">How to tune catalog usage</a></li>
  3811. <li><a href="#validate">How to debug catalog processing</a></li>
  3812. <li><a href="#Declaring">How to create and maintain catalogs</a></li>
  3813. <li><a href="#implemento">The implementor corner quick review of the
  3814. API</a></li>
  3815. <li><a href="#Other">Other resources</a></li>
  3816. </ol>
  3817. <h3><a name="General2">General overview</a></h3>
  3818. <p>What is a catalog? Basically it's a lookup mechanism used when an entity
  3819. (a file or a remote resource) references another entity. The catalog lookup
  3820. is inserted between the moment the reference is recognized by the software
  3821. (XML parser, stylesheet processing, or even images referenced for inclusion
  3822. in a rendering) and the time where loading that resource is actually
  3823. started.</p>
  3824. <p>It is basically used for 3 things:</p>
  3825. <ul>
  3826. <li>mapping from "logical" names, the public identifiers and a more
  3827. concrete name usable for download (and URI). For example it can associate
  3828. the logical name
  3829. <p>"-//OASIS//DTD DocBook XML V4.1.2//EN"</p>
  3830. <p>of the DocBook 4.1.2 XML DTD with the actual URL where it can be
  3831. downloaded</p>
  3832. <p>http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd</p>
  3833. </li>
  3834. <li>remapping from a given URL to another one, like an HTTP indirection
  3835. saying that
  3836. <p>"http://www.oasis-open.org/committes/tr.xsl"</p>
  3837. <p>should really be looked at</p>
  3838. <p>"http://www.oasis-open.org/committes/entity/stylesheets/base/tr.xsl"</p>
  3839. </li>
  3840. <li>providing a local cache mechanism allowing to load the entities
  3841. associated to public identifiers or remote resources, this is a really
  3842. important feature for any significant deployment of XML or SGML since it
  3843. allows to avoid the aleas and delays associated to fetching remote
  3844. resources.</li>
  3845. </ul>
  3846. <h3><a name="definition">The definitions</a></h3>
  3847. <p>Libxml, as of 2.4.3 implements 2 kind of catalogs:</p>
  3848. <ul>
  3849. <li>the older SGML catalogs, the official spec is SGML Open Technical
  3850. Resolution TR9401:1997, but is better understood by reading <a
  3851. href="http://www.jclark.com/sp/catalog.htm">the SP Catalog page</a> from
  3852. James Clark. This is relatively old and not the preferred mode of
  3853. operation of libxml.</li>
  3854. <li><a href="http://www.oasis-open.org/committees/entity/spec.html">XML
  3855. Catalogs</a> is far more flexible, more recent, uses an XML syntax and
  3856. should scale quite better. This is the default option of libxml.</li>
  3857. </ul>
  3858. <p></p>
  3859. <h3><a name="Simple">Using catalog</a></h3>
  3860. <p>In a normal environment libxml2 will by default check the presence of a
  3861. catalog in /etc/xml/catalog, and assuming it has been correctly populated,
  3862. the processing is completely transparent to the document user. To take a
  3863. concrete example, suppose you are authoring a DocBook document, this one
  3864. starts with the following DOCTYPE definition:</p>
  3865. <pre>&lt;?xml version='1.0'?&gt;
  3866. &lt;!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.4//EN"
  3867. "http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd"&gt;</pre>
  3868. <p>When validating the document with libxml, the catalog will be
  3869. automatically consulted to lookup the public identifier "-//Norman Walsh//DTD
  3870. DocBk XML V3.1.4//EN" and the system identifier
  3871. "http://nwalsh.com/docbook/xml/3.1.4/db3xml.dtd", and if these entities have
  3872. been installed on your system and the catalogs actually point to them, libxml
  3873. will fetch them from the local disk.</p>
  3874. <p style="font-size: 10pt"><strong>Note</strong>: Really don't use this
  3875. DOCTYPE example it's a really old version, but is fine as an example.</p>
  3876. <p>Libxml2 will check the catalog each time that it is requested to load an
  3877. entity, this includes DTD, external parsed entities, stylesheets, etc ... If
  3878. your system is correctly configured all the authoring phase and processing
  3879. should use only local files, even if your document stays portable because it
  3880. uses the canonical public and system ID, referencing the remote document.</p>
  3881. <h3><a name="Some">Some examples:</a></h3>
  3882. <p>Here is a couple of fragments from XML Catalogs used in libxml2 early
  3883. regression tests in <code>test/catalogs</code> :</p>
  3884. <pre>&lt;?xml version="1.0"?&gt;
  3885. &lt;!DOCTYPE catalog PUBLIC
  3886. "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
  3887. "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"&gt;
  3888. &lt;catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"&gt;
  3889. &lt;public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN"
  3890. uri="http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"/&gt;
  3891. ...</pre>
  3892. <p>This is the beginning of a catalog for DocBook 4.1.2, XML Catalogs are
  3893. written in XML, there is a specific namespace for catalog elements
  3894. "urn:oasis:names:tc:entity:xmlns:xml:catalog". The first entry in this
  3895. catalog is a <code>public</code> mapping it allows to associate a Public
  3896. Identifier with an URI.</p>
  3897. <pre>...
  3898. &lt;rewriteSystem systemIdStartString="http://www.oasis-open.org/docbook/"
  3899. rewritePrefix="file:///usr/share/xml/docbook/"/&gt;
  3900. ...</pre>
  3901. <p>A <code>rewriteSystem</code> is a very powerful instruction, it says that
  3902. any URI starting with a given prefix should be looked at another URI
  3903. constructed by replacing the prefix with an new one. In effect this acts like
  3904. a cache system for a full area of the Web. In practice it is extremely useful
  3905. with a file prefix if you have installed a copy of those resources on your
  3906. local system.</p>
  3907. <pre>...
  3908. &lt;delegatePublic publicIdStartString="-//OASIS//DTD XML Catalog //"
  3909. catalog="file:///usr/share/xml/docbook.xml"/&gt;
  3910. &lt;delegatePublic publicIdStartString="-//OASIS//ENTITIES DocBook XML"
  3911. catalog="file:///usr/share/xml/docbook.xml"/&gt;
  3912. &lt;delegatePublic publicIdStartString="-//OASIS//DTD DocBook XML"
  3913. catalog="file:///usr/share/xml/docbook.xml"/&gt;
  3914. &lt;delegateSystem systemIdStartString="http://www.oasis-open.org/docbook/"
  3915. catalog="file:///usr/share/xml/docbook.xml"/&gt;
  3916. &lt;delegateURI uriStartString="http://www.oasis-open.org/docbook/"
  3917. catalog="file:///usr/share/xml/docbook.xml"/&gt;
  3918. ...</pre>
  3919. <p>Delegation is the core features which allows to build a tree of catalogs,
  3920. easier to maintain than a single catalog, based on Public Identifier, System
  3921. Identifier or URI prefixes it instructs the catalog software to look up
  3922. entries in another resource. This feature allow to build hierarchies of
  3923. catalogs, the set of entries presented should be sufficient to redirect the
  3924. resolution of all DocBook references to the specific catalog in
  3925. <code>/usr/share/xml/docbook.xml</code> this one in turn could delegate all
  3926. references for DocBook 4.2.1 to a specific catalog installed at the same time
  3927. as the DocBook resources on the local machine.</p>
  3928. <h3><a name="reference">How to tune catalog usage:</a></h3>
  3929. <p>The user can change the default catalog behaviour by redirecting queries
  3930. to its own set of catalogs, this can be done by setting the
  3931. <code>XML_CATALOG_FILES</code> environment variable to a list of catalogs, an
  3932. empty one should deactivate loading the default <code>/etc/xml/catalog</code>
  3933. default catalog</p>
  3934. <h3><a name="validate">How to debug catalog processing:</a></h3>
  3935. <p>Setting up the <code>XML_DEBUG_CATALOG</code> environment variable will
  3936. make libxml2 output debugging information for each catalog operations, for
  3937. example:</p>
  3938. <pre>orchis:~/XML -&gt; xmllint --memory --noout test/ent2
  3939. warning: failed to load external entity "title.xml"
  3940. orchis:~/XML -&gt; export XML_DEBUG_CATALOG=
  3941. orchis:~/XML -&gt; xmllint --memory --noout test/ent2
  3942. Failed to parse catalog /etc/xml/catalog
  3943. Failed to parse catalog /etc/xml/catalog
  3944. warning: failed to load external entity "title.xml"
  3945. Catalogs cleanup
  3946. orchis:~/XML -&gt; </pre>
  3947. <p>The test/ent2 references an entity, running the parser from memory makes
  3948. the base URI unavailable and the the "title.xml" entity cannot be loaded.
  3949. Setting up the debug environment variable allows to detect that an attempt is
  3950. made to load the <code>/etc/xml/catalog</code> but since it's not present the
  3951. resolution fails.</p>
  3952. <p>But the most advanced way to debug XML catalog processing is to use the
  3953. <strong>xmlcatalog</strong> command shipped with libxml2, it allows to load
  3954. catalogs and make resolution queries to see what is going on. This is also
  3955. used for the regression tests:</p>
  3956. <pre>orchis:~/XML -&gt; ./xmlcatalog test/catalogs/docbook.xml \
  3957. "-//OASIS//DTD DocBook XML V4.1.2//EN"
  3958. http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
  3959. orchis:~/XML -&gt; </pre>
  3960. <p>For debugging what is going on, adding one -v flags increase the verbosity
  3961. level to indicate the processing done (adding a second flag also indicate
  3962. what elements are recognized at parsing):</p>
  3963. <pre>orchis:~/XML -&gt; ./xmlcatalog -v test/catalogs/docbook.xml \
  3964. "-//OASIS//DTD DocBook XML V4.1.2//EN"
  3965. Parsing catalog test/catalogs/docbook.xml's content
  3966. Found public match -//OASIS//DTD DocBook XML V4.1.2//EN
  3967. http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
  3968. Catalogs cleanup
  3969. orchis:~/XML -&gt; </pre>
  3970. <p>A shell interface is also available to debug and process multiple queries
  3971. (and for regression tests):</p>
  3972. <pre>orchis:~/XML -&gt; ./xmlcatalog -shell test/catalogs/docbook.xml \
  3973. "-//OASIS//DTD DocBook XML V4.1.2//EN"
  3974. &gt; help
  3975. Commands available:
  3976. public PublicID: make a PUBLIC identifier lookup
  3977. system SystemID: make a SYSTEM identifier lookup
  3978. resolve PublicID SystemID: do a full resolver lookup
  3979. add 'type' 'orig' 'replace' : add an entry
  3980. del 'values' : remove values
  3981. dump: print the current catalog state
  3982. debug: increase the verbosity level
  3983. quiet: decrease the verbosity level
  3984. exit: quit the shell
  3985. &gt; public "-//OASIS//DTD DocBook XML V4.1.2//EN"
  3986. http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
  3987. &gt; quit
  3988. orchis:~/XML -&gt; </pre>
  3989. <p>This should be sufficient for most debugging purpose, this was actually
  3990. used heavily to debug the XML Catalog implementation itself.</p>
  3991. <h3><a name="Declaring">How to create and maintain</a> catalogs:</h3>
  3992. <p>Basically XML Catalogs are XML files, you can either use XML tools to
  3993. manage them or use <strong>xmlcatalog</strong> for this. The basic step is
  3994. to create a catalog the -create option provide this facility:</p>
  3995. <pre>orchis:~/XML -&gt; ./xmlcatalog --create tst.xml
  3996. &lt;?xml version="1.0"?&gt;
  3997. &lt;!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
  3998. "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"&gt;
  3999. &lt;catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"/&gt;
  4000. orchis:~/XML -&gt; </pre>
  4001. <p>By default xmlcatalog does not overwrite the original catalog and save the
  4002. result on the standard output, this can be overridden using the -noout
  4003. option. The <code>-add</code> command allows to add entries in the
  4004. catalog:</p>
  4005. <pre>orchis:~/XML -&gt; ./xmlcatalog --noout --create --add "public" \
  4006. "-//OASIS//DTD DocBook XML V4.1.2//EN" \
  4007. http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd tst.xml
  4008. orchis:~/XML -&gt; cat tst.xml
  4009. &lt;?xml version="1.0"?&gt;
  4010. &lt;!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" \
  4011. "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"&gt;
  4012. &lt;catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"&gt;
  4013. &lt;public publicId="-//OASIS//DTD DocBook XML V4.1.2//EN"
  4014. uri="http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"/&gt;
  4015. &lt;/catalog&gt;
  4016. orchis:~/XML -&gt; </pre>
  4017. <p>The <code>-add</code> option will always take 3 parameters even if some of
  4018. the XML Catalog constructs (like nextCatalog) will have only a single
  4019. argument, just pass a third empty string, it will be ignored.</p>
  4020. <p>Similarly the <code>-del</code> option remove matching entries from the
  4021. catalog:</p>
  4022. <pre>orchis:~/XML -&gt; ./xmlcatalog --del \
  4023. "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" tst.xml
  4024. &lt;?xml version="1.0"?&gt;
  4025. &lt;!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
  4026. "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"&gt;
  4027. &lt;catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"/&gt;
  4028. orchis:~/XML -&gt; </pre>
  4029. <p>The catalog is now empty. Note that the matching of <code>-del</code> is
  4030. exact and would have worked in a similar fashion with the Public ID
  4031. string.</p>
  4032. <p>This is rudimentary but should be sufficient to manage a not too complex
  4033. catalog tree of resources.</p>
  4034. <h3><a name="implemento">The implementor corner quick review of the
  4035. API:</a></h3>
  4036. <p>First, and like for every other module of libxml, there is an
  4037. automatically generated <a href="html/libxml-catalog.html">API page for
  4038. catalog support</a>.</p>
  4039. <p>The header for the catalog interfaces should be included as:</p>
  4040. <pre>#include &lt;libxml/catalog.h&gt;</pre>
  4041. <p>The API is voluntarily kept very simple. First it is not obvious that
  4042. applications really need access to it since it is the default behaviour of
  4043. libxml2 (Note: it is possible to completely override libxml2 default catalog
  4044. by using <a href="html/libxml-parser.html">xmlSetExternalEntityLoader</a> to
  4045. plug an application specific resolver).</p>
  4046. <p>Basically libxml2 support 2 catalog lists:</p>
  4047. <ul>
  4048. <li>the default one, global shared by all the application</li>
  4049. <li>a per-document catalog, this one is built if the document uses the
  4050. <code>oasis-xml-catalog</code> PIs to specify its own catalog list, it is
  4051. associated to the parser context and destroyed when the parsing context
  4052. is destroyed.</li>
  4053. </ul>
  4054. <p>the document one will be used first if it exists.</p>
  4055. <h4>Initialization routines:</h4>
  4056. <p>xmlInitializeCatalog(), xmlLoadCatalog() and xmlLoadCatalogs() should be
  4057. used at startup to initialize the catalog, if the catalog should be
  4058. initialized with specific values xmlLoadCatalog() or xmlLoadCatalogs()
  4059. should be called before xmlInitializeCatalog() which would otherwise do a
  4060. default initialization first.</p>
  4061. <p>The xmlCatalogAddLocal() call is used by the parser to grow the document
  4062. own catalog list if needed.</p>
  4063. <h4>Preferences setup:</h4>
  4064. <p>The XML Catalog spec requires the possibility to select default
  4065. preferences between public and system delegation,
  4066. xmlCatalogSetDefaultPrefer() allows this, xmlCatalogSetDefaults() and
  4067. xmlCatalogGetDefaults() allow to control if XML Catalogs resolution should
  4068. be forbidden, allowed for global catalog, for document catalog or both, the
  4069. default is to allow both.</p>
  4070. <p>And of course xmlCatalogSetDebug() allows to generate debug messages
  4071. (through the xmlGenericError() mechanism).</p>
  4072. <h4>Querying routines:</h4>
  4073. <p>xmlCatalogResolve(), xmlCatalogResolveSystem(), xmlCatalogResolvePublic()
  4074. and xmlCatalogResolveURI() are relatively explicit if you read the XML
  4075. Catalog specification they correspond to section 7 algorithms, they should
  4076. also work if you have loaded an SGML catalog with a simplified semantic.</p>
  4077. <p>xmlCatalogLocalResolve() and xmlCatalogLocalResolveURI() are the same but
  4078. operate on the document catalog list</p>
  4079. <h4>Cleanup and Miscellaneous:</h4>
  4080. <p>xmlCatalogCleanup() free-up the global catalog, xmlCatalogFreeLocal() is
  4081. the per-document equivalent.</p>
  4082. <p>xmlCatalogAdd() and xmlCatalogRemove() are used to dynamically modify the
  4083. first catalog in the global list, and xmlCatalogDump() allows to dump a
  4084. catalog state, those routines are primarily designed for xmlcatalog, I'm not
  4085. sure that exposing more complex interfaces (like navigation ones) would be
  4086. really useful.</p>
  4087. <p>The xmlParseCatalogFile() is a function used to load XML Catalog files,
  4088. it's similar as xmlParseFile() except it bypass all catalog lookups, it's
  4089. provided because this functionality may be useful for client tools.</p>
  4090. <h4>threaded environments:</h4>
  4091. <p>Since the catalog tree is built progressively, some care has been taken to
  4092. try to avoid troubles in multithreaded environments. The code is now thread
  4093. safe assuming that the libxml2 library has been compiled with threads
  4094. support.</p>
  4095. <p></p>
  4096. <h3><a name="Other">Other resources</a></h3>
  4097. <p>The XML Catalog specification is relatively recent so there isn't much
  4098. literature to point at:</p>
  4099. <ul>
  4100. <li>You can find a good rant from Norm Walsh about <a
  4101. href="http://www.arbortext.com/Think_Tank/XML_Resources/Issue_Three/issue_three.html">the
  4102. need for catalogs</a>, it provides a lot of context information even if
  4103. I don't agree with everything presented. Norm also wrote a more recent
  4104. article <a
  4105. href="http://wwws.sun.com/software/xml/developers/resolver/article/">XML
  4106. entities and URI resolvers</a> describing them.</li>
  4107. <li>An <a href="http://home.ccil.org/~cowan/XML/XCatalog.html">old XML
  4108. catalog proposal</a> from John Cowan</li>
  4109. <li>The <a href="http://www.rddl.org/">Resource Directory Description
  4110. Language</a> (RDDL) another catalog system but more oriented toward
  4111. providing metadata for XML namespaces.</li>
  4112. <li>the page from the OASIS Technical <a
  4113. href="http://www.oasis-open.org/committees/entity/">Committee on Entity
  4114. Resolution</a> who maintains XML Catalog, you will find pointers to the
  4115. specification update, some background and pointers to others tools
  4116. providing XML Catalog support</li>
  4117. <li>There is a <a href="buildDocBookCatalog">shell script</a> to generate
  4118. XML Catalogs for DocBook 4.1.2 . If it can write to the /etc/xml/
  4119. directory, it will set-up /etc/xml/catalog and /etc/xml/docbook based on
  4120. the resources found on the system. Otherwise it will just create
  4121. ~/xmlcatalog and ~/dbkxmlcatalog and doing:
  4122. <p><code>export XML_CATALOG_FILES=$HOME/xmlcatalog</code></p>
  4123. <p>should allow to process DocBook documentations without requiring
  4124. network accesses for the DTD or stylesheets</p>
  4125. </li>
  4126. <li>I have uploaded <a href="ftp://xmlsoft.org/libxml2/test/dbk412catalog.tar.gz">a
  4127. small tarball</a> containing XML Catalogs for DocBook 4.1.2 which seems
  4128. to work fine for me too</li>
  4129. <li>The <a href="http://www.xmlsoft.org/xmlcatalog_man.html">xmlcatalog
  4130. manual page</a></li>
  4131. </ul>
  4132. <p>If you have suggestions for corrections or additions, simply contact
  4133. me:</p>
  4134. <h2><a name="library">The parser interfaces</a></h2>
  4135. <p>This section is directly intended to help programmers getting bootstrapped
  4136. using the XML tollkit from the C language. It is not intended to be
  4137. extensive. I hope the automatically generated documents will provide the
  4138. completeness required, but as a separate set of documents. The interfaces of
  4139. the XML parser are by principle low level, Those interested in a higher level
  4140. API should <a href="#DOM">look at DOM</a>.</p>
  4141. <p>The <a href="html/libxml-parser.html">parser interfaces for XML</a> are
  4142. separated from the <a href="html/libxml-htmlparser.html">HTML parser
  4143. interfaces</a>. Let's have a look at how the XML parser can be called:</p>
  4144. <h3><a name="Invoking">Invoking the parser : the pull method</a></h3>
  4145. <p>Usually, the first thing to do is to read an XML input. The parser accepts
  4146. documents either from in-memory strings or from files. The functions are
  4147. defined in "parser.h":</p>
  4148. <dl>
  4149. <dt><code>xmlDocPtr xmlParseMemory(char *buffer, int size);</code></dt>
  4150. <dd><p>Parse a null-terminated string containing the document.</p>
  4151. </dd>
  4152. </dl>
  4153. <dl>
  4154. <dt><code>xmlDocPtr xmlParseFile(const char *filename);</code></dt>
  4155. <dd><p>Parse an XML document contained in a (possibly compressed)
  4156. file.</p>
  4157. </dd>
  4158. </dl>
  4159. <p>The parser returns a pointer to the document structure (or NULL in case of
  4160. failure).</p>
  4161. <h3 id="Invoking1">Invoking the parser: the push method</h3>
  4162. <p>In order for the application to keep the control when the document is
  4163. being fetched (which is common for GUI based programs) libxml2 provides a
  4164. push interface, too, as of version 1.8.3. Here are the interface
  4165. functions:</p>
  4166. <pre>xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
  4167. void *user_data,
  4168. const char *chunk,
  4169. int size,
  4170. const char *filename);
  4171. int xmlParseChunk (xmlParserCtxtPtr ctxt,
  4172. const char *chunk,
  4173. int size,
  4174. int terminate);</pre>
  4175. <p>and here is a simple example showing how to use the interface:</p>
  4176. <pre> FILE *f;
  4177. f = fopen(filename, "r");
  4178. if (f != NULL) {
  4179. int res, size = 1024;
  4180. char chars[1024];
  4181. xmlParserCtxtPtr ctxt;
  4182. res = fread(chars, 1, 4, f);
  4183. if (res &gt; 0) {
  4184. ctxt = xmlCreatePushParserCtxt(NULL, NULL,
  4185. chars, res, filename);
  4186. while ((res = fread(chars, 1, size, f)) &gt; 0) {
  4187. xmlParseChunk(ctxt, chars, res, 0);
  4188. }
  4189. xmlParseChunk(ctxt, chars, 0, 1);
  4190. doc = ctxt-&gt;myDoc;
  4191. xmlFreeParserCtxt(ctxt);
  4192. }
  4193. }</pre>
  4194. <p>The HTML parser embedded into libxml2 also has a push interface; the
  4195. functions are just prefixed by "html" rather than "xml".</p>
  4196. <h3 id="Invoking2">Invoking the parser: the SAX interface</h3>
  4197. <p>The tree-building interface makes the parser memory-hungry, first loading
  4198. the document in memory and then building the tree itself. Reading a document
  4199. without building the tree is possible using the SAX interfaces (see SAX.h and
  4200. <a href="http://www.daa.com.au/~james/gnome/xml-sax/xml-sax.html">James
  4201. Henstridge's documentation</a>). Note also that the push interface can be
  4202. limited to SAX: just use the two first arguments of
  4203. <code>xmlCreatePushParserCtxt()</code>.</p>
  4204. <h3><a name="Building">Building a tree from scratch</a></h3>
  4205. <p>The other way to get an XML tree in memory is by building it. Basically
  4206. there is a set of functions dedicated to building new elements. (These are
  4207. also described in &lt;libxml/tree.h&gt;.) For example, here is a piece of
  4208. code that produces the XML document used in the previous examples:</p>
  4209. <pre> #include &lt;libxml/tree.h&gt;
  4210. xmlDocPtr doc;
  4211. xmlNodePtr tree, subtree;
  4212. doc = xmlNewDoc("1.0");
  4213. doc-&gt;children = xmlNewDocNode(doc, NULL, "EXAMPLE", NULL);
  4214. xmlSetProp(doc-&gt;children, "prop1", "gnome is great");
  4215. xmlSetProp(doc-&gt;children, "prop2", "&amp; linux too");
  4216. tree = xmlNewChild(doc-&gt;children, NULL, "head", NULL);
  4217. subtree = xmlNewChild(tree, NULL, "title", "Welcome to Gnome");
  4218. tree = xmlNewChild(doc-&gt;children, NULL, "chapter", NULL);
  4219. subtree = xmlNewChild(tree, NULL, "title", "The Linux adventure");
  4220. subtree = xmlNewChild(tree, NULL, "p", "bla bla bla ...");
  4221. subtree = xmlNewChild(tree, NULL, "image", NULL);
  4222. xmlSetProp(subtree, "href", "linus.gif");</pre>
  4223. <p>Not really rocket science ...</p>
  4224. <h3><a name="Traversing">Traversing the tree</a></h3>
  4225. <p>Basically by <a href="html/libxml-tree.html">including "tree.h"</a> your
  4226. code has access to the internal structure of all the elements of the tree.
  4227. The names should be somewhat simple like <strong>parent</strong>,
  4228. <strong>children</strong>, <strong>next</strong>, <strong>prev</strong>,
  4229. <strong>properties</strong>, etc... For example, still with the previous
  4230. example:</p>
  4231. <pre><code>doc-&gt;children-&gt;children-&gt;children</code></pre>
  4232. <p>points to the title element,</p>
  4233. <pre>doc-&gt;children-&gt;children-&gt;next-&gt;children-&gt;children</pre>
  4234. <p>points to the text node containing the chapter title "The Linux
  4235. adventure".</p>
  4236. <p><strong>NOTE</strong>: XML allows <em>PI</em>s and <em>comments</em> to be
  4237. present before the document root, so <code>doc-&gt;children</code> may point
  4238. to an element which is not the document Root Element; a function
  4239. <code>xmlDocGetRootElement()</code> was added for this purpose.</p>
  4240. <h3><a name="Modifying">Modifying the tree</a></h3>
  4241. <p>Functions are provided for reading and writing the document content. Here
  4242. is an excerpt from the <a href="html/libxml-tree.html">tree API</a>:</p>
  4243. <dl>
  4244. <dt><code>xmlAttrPtr xmlSetProp(xmlNodePtr node, const xmlChar *name, const
  4245. xmlChar *value);</code></dt>
  4246. <dd><p>This sets (or changes) an attribute carried by an ELEMENT node.
  4247. The value can be NULL.</p>
  4248. </dd>
  4249. </dl>
  4250. <dl>
  4251. <dt><code>const xmlChar *xmlGetProp(xmlNodePtr node, const xmlChar
  4252. *name);</code></dt>
  4253. <dd><p>This function returns a pointer to new copy of the property
  4254. content. Note that the user must deallocate the result.</p>
  4255. </dd>
  4256. </dl>
  4257. <p>Two functions are provided for reading and writing the text associated
  4258. with elements:</p>
  4259. <dl>
  4260. <dt><code>xmlNodePtr xmlStringGetNodeList(xmlDocPtr doc, const xmlChar
  4261. *value);</code></dt>
  4262. <dd><p>This function takes an "external" string and converts it to one
  4263. text node or possibly to a list of entity and text nodes. All
  4264. non-predefined entity references like &amp;Gnome; will be stored
  4265. internally as entity nodes, hence the result of the function may not be
  4266. a single node.</p>
  4267. </dd>
  4268. </dl>
  4269. <dl>
  4270. <dt><code>xmlChar *xmlNodeListGetString(xmlDocPtr doc, xmlNodePtr list, int
  4271. inLine);</code></dt>
  4272. <dd><p>This function is the inverse of
  4273. <code>xmlStringGetNodeList()</code>. It generates a new string
  4274. containing the content of the text and entity nodes. Note the extra
  4275. argument inLine. If this argument is set to 1, the function will expand
  4276. entity references. For example, instead of returning the &amp;Gnome;
  4277. XML encoding in the string, it will substitute it with its value (say,
  4278. "GNU Network Object Model Environment").</p>
  4279. </dd>
  4280. </dl>
  4281. <h3><a name="Saving">Saving a tree</a></h3>
  4282. <p>Basically 3 options are possible:</p>
  4283. <dl>
  4284. <dt><code>void xmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int
  4285. *size);</code></dt>
  4286. <dd><p>Returns a buffer into which the document has been saved.</p>
  4287. </dd>
  4288. </dl>
  4289. <dl>
  4290. <dt><code>extern void xmlDocDump(FILE *f, xmlDocPtr doc);</code></dt>
  4291. <dd><p>Dumps a document to an open file descriptor.</p>
  4292. </dd>
  4293. </dl>
  4294. <dl>
  4295. <dt><code>int xmlSaveFile(const char *filename, xmlDocPtr cur);</code></dt>
  4296. <dd><p>Saves the document to a file. In this case, the compression
  4297. interface is triggered if it has been turned on.</p>
  4298. </dd>
  4299. </dl>
  4300. <h3><a name="Compressio">Compression</a></h3>
  4301. <p>The library transparently handles compression when doing file-based
  4302. accesses. The level of compression on saves can be turned on either globally
  4303. or individually for one file:</p>
  4304. <dl>
  4305. <dt><code>int xmlGetDocCompressMode (xmlDocPtr doc);</code></dt>
  4306. <dd><p>Gets the document compression ratio (0-9).</p>
  4307. </dd>
  4308. </dl>
  4309. <dl>
  4310. <dt><code>void xmlSetDocCompressMode (xmlDocPtr doc, int mode);</code></dt>
  4311. <dd><p>Sets the document compression ratio.</p>
  4312. </dd>
  4313. </dl>
  4314. <dl>
  4315. <dt><code>int xmlGetCompressMode(void);</code></dt>
  4316. <dd><p>Gets the default compression ratio.</p>
  4317. </dd>
  4318. </dl>
  4319. <dl>
  4320. <dt><code>void xmlSetCompressMode(int mode);</code></dt>
  4321. <dd><p>Sets the default compression ratio.</p>
  4322. </dd>
  4323. </dl>
  4324. <h2><a name="Entities">Entities or no entities</a></h2>
  4325. <p>Entities in principle are similar to simple C macros. An entity defines an
  4326. abbreviation for a given string that you can reuse many times throughout the
  4327. content of your document. Entities are especially useful when a given string
  4328. may occur frequently within a document, or to confine the change needed to a
  4329. document to a restricted area in the internal subset of the document (at the
  4330. beginning). Example:</p>
  4331. <pre>1 &lt;?xml version="1.0"?&gt;
  4332. 2 &lt;!DOCTYPE EXAMPLE SYSTEM "example.dtd" [
  4333. 3 &lt;!ENTITY xml "Extensible Markup Language"&gt;
  4334. 4 ]&gt;
  4335. 5 &lt;EXAMPLE&gt;
  4336. 6 &amp;xml;
  4337. 7 &lt;/EXAMPLE&gt;</pre>
  4338. <p>Line 3 declares the xml entity. Line 6 uses the xml entity, by prefixing
  4339. its name with '&amp;' and following it by ';' without any spaces added. There
  4340. are 5 predefined entities in libxml2 allowing you to escape characters with
  4341. predefined meaning in some parts of the xml document content:
  4342. <strong>&amp;lt;</strong> for the character '&lt;', <strong>&amp;gt;</strong>
  4343. for the character '&gt;', <strong>&amp;apos;</strong> for the character ''',
  4344. <strong>&amp;quot;</strong> for the character '"', and
  4345. <strong>&amp;amp;</strong> for the character '&amp;'.</p>
  4346. <p>One of the problems related to entities is that you may want the parser to
  4347. substitute an entity's content so that you can see the replacement text in
  4348. your application. Or you may prefer to keep entity references as such in the
  4349. content to be able to save the document back without losing this usually
  4350. precious information (if the user went through the pain of explicitly
  4351. defining entities, he may have a a rather negative attitude if you blindly
  4352. substitute them as saving time). The <a
  4353. href="html/libxml-parser.html#xmlSubstituteEntitiesDefault">xmlSubstituteEntitiesDefault()</a>
  4354. function allows you to check and change the behaviour, which is to not
  4355. substitute entities by default.</p>
  4356. <p>Here is the DOM tree built by libxml2 for the previous document in the
  4357. default case:</p>
  4358. <pre>/gnome/src/gnome-xml -&gt; ./xmllint --debug test/ent1
  4359. DOCUMENT
  4360. version=1.0
  4361. ELEMENT EXAMPLE
  4362. TEXT
  4363. content=
  4364. ENTITY_REF
  4365. INTERNAL_GENERAL_ENTITY xml
  4366. content=Extensible Markup Language
  4367. TEXT
  4368. content=</pre>
  4369. <p>And here is the result when substituting entities:</p>
  4370. <pre>/gnome/src/gnome-xml -&gt; ./tester --debug --noent test/ent1
  4371. DOCUMENT
  4372. version=1.0
  4373. ELEMENT EXAMPLE
  4374. TEXT
  4375. content= Extensible Markup Language</pre>
  4376. <p>So, entities or no entities? Basically, it depends on your use case. I
  4377. suggest that you keep the non-substituting default behaviour and avoid using
  4378. entities in your XML document or data if you are not willing to handle the
  4379. entity references elements in the DOM tree.</p>
  4380. <p>Note that at save time libxml2 enforces the conversion of the predefined
  4381. entities where necessary to prevent well-formedness problems, and will also
  4382. transparently replace those with chars (i.e. it will not generate entity
  4383. reference elements in the DOM tree or call the reference() SAX callback when
  4384. finding them in the input).</p>
  4385. <p><span style="background-color: #FF0000">WARNING</span>: handling entities
  4386. on top of the libxml2 SAX interface is difficult!!! If you plan to use
  4387. non-predefined entities in your documents, then the learning curve to handle
  4388. then using the SAX API may be long. If you plan to use complex documents, I
  4389. strongly suggest you consider using the DOM interface instead and let libxml
  4390. deal with the complexity rather than trying to do it yourself.</p>
  4391. <h2><a name="Namespaces">Namespaces</a></h2>
  4392. <p>The libxml2 library implements <a
  4393. href="http://www.w3.org/TR/REC-xml-names/">XML namespaces</a> support by
  4394. recognizing namespace constructs in the input, and does namespace lookup
  4395. automatically when building the DOM tree. A namespace declaration is
  4396. associated with an in-memory structure and all elements or attributes within
  4397. that namespace point to it. Hence testing the namespace is a simple and fast
  4398. equality operation at the user level.</p>
  4399. <p>I suggest that people using libxml2 use a namespace, and declare it in the
  4400. root element of their document as the default namespace. Then they don't need
  4401. to use the prefix in the content but we will have a basis for future semantic
  4402. refinement and merging of data from different sources. This doesn't increase
  4403. the size of the XML output significantly, but significantly increases its
  4404. value in the long-term. Example:</p>
  4405. <pre>&lt;mydoc xmlns="http://mydoc.example.org/schemas/"&gt;
  4406. &lt;elem1&gt;...&lt;/elem1&gt;
  4407. &lt;elem2&gt;...&lt;/elem2&gt;
  4408. &lt;/mydoc&gt;</pre>
  4409. <p>The namespace value has to be an absolute URL, but the URL doesn't have to
  4410. point to any existing resource on the Web. It will bind all the element and
  4411. attributes with that URL. I suggest to use an URL within a domain you
  4412. control, and that the URL should contain some kind of version information if
  4413. possible. For example, <code>"http://www.gnome.org/gnumeric/1.0/"</code> is a
  4414. good namespace scheme.</p>
  4415. <p>Then when you load a file, make sure that a namespace carrying the
  4416. version-independent prefix is installed on the root element of your document,
  4417. and if the version information don't match something you know, warn the user
  4418. and be liberal in what you accept as the input. Also do *not* try to base
  4419. namespace checking on the prefix value. &lt;foo:text&gt; may be exactly the
  4420. same as &lt;bar:text&gt; in another document. What really matters is the URI
  4421. associated with the element or the attribute, not the prefix string (which is
  4422. just a shortcut for the full URI). In libxml, element and attributes have an
  4423. <code>ns</code> field pointing to an xmlNs structure detailing the namespace
  4424. prefix and its URI.</p>
  4425. <p>@@Interfaces@@</p>
  4426. <pre>xmlNodePtr node;
  4427. if(!strncmp(node-&gt;name,"mytag",5)
  4428. &amp;&amp; node-&gt;ns
  4429. &amp;&amp; !strcmp(node-&gt;ns-&gt;href,"http://www.mysite.com/myns/1.0")) {
  4430. ...
  4431. }</pre>
  4432. <p>Usually people object to using namespaces together with validity checking.
  4433. I will try to make sure that using namespaces won't break validity checking,
  4434. so even if you plan to use or currently are using validation I strongly
  4435. suggest adding namespaces to your document. A default namespace scheme
  4436. <code>xmlns="http://...."</code> should not break validity even on less
  4437. flexible parsers. Using namespaces to mix and differentiate content coming
  4438. from multiple DTDs will certainly break current validation schemes. To check
  4439. such documents one needs to use schema-validation, which is supported in
  4440. libxml2 as well. See <a href="http://www.relaxng.org/">relagx-ng</a> and <a
  4441. href="http://www.w3c.org/XML/Schema">w3c-schema</a>.</p>
  4442. <h2><a name="Upgrading">Upgrading 1.x code</a></h2>
  4443. <p>Incompatible changes:</p>
  4444. <p>Version 2 of libxml2 is the first version introducing serious backward
  4445. incompatible changes. The main goals were:</p>
  4446. <ul>
  4447. <li>a general cleanup. A number of mistakes inherited from the very early
  4448. versions couldn't be changed due to compatibility constraints. Example
  4449. the "childs" element in the nodes.</li>
  4450. <li>Uniformization of the various nodes, at least for their header and link
  4451. parts (doc, parent, children, prev, next), the goal is a simpler
  4452. programming model and simplifying the task of the DOM implementors.</li>
  4453. <li>better conformances to the XML specification, for example version 1.x
  4454. had an heuristic to try to detect ignorable white spaces. As a result the
  4455. SAX event generated were ignorableWhitespace() while the spec requires
  4456. character() in that case. This also mean that a number of DOM node
  4457. containing blank text may populate the DOM tree which were not present
  4458. before.</li>
  4459. </ul>
  4460. <h3>How to fix libxml-1.x code:</h3>
  4461. <p>So client code of libxml designed to run with version 1.x may have to be
  4462. changed to compile against version 2.x of libxml. Here is a list of changes
  4463. that I have collected, they may not be sufficient, so in case you find other
  4464. change which are required, <a href="mailto:Daniel.Veillard@w3.org">drop me a
  4465. mail</a>:</p>
  4466. <ol>
  4467. <li>The package name have changed from libxml to libxml2, the library name
  4468. is now -lxml2 . There is a new xml2-config script which should be used to
  4469. select the right parameters libxml2</li>
  4470. <li>Node <strong>childs</strong> field has been renamed
  4471. <strong>children</strong> so s/childs/children/g should be applied
  4472. (probability of having "childs" anywhere else is close to 0+</li>
  4473. <li>The document don't have anymore a <strong>root</strong> element it has
  4474. been replaced by <strong>children</strong> and usually you will get a
  4475. list of element here. For example a Dtd element for the internal subset
  4476. and it's declaration may be found in that list, as well as processing
  4477. instructions or comments found before or after the document root element.
  4478. Use <strong>xmlDocGetRootElement(doc)</strong> to get the root element of
  4479. a document. Alternatively if you are sure to not reference DTDs nor have
  4480. PIs or comments before or after the root element
  4481. s/-&gt;root/-&gt;children/g will probably do it.</li>
  4482. <li>The white space issue, this one is more complex, unless special case of
  4483. validating parsing, the line breaks and spaces usually used for indenting
  4484. and formatting the document content becomes significant. So they are
  4485. reported by SAX and if your using the DOM tree, corresponding nodes are
  4486. generated. Too approach can be taken:
  4487. <ol>
  4488. <li>lazy one, use the compatibility call
  4489. <strong>xmlKeepBlanksDefault(0)</strong> but be aware that you are
  4490. relying on a special (and possibly broken) set of heuristics of
  4491. libxml to detect ignorable blanks. Don't complain if it breaks or
  4492. make your application not 100% clean w.r.t. to it's input.</li>
  4493. <li>the Right Way: change you code to accept possibly insignificant
  4494. blanks characters, or have your tree populated with weird blank text
  4495. nodes. You can spot them using the commodity function
  4496. <strong>xmlIsBlankNode(node)</strong> returning 1 for such blank
  4497. nodes.</li>
  4498. </ol>
  4499. <p>Note also that with the new default the output functions don't add any
  4500. extra indentation when saving a tree in order to be able to round trip
  4501. (read and save) without inflating the document with extra formatting
  4502. chars.</p>
  4503. </li>
  4504. <li>The include path has changed to $prefix/libxml/ and the includes
  4505. themselves uses this new prefix in includes instructions... If you are
  4506. using (as expected) the
  4507. <pre>xml2-config --cflags</pre>
  4508. <p>output to generate you compile commands this will probably work out of
  4509. the box</p>
  4510. </li>
  4511. <li>xmlDetectCharEncoding takes an extra argument indicating the length in
  4512. byte of the head of the document available for character detection.</li>
  4513. </ol>
  4514. <h3>Ensuring both libxml-1.x and libxml-2.x compatibility</h3>
  4515. <p>Two new version of libxml (1.8.11) and libxml2 (2.3.4) have been released
  4516. to allow smooth upgrade of existing libxml v1code while retaining
  4517. compatibility. They offers the following:</p>
  4518. <ol>
  4519. <li>similar include naming, one should use
  4520. <strong>#include&lt;libxml/...&gt;</strong> in both cases.</li>
  4521. <li>similar identifiers defined via macros for the child and root fields:
  4522. respectively <strong>xmlChildrenNode</strong> and
  4523. <strong>xmlRootNode</strong></li>
  4524. <li>a new macro <strong>LIBXML_TEST_VERSION</strong> which should be
  4525. inserted once in the client code</li>
  4526. </ol>
  4527. <p>So the roadmap to upgrade your existing libxml applications is the
  4528. following:</p>
  4529. <ol>
  4530. <li>install the libxml-1.8.8 (and libxml-devel-1.8.8) packages</li>
  4531. <li>find all occurrences where the xmlDoc <strong>root</strong> field is
  4532. used and change it to <strong>xmlRootNode</strong></li>
  4533. <li>similarly find all occurrences where the xmlNode
  4534. <strong>childs</strong> field is used and change it to
  4535. <strong>xmlChildrenNode</strong></li>
  4536. <li>add a <strong>LIBXML_TEST_VERSION</strong> macro somewhere in your
  4537. <strong>main()</strong> or in the library init entry point</li>
  4538. <li>Recompile, check compatibility, it should still work</li>
  4539. <li>Change your configure script to look first for xml2-config and fall
  4540. back using xml-config . Use the --cflags and --libs output of the command
  4541. as the Include and Linking parameters needed to use libxml.</li>
  4542. <li>install libxml2-2.3.x and libxml2-devel-2.3.x (libxml-1.8.y and
  4543. libxml-devel-1.8.y can be kept simultaneously)</li>
  4544. <li>remove your config.cache, relaunch your configuration mechanism, and
  4545. recompile, if steps 2 and 3 were done right it should compile as-is</li>
  4546. <li>Test that your application is still running correctly, if not this may
  4547. be due to extra empty nodes due to formating spaces being kept in libxml2
  4548. contrary to libxml1, in that case insert xmlKeepBlanksDefault(1) in your
  4549. code before calling the parser (next to
  4550. <strong>LIBXML_TEST_VERSION</strong> is a fine place).</li>
  4551. </ol>
  4552. <p>Following those steps should work. It worked for some of my own code.</p>
  4553. <p>Let me put some emphasis on the fact that there is far more changes from
  4554. libxml 1.x to 2.x than the ones you may have to patch for. The overall code
  4555. has been considerably cleaned up and the conformance to the XML specification
  4556. has been drastically improved too. Don't take those changes as an excuse to
  4557. not upgrade, it may cost a lot on the long term ...</p>
  4558. <h2><a name="Thread">Thread safety</a></h2>
  4559. <p>Starting with 2.4.7, libxml2 makes provisions to ensure that concurrent
  4560. threads can safely work in parallel parsing different documents. There is
  4561. however a couple of things to do to ensure it:</p>
  4562. <ul>
  4563. <li>configure the library accordingly using the --with-threads options</li>
  4564. <li>call xmlInitParser() in the "main" thread before using any of the
  4565. libxml2 API (except possibly selecting a different memory allocator)</li>
  4566. </ul>
  4567. <p>Note that the thread safety cannot be ensured for multiple threads sharing
  4568. the same document, the locking must be done at the application level, libxml
  4569. exports a basic mutex and reentrant mutexes API in &lt;libxml/threads.h&gt;.
  4570. The parts of the library checked for thread safety are:</p>
  4571. <ul>
  4572. <li>concurrent loading</li>
  4573. <li>file access resolution</li>
  4574. <li>catalog access</li>
  4575. <li>catalog building</li>
  4576. <li>entities lookup/accesses</li>
  4577. <li>validation</li>
  4578. <li>global variables per-thread override</li>
  4579. <li>memory handling</li>
  4580. </ul>
  4581. <p>XPath is supposed to be thread safe now, but this wasn't tested
  4582. seriously.</p>
  4583. <h2><a name="DOM"></a><a name="Principles">DOM Principles</a></h2>
  4584. <p><a href="http://www.w3.org/DOM/">DOM</a> stands for the <em>Document
  4585. Object Model</em>; this is an API for accessing XML or HTML structured
  4586. documents. Native support for DOM in Gnome is on the way (module gnome-dom),
  4587. and will be based on gnome-xml. This will be a far cleaner interface to
  4588. manipulate XML files within Gnome since it won't expose the internal
  4589. structure.</p>
  4590. <p>The current DOM implementation on top of libxml2 is the <a
  4591. href="http://svn.gnome.org/viewvc/gdome2/trunk/">gdome2 Gnome module</a>, this
  4592. is a full DOM interface, thanks to Paolo Casarini, check the <a
  4593. href="http://gdome2.cs.unibo.it/">Gdome2 homepage</a> for more
  4594. information.</p>
  4595. <h2><a name="Example"></a><a name="real">A real example</a></h2>
  4596. <p>Here is a real size example, where the actual content of the application
  4597. data is not kept in the DOM tree but uses internal structures. It is based on
  4598. a proposal to keep a database of jobs related to Gnome, with an XML based
  4599. storage structure. Here is an <a href="gjobs.xml">XML encoded jobs
  4600. base</a>:</p>
  4601. <pre>&lt;?xml version="1.0"?&gt;
  4602. &lt;gjob:Helping xmlns:gjob="http://www.gnome.org/some-location"&gt;
  4603. &lt;gjob:Jobs&gt;
  4604. &lt;gjob:Job&gt;
  4605. &lt;gjob:Project ID="3"/&gt;
  4606. &lt;gjob:Application&gt;GBackup&lt;/gjob:Application&gt;
  4607. &lt;gjob:Category&gt;Development&lt;/gjob:Category&gt;
  4608. &lt;gjob:Update&gt;
  4609. &lt;gjob:Status&gt;Open&lt;/gjob:Status&gt;
  4610. &lt;gjob:Modified&gt;Mon, 07 Jun 1999 20:27:45 -0400 MET DST&lt;/gjob:Modified&gt;
  4611. &lt;gjob:Salary&gt;USD 0.00&lt;/gjob:Salary&gt;
  4612. &lt;/gjob:Update&gt;
  4613. &lt;gjob:Developers&gt;
  4614. &lt;gjob:Developer&gt;
  4615. &lt;/gjob:Developer&gt;
  4616. &lt;/gjob:Developers&gt;
  4617. &lt;gjob:Contact&gt;
  4618. &lt;gjob:Person&gt;Nathan Clemons&lt;/gjob:Person&gt;
  4619. &lt;gjob:Email&gt;nathan@windsofstorm.net&lt;/gjob:Email&gt;
  4620. &lt;gjob:Company&gt;
  4621. &lt;/gjob:Company&gt;
  4622. &lt;gjob:Organisation&gt;
  4623. &lt;/gjob:Organisation&gt;
  4624. &lt;gjob:Webpage&gt;
  4625. &lt;/gjob:Webpage&gt;
  4626. &lt;gjob:Snailmail&gt;
  4627. &lt;/gjob:Snailmail&gt;
  4628. &lt;gjob:Phone&gt;
  4629. &lt;/gjob:Phone&gt;
  4630. &lt;/gjob:Contact&gt;
  4631. &lt;gjob:Requirements&gt;
  4632. The program should be released as free software, under the GPL.
  4633. &lt;/gjob:Requirements&gt;
  4634. &lt;gjob:Skills&gt;
  4635. &lt;/gjob:Skills&gt;
  4636. &lt;gjob:Details&gt;
  4637. A GNOME based system that will allow a superuser to configure
  4638. compressed and uncompressed files and/or file systems to be backed
  4639. up with a supported media in the system. This should be able to
  4640. perform via find commands generating a list of files that are passed
  4641. to tar, dd, cpio, cp, gzip, etc., to be directed to the tape machine
  4642. or via operations performed on the filesystem itself. Email
  4643. notification and GUI status display very important.
  4644. &lt;/gjob:Details&gt;
  4645. &lt;/gjob:Job&gt;
  4646. &lt;/gjob:Jobs&gt;
  4647. &lt;/gjob:Helping&gt;</pre>
  4648. <p>While loading the XML file into an internal DOM tree is a matter of
  4649. calling only a couple of functions, browsing the tree to gather the data and
  4650. generate the internal structures is harder, and more error prone.</p>
  4651. <p>The suggested principle is to be tolerant with respect to the input
  4652. structure. For example, the ordering of the attributes is not significant,
  4653. the XML specification is clear about it. It's also usually a good idea not to
  4654. depend on the order of the children of a given node, unless it really makes
  4655. things harder. Here is some code to parse the information for a person:</p>
  4656. <pre>/*
  4657. * A person record
  4658. */
  4659. typedef struct person {
  4660. char *name;
  4661. char *email;
  4662. char *company;
  4663. char *organisation;
  4664. char *smail;
  4665. char *webPage;
  4666. char *phone;
  4667. } person, *personPtr;
  4668. /*
  4669. * And the code needed to parse it
  4670. */
  4671. personPtr parsePerson(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
  4672. personPtr ret = NULL;
  4673. DEBUG("parsePerson\n");
  4674. /*
  4675. * allocate the struct
  4676. */
  4677. ret = (personPtr) malloc(sizeof(person));
  4678. if (ret == NULL) {
  4679. fprintf(stderr,"out of memory\n");
  4680. return(NULL);
  4681. }
  4682. memset(ret, 0, sizeof(person));
  4683. /* We don't care what the top level element name is */
  4684. cur = cur-&gt;xmlChildrenNode;
  4685. while (cur != NULL) {
  4686. if ((!strcmp(cur-&gt;name, "Person")) &amp;&amp; (cur-&gt;ns == ns))
  4687. ret-&gt;name = xmlNodeListGetString(doc, cur-&gt;xmlChildrenNode, 1);
  4688. if ((!strcmp(cur-&gt;name, "Email")) &amp;&amp; (cur-&gt;ns == ns))
  4689. ret-&gt;email = xmlNodeListGetString(doc, cur-&gt;xmlChildrenNode, 1);
  4690. cur = cur-&gt;next;
  4691. }
  4692. return(ret);
  4693. }</pre>
  4694. <p>Here are a couple of things to notice:</p>
  4695. <ul>
  4696. <li>Usually a recursive parsing style is the more convenient one: XML data
  4697. is by nature subject to repetitive constructs and usually exhibits highly
  4698. structured patterns.</li>
  4699. <li>The two arguments of type <em>xmlDocPtr</em> and <em>xmlNsPtr</em>,
  4700. i.e. the pointer to the global XML document and the namespace reserved to
  4701. the application. Document wide information are needed for example to
  4702. decode entities and it's a good coding practice to define a namespace for
  4703. your application set of data and test that the element and attributes
  4704. you're analyzing actually pertains to your application space. This is
  4705. done by a simple equality test (cur-&gt;ns == ns).</li>
  4706. <li>To retrieve text and attributes value, you can use the function
  4707. <em>xmlNodeListGetString</em> to gather all the text and entity reference
  4708. nodes generated by the DOM output and produce an single text string.</li>
  4709. </ul>
  4710. <p>Here is another piece of code used to parse another level of the
  4711. structure:</p>
  4712. <pre>#include &lt;libxml/tree.h&gt;
  4713. /*
  4714. * a Description for a Job
  4715. */
  4716. typedef struct job {
  4717. char *projectID;
  4718. char *application;
  4719. char *category;
  4720. personPtr contact;
  4721. int nbDevelopers;
  4722. personPtr developers[100]; /* using dynamic alloc is left as an exercise */
  4723. } job, *jobPtr;
  4724. /*
  4725. * And the code needed to parse it
  4726. */
  4727. jobPtr parseJob(xmlDocPtr doc, xmlNsPtr ns, xmlNodePtr cur) {
  4728. jobPtr ret = NULL;
  4729. DEBUG("parseJob\n");
  4730. /*
  4731. * allocate the struct
  4732. */
  4733. ret = (jobPtr) malloc(sizeof(job));
  4734. if (ret == NULL) {
  4735. fprintf(stderr,"out of memory\n");
  4736. return(NULL);
  4737. }
  4738. memset(ret, 0, sizeof(job));
  4739. /* We don't care what the top level element name is */
  4740. cur = cur-&gt;xmlChildrenNode;
  4741. while (cur != NULL) {
  4742. if ((!strcmp(cur-&gt;name, "Project")) &amp;&amp; (cur-&gt;ns == ns)) {
  4743. ret-&gt;projectID = xmlGetProp(cur, "ID");
  4744. if (ret-&gt;projectID == NULL) {
  4745. fprintf(stderr, "Project has no ID\n");
  4746. }
  4747. }
  4748. if ((!strcmp(cur-&gt;name, "Application")) &amp;&amp; (cur-&gt;ns == ns))
  4749. ret-&gt;application = xmlNodeListGetString(doc, cur-&gt;xmlChildrenNode, 1);
  4750. if ((!strcmp(cur-&gt;name, "Category")) &amp;&amp; (cur-&gt;ns == ns))
  4751. ret-&gt;category = xmlNodeListGetString(doc, cur-&gt;xmlChildrenNode, 1);
  4752. if ((!strcmp(cur-&gt;name, "Contact")) &amp;&amp; (cur-&gt;ns == ns))
  4753. ret-&gt;contact = parsePerson(doc, ns, cur);
  4754. cur = cur-&gt;next;
  4755. }
  4756. return(ret);
  4757. }</pre>
  4758. <p>Once you are used to it, writing this kind of code is quite simple, but
  4759. boring. Ultimately, it could be possible to write stubbers taking either C
  4760. data structure definitions, a set of XML examples or an XML DTD and produce
  4761. the code needed to import and export the content between C data and XML
  4762. storage. This is left as an exercise to the reader :-)</p>
  4763. <p>Feel free to use <a href="example/gjobread.c">the code for the full C
  4764. parsing example</a> as a template, it is also available with Makefile in the
  4765. Gnome SVN base under libxml2/example</p>
  4766. <h2><a name="Contributi">Contributions</a></h2>
  4767. <ul>
  4768. <li>Bjorn Reese, William Brack and Thomas Broyer have provided a number of
  4769. patches, Gary Pennington worked on the validation API, threading support
  4770. and Solaris port.</li>
  4771. <li>John Fleck helps maintaining the documentation and man pages.</li>
  4772. <li><a href="mailto:igor@zlatkovic.com">Igor Zlatkovic</a> is now the
  4773. maintainer of the Windows port, <a
  4774. href="http://www.zlatkovic.com/projects/libxml/index.html">he provides
  4775. binaries</a></li>
  4776. <li><a href="mailto:Gary.Pennington@sun.com">Gary Pennington</a> provides
  4777. <a href="http://garypennington.net/libxml2/">Solaris binaries</a></li>
  4778. <li><a
  4779. href="http://mail.gnome.org/archives/xml/2001-March/msg00014.html">Matt
  4780. Sergeant</a> developed <a
  4781. href="http://axkit.org/download/">XML::LibXSLT</a>, a Perl wrapper for
  4782. libxml2/libxslt as part of the <a href="http://axkit.com/">AxKit XML
  4783. application server</a></li>
  4784. <li><a href="mailto:fnatter@gmx.net">Felix Natter</a> and <a
  4785. href="mailto:geertk@ai.rug.nl">Geert Kloosterman</a> provide <a
  4786. href="libxml-doc.el">an emacs module</a> to lookup libxml(2) functions
  4787. documentation</li>
  4788. <li><a href="mailto:sherwin@nlm.nih.gov">Ziying Sherwin</a> provided <a
  4789. href="http://xmlsoft.org/messages/0488.html">man pages</a></li>
  4790. <li>there is a module for <a
  4791. href="http://acs-misc.sourceforge.net/nsxml.html">libxml/libxslt support
  4792. in OpenNSD/AOLServer</a></li>
  4793. <li><a href="mailto:dkuhlman@cutter.rexx.com">Dave Kuhlman</a> provided the
  4794. first version of libxml/libxslt <a
  4795. href="http://www.rexx.com/~dkuhlman">wrappers for Python</a></li>
  4796. <li>Petr Kozelka provides <a
  4797. href="http://sourceforge.net/projects/libxml2-pas">Pascal units to glue
  4798. libxml2</a> with Kylix and Delphi and other Pascal compilers</li>
  4799. <li><a href="mailto:aleksey@aleksey.com">Aleksey Sanin</a> implemented the
  4800. <a href="http://www.w3.org/Signature/">XML Canonicalization and XML
  4801. Digital Signature</a> <a
  4802. href="http://www.aleksey.com/xmlsec/">implementations for libxml2</a></li>
  4803. <li><a href="mailto:Steve.Ball@explain.com.au">Steve Ball</a> and
  4804. contributors maintain <a href="http://tclxml.sourceforge.net/">tcl
  4805. bindings for libxml2 and libxslt</a>, as well as <a
  4806. href="http://tclxml.sf.net/tkxmllint.html">tkxmllint</a> a GUI for
  4807. xmllint and <a href="http://tclxml.sf.net/tkxsltproc.html">tkxsltproc</a>
  4808. a GUI for xsltproc.</li>
  4809. </ul>
  4810. <p></p>
  4811. </body>
  4812. </html>