mxml.html 186 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Mini-XML Programmers Manual, Version 2.10</TITLE>
  5. <META NAME="author" CONTENT="Michael R Sweet">
  6. <META NAME="copyright" CONTENT="Copyright 2003-2016">
  7. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1">
  8. <STYLE TYPE="text/css"><!--
  9. BODY { font-family: sans-serif }
  10. H1 { font-family: sans-serif }
  11. H2 { font-family: sans-serif }
  12. H3 { font-family: sans-serif }
  13. H4 { font-family: sans-serif }
  14. H5 { font-family: sans-serif }
  15. H6 { font-family: sans-serif }
  16. SUB { font-size: smaller }
  17. SUP { font-size: smaller }
  18. PRE { font-family: monospace }
  19. A { text-decoration: none }
  20. --></STYLE>
  21. </HEAD>
  22. <BODY>
  23. <H1 ALIGN="CENTER"><A NAME="CONTENTS">Table of Contents</A></H1>
  24. <BR>
  25. <BR><B><A HREF="#INTRO">Introduction</A></B>
  26. <UL>
  27. <LI><A HREF="#1_1">Organization of This Document</A></LI>
  28. <LI><A HREF="#1_2">Notation Conventions</A></LI>
  29. <LI><A HREF="#1_3">Abbreviations</A></LI>
  30. <LI><A HREF="#1_4">Other References</A></LI>
  31. <LI><A HREF="#1_5">Legal Stuff</A></LI>
  32. </UL>
  33. <B><A HREF="#INSTALL">Building, Installing, and Packaging Mini-XML</A></B>
  34. <UL>
  35. <LI><A HREF="#2_1">Compiling Mini-XML</A>
  36. <UL>
  37. <LI><A HREF="#2_1_1">Compiling with Visual C++</A></LI>
  38. <LI><A HREF="#2_1_2">Compiling with Command-Line Tools</A></LI>
  39. </UL>
  40. </LI>
  41. <LI><A HREF="#2_2">Installing Mini-XML</A></LI>
  42. <LI><A HREF="#2_3">Creating Mini-XML Packages</A></LI>
  43. </UL>
  44. <B><A HREF="#BASICS">Getting Started with Mini-XML</A></B>
  45. <UL>
  46. <LI><A HREF="#3_1">The Basics</A></LI>
  47. <LI><A HREF="#3_2">Nodes</A>
  48. <UL>
  49. <LI><A HREF="#3_2_1">CDATA Nodes</A></LI>
  50. <LI><A HREF="#3_2_2">Custom Nodes</A></LI>
  51. <LI><A HREF="#3_2_3">Comment Nodes</A></LI>
  52. <LI><A HREF="#3_2_4">Element Nodes</A></LI>
  53. <LI><A HREF="#3_2_5">Integer Nodes</A></LI>
  54. <LI><A HREF="#3_2_6">Opaque Nodes</A></LI>
  55. <LI><A HREF="#3_2_7">Text Nodes</A></LI>
  56. <LI><A HREF="#3_2_8">Processing Instruction Nodes</A></LI>
  57. <LI><A HREF="#3_2_9">Real Number Nodes</A></LI>
  58. <LI><A HREF="#3_2_10">XML Declaration Nodes</A></LI>
  59. </UL>
  60. </LI>
  61. <LI><A HREF="#3_3">Creating XML Documents</A></LI>
  62. <LI><A HREF="#3_4">Loading XML</A></LI>
  63. <LI><A HREF="#3_5">Saving XML</A>
  64. <UL>
  65. <LI><A HREF="#3_5_1">Controlling Line Wrapping</A></LI>
  66. </UL>
  67. </LI>
  68. <LI><A HREF="#3_6">Memory Management</A></LI>
  69. <LI><A HREF="#3_7">Finding and Iterating Nodes</A></LI>
  70. <LI><A HREF="#3_8">Finding Specific Nodes</A></LI>
  71. </UL>
  72. <B><A HREF="#ADVANCED">More Mini-XML Programming Techniques</A></B>
  73. <UL>
  74. <LI><A HREF="#LOAD_CALLBACKS">Load Callbacks</A></LI>
  75. <LI><A HREF="#SAVE_CALLBACKS">Save Callbacks</A></LI>
  76. <LI><A HREF="#4_3">Custom Data Types</A></LI>
  77. <LI><A HREF="#4_4">Changing Node Values</A></LI>
  78. <LI><A HREF="#4_5">Formatted Text</A></LI>
  79. <LI><A HREF="#4_6">Indexing</A></LI>
  80. <LI><A HREF="#4_7">SAX (Stream) Loading of Documents</A></LI>
  81. </UL>
  82. <B><A HREF="#MXMLDOC">Using the mxmldoc Utility</A></B>
  83. <UL>
  84. <LI><A HREF="#5_1">The Basics</A>
  85. <UL>
  86. <LI><A HREF="#5_1_1">Creating Man Pages</A></LI>
  87. <LI><A HREF="#5_1_2">Creating Xcode Documentation Sets</A></LI>
  88. </UL>
  89. </LI>
  90. <LI><A HREF="#5_2">Commenting Your Code</A></LI>
  91. <LI><A HREF="#5_3">Titles, Sections, and Introductions</A></LI>
  92. </UL>
  93. <B><A HREF="#LICENSE">Mini-XML License</A></B>
  94. <BR>
  95. <BR><B><A HREF="#RELNOTES">Release Notes</A></B>
  96. <UL></UL>
  97. <B><A HREF="#REFERENCE">Library Reference</A></B>
  98. <UL>
  99. <LI><A HREF="#8_1">Contents</A></LI>
  100. <LI><A HREF="#FUNCTIONS">Functions</A>
  101. <UL>
  102. <LI><A HREF="#mxmlAdd">mxmlAdd</A></LI>
  103. <LI><A HREF="#mxmlDelete">mxmlDelete</A></LI>
  104. <LI><A HREF="#8_2_3">mxmlElementDeleteAttr</A></LI>
  105. <LI><A HREF="#mxmlElementGetAttr">mxmlElementGetAttr</A></LI>
  106. <LI><A HREF="#mxmlElementSetAttr">mxmlElementSetAttr</A></LI>
  107. <LI><A HREF="#8_2_6">mxmlElementSetAttrf</A></LI>
  108. <LI><A HREF="#mxmlEntityAddCallback">mxmlEntityAddCallback</A></LI>
  109. <LI><A HREF="#mxmlEntityGetName">mxmlEntityGetName</A></LI>
  110. <LI><A HREF="#mxmlEntityGetValue">mxmlEntityGetValue</A></LI>
  111. <LI><A HREF="#mxmlEntityRemoveCallback">mxmlEntityRemoveCallback</A></LI>
  112. <LI><A HREF="#mxmlFindElement">mxmlFindElement</A></LI>
  113. <LI><A HREF="#8_2_12">mxmlFindPath</A></LI>
  114. <LI><A HREF="#8_2_13">mxmlGetCDATA</A></LI>
  115. <LI><A HREF="#8_2_14">mxmlGetCustom</A></LI>
  116. <LI><A HREF="#8_2_15">mxmlGetElement</A></LI>
  117. <LI><A HREF="#8_2_16">mxmlGetFirstChild</A></LI>
  118. <LI><A HREF="#8_2_17">mxmlGetInteger</A></LI>
  119. <LI><A HREF="#8_2_18">mxmlGetLastChild</A></LI>
  120. <LI><A HREF="#mxmlGetNextSibling">mxmlGetNextSibling</A></LI>
  121. <LI><A HREF="#8_2_20">mxmlGetOpaque</A></LI>
  122. <LI><A HREF="#8_2_21">mxmlGetParent</A></LI>
  123. <LI><A HREF="#8_2_22">mxmlGetPrevSibling</A></LI>
  124. <LI><A HREF="#8_2_23">mxmlGetReal</A></LI>
  125. <LI><A HREF="#8_2_24">mxmlGetRefCount</A></LI>
  126. <LI><A HREF="#8_2_25">mxmlGetText</A></LI>
  127. <LI><A HREF="#8_2_26">mxmlGetType</A></LI>
  128. <LI><A HREF="#8_2_27">mxmlGetUserData</A></LI>
  129. <LI><A HREF="#mxmlIndexDelete">mxmlIndexDelete</A></LI>
  130. <LI><A HREF="#mxmlIndexEnum">mxmlIndexEnum</A></LI>
  131. <LI><A HREF="#mxmlIndexFind">mxmlIndexFind</A></LI>
  132. <LI><A HREF="#8_2_31">mxmlIndexGetCount</A></LI>
  133. <LI><A HREF="#mxmlIndexNew">mxmlIndexNew</A></LI>
  134. <LI><A HREF="#mxmlIndexReset">mxmlIndexReset</A></LI>
  135. <LI><A HREF="#mxmlLoadFd">mxmlLoadFd</A></LI>
  136. <LI><A HREF="#mxmlLoadFile">mxmlLoadFile</A></LI>
  137. <LI><A HREF="#mxmlLoadString">mxmlLoadString</A></LI>
  138. <LI><A HREF="#8_2_37">mxmlNewCDATA</A></LI>
  139. <LI><A HREF="#8_2_38">mxmlNewCustom</A></LI>
  140. <LI><A HREF="#mxmlNewElement">mxmlNewElement</A></LI>
  141. <LI><A HREF="#mxmlNewInteger">mxmlNewInteger</A></LI>
  142. <LI><A HREF="#mxmlNewOpaque">mxmlNewOpaque</A></LI>
  143. <LI><A HREF="#mxmlNewReal">mxmlNewReal</A></LI>
  144. <LI><A HREF="#mxmlNewText">mxmlNewText</A></LI>
  145. <LI><A HREF="#mxmlNewTextf">mxmlNewTextf</A></LI>
  146. <LI><A HREF="#8_2_45">mxmlNewXML</A></LI>
  147. <LI><A HREF="#8_2_46">mxmlRelease</A></LI>
  148. <LI><A HREF="#mxmlRemove">mxmlRemove</A></LI>
  149. <LI><A HREF="#8_2_48">mxmlRetain</A></LI>
  150. <LI><A HREF="#8_2_49">mxmlSAXLoadFd</A></LI>
  151. <LI><A HREF="#8_2_50">mxmlSAXLoadFile</A></LI>
  152. <LI><A HREF="#8_2_51">mxmlSAXLoadString</A></LI>
  153. <LI><A HREF="#mxmlSaveAllocString">mxmlSaveAllocString</A></LI>
  154. <LI><A HREF="#mxmlSaveFd">mxmlSaveFd</A></LI>
  155. <LI><A HREF="#mxmlSaveFile">mxmlSaveFile</A></LI>
  156. <LI><A HREF="#mxmlSaveString">mxmlSaveString</A></LI>
  157. <LI><A HREF="#8_2_56">mxmlSetCDATA</A></LI>
  158. <LI><A HREF="#8_2_57">mxmlSetCustom</A></LI>
  159. <LI><A HREF="#mxmlSetCustomHandlers">mxmlSetCustomHandlers</A></LI>
  160. <LI><A HREF="#mxmlSetElement">mxmlSetElement</A></LI>
  161. <LI><A HREF="#mxmlSetErrorCallback">mxmlSetErrorCallback</A></LI>
  162. <LI><A HREF="#mxmlSetInteger">mxmlSetInteger</A></LI>
  163. <LI><A HREF="#mxmlSetOpaque">mxmlSetOpaque</A></LI>
  164. <LI><A HREF="#mxmlSetReal">mxmlSetReal</A></LI>
  165. <LI><A HREF="#mxmlSetText">mxmlSetText</A></LI>
  166. <LI><A HREF="#mxmlSetTextf">mxmlSetTextf</A></LI>
  167. <LI><A HREF="#8_2_66">mxmlSetUserData</A></LI>
  168. <LI><A HREF="#8_2_67">mxmlSetWrapMargin</A></LI>
  169. <LI><A HREF="#mxmlWalkNext">mxmlWalkNext</A></LI>
  170. <LI><A HREF="#mxmlWalkPrev">mxmlWalkPrev</A></LI>
  171. </UL>
  172. </LI>
  173. <LI><A HREF="#TYPES">Data Types</A>
  174. <UL>
  175. <LI><A HREF="#mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</A></LI>
  176. <LI><A HREF="#mxml_custom_load_cb_t">mxml_custom_load_cb_t</A></LI>
  177. <LI><A HREF="#mxml_custom_save_cb_t">mxml_custom_save_cb_t</A></LI>
  178. <LI><A HREF="#mxml_entity_cb_t">mxml_entity_cb_t</A></LI>
  179. <LI><A HREF="#mxml_error_cb_t">mxml_error_cb_t</A></LI>
  180. <LI><A HREF="#mxml_index_t">mxml_index_t</A></LI>
  181. <LI><A HREF="#mxml_load_cb_t">mxml_load_cb_t</A></LI>
  182. <LI><A HREF="#mxml_node_t">mxml_node_t</A></LI>
  183. <LI><A HREF="#mxml_save_cb_t">mxml_save_cb_t</A></LI>
  184. <LI><A HREF="#mxml_sax_cb_t">mxml_sax_cb_t</A></LI>
  185. <LI><A HREF="#mxml_sax_event_t">mxml_sax_event_t</A></LI>
  186. <LI><A HREF="#mxml_type_t">mxml_type_t</A></LI>
  187. </UL>
  188. </LI>
  189. <LI><A HREF="#ENUMERATIONS">Constants</A>
  190. <UL>
  191. <LI><A HREF="#mxml_sax_event_e">mxml_sax_event_e</A></LI>
  192. <LI><A HREF="#mxml_type_e">mxml_type_e</A></LI>
  193. </UL>
  194. </LI>
  195. </UL>
  196. <B><A HREF="#SCHEMA">XML Schema</A></B>
  197. <UL></UL>
  198. <HR NOSHADE>
  199. <H1 align="right"><A name="INTRO"><IMG align="right" alt="0" height="100"
  200. hspace="10" src="0.gif" width="100"></A>Introduction</H1>
  201. <P>This programmers manual describes Mini-XML version 2.10, a small XML
  202. parsing library that you can use to read and write XML data files in
  203. your C and C++ applications.</P>
  204. <P>Mini-XML was initially developed for the <A href="http://gutenprint.sf.net/">
  205. Gutenprint</A> project to replace the rather large and unwieldy <TT>
  206. libxml2</TT> library with something substantially smaller and
  207. easier-to-use. It all began one morning in June of 2003 when Robert
  208. posted the following sentence to the developer's list:</P>
  209. <BLOCKQUOTE><EM>It's bad enough that we require libxml2, but rolling our
  210. own XML parser is a bit more than we can handle.</EM></BLOCKQUOTE>
  211. <P>I then replied with:</P>
  212. <BLOCKQUOTE><EM>Given the limited scope of what you use in XML, it
  213. should be trivial to code a mini-XML API in a few hundred lines of
  214. code.</EM></BLOCKQUOTE>
  215. <P>I took my own challenge and coded furiously for two days to produced
  216. the initial public release of Mini-XML, total lines of code: 696.
  217. Robert promptly integrated Mini-XML into Gutenprint and removed
  218. libxml2.</P>
  219. <P>Thanks to lots of feedback and support from various developers,
  220. Mini-XML has evolved since then to provide a more complete XML
  221. implementation and now stands at a whopping 3,792 lines of code,
  222. compared to 140,410 lines of code for libxml2 version 2.9.1.</P>
  223. <P>Aside from Gutenprint, Mini-XML is used for the following
  224. projects/software applications:</P>
  225. <UL>
  226. <LI><A href="https://www.cups.org/">CUPS</A></LI>
  227. <LI><A href="http://zynaddsubfx.sourceforge.net">ZynAddSubFX</A></LI>
  228. </UL>
  229. <P>Please file a bug on msweet.org if you would like your project added
  230. or removed from this list, or if you have any comments/quotes you would
  231. like me to publish about your experiences with Mini-XML.</P>
  232. <!-- NEED 1in -->
  233. <H2><A NAME="1_1">Organization of This Document</A></H2>
  234. <P>This manual is organized into the following chapters and appendices:</P>
  235. <UL>
  236. <LI>Chapter 1, &quot;<A href="#INSTALL">Building, Installing, and Packaging
  237. Mini-XML</A>&quot;, provides compilation, installation, and packaging
  238. instructions for Mini-XML.</LI>
  239. <LI>Chapter 2, &quot;<A href="#BASICS">Getting Started with Mini-XML</A>&quot;,
  240. shows how to use the Mini-XML library in your programs.</LI>
  241. <LI>Chapter 3, &quot;<A href="#ADVANCED">More Mini-XML Programming Techniques</A>
  242. &quot;, shows additional ways to use the Mini-XML library.</LI>
  243. <LI>Chapter 4, &quot;<A href="#MXMLDOC">Using the mxmldoc Utility</A>&quot;,
  244. describes how to use the <TT>mxmldoc(1)</TT> program to generate
  245. software documentation.</LI>
  246. <LI>Appendix A, &quot;<A href="#LICENSE">Mini-XML License</A>&quot;, provides the
  247. terms and conditions for using and distributing Mini-XML.</LI>
  248. <LI>Appendix B, &quot;<A href="#RELNOTES">Release Notes</A>&quot;, lists the
  249. changes in each release of Mini-XML.</LI>
  250. <LI>Appendix C, &quot;<A href="#REFERENCE">Library Reference</A>&quot;, contains a
  251. complete reference for Mini-XML, generated by <TT>mxmldoc</TT>.</LI>
  252. <LI>Appendix D, &quot;<A href="#SCHEMA">XML Schema</A>&quot;, shows the XML schema
  253. used for the XML files produced by <TT>mxmldoc</TT>.</LI>
  254. </UL>
  255. <!-- NEED 10 -->
  256. <H2><A NAME="1_2">Notation Conventions</A></H2>
  257. <P>Various font and syntax conventions are used in this guide. Examples
  258. and their meanings and uses are explained below:</P>
  259. <DL>
  260. <DT><CODE>mxmldoc</CODE>
  261. <BR> <CODE>mxmldoc(1)</CODE></DT>
  262. <DD>The names of commands; the first mention of a command or function in
  263. a chapter is followed by a manual page section number.
  264. <BR>
  265. <BR></DD>
  266. <DT><VAR>/var</VAR>
  267. <BR><VAR> /etc/hosts</VAR></DT>
  268. <DD>File and directory names.
  269. <BR>
  270. <BR></DD>
  271. <DT><TT>Request ID is Printer-123</TT></DT>
  272. <DD>Screen output.
  273. <BR>
  274. <BR></DD>
  275. <DT><KBD>lp -d printer filename ENTER</KBD></DT>
  276. <DD>Literal user input; special keys like <KBD>ENTER</KBD> are in ALL
  277. CAPS.
  278. <BR>
  279. <BR></DD>
  280. <DT>12.3</DT>
  281. <DD>Numbers in the text are written using the period (.) to indicate the
  282. decimal point.
  283. <BR>
  284. <BR></DD>
  285. </DL>
  286. <!-- NEED 10 -->
  287. <H2><A NAME="1_3">Abbreviations</A></H2>
  288. <P>The following abbreviations are used throughout this manual:</P>
  289. <DL>
  290. <DT>Gb</DT>
  291. <DD>Gigabytes, or 1073741824 bytes
  292. <BR>
  293. <BR></DD>
  294. <DT>kb</DT>
  295. <DD>Kilobytes, or 1024 bytes
  296. <BR>
  297. <BR></DD>
  298. <DT>Mb</DT>
  299. <DD>Megabytes, or 1048576 bytes
  300. <BR>
  301. <BR></DD>
  302. <DT>UTF-8, UTF-16</DT>
  303. <DD>Unicode Transformation Format, 8-bit or 16-bit
  304. <BR>
  305. <BR></DD>
  306. <DT>W3C</DT>
  307. <DD>World Wide Web Consortium
  308. <BR>
  309. <BR></DD>
  310. <DT>XML</DT>
  311. <DD>Extensible Markup Language
  312. <BR>
  313. <BR></DD>
  314. </DL>
  315. <!-- NEED 12 -->
  316. <H2><A NAME="1_4">Other References</A></H2>
  317. <DL>
  318. <DT>The Unicode Standard, Version 4.0, Addison-Wesley, ISBN
  319. 0-321-18578-1</DT>
  320. <DD>The definition of the Unicode character set which is used for XML.
  321. <BR>
  322. <BR></DD>
  323. <DT><A href="http://www.w3.org/TR/2004/REC-xml-20040204/">Extensible
  324. Markup Language (XML) 1.0 (Third Edition)</A></DT>
  325. <DD>The XML specification from the World Wide Web Consortium (W3C)
  326. <BR>
  327. <BR></DD>
  328. </DL>
  329. <!-- NEED 6 -->
  330. <H2><A NAME="1_5">Legal Stuff</A></H2>
  331. <P>The Mini-XML library is copyright 2003-2016 by Michael R Sweet.
  332. License terms are described in <A href="#LICENSE">Appendix A - Mini-XML
  333. License</A>.</P>
  334. <HR NOSHADE>
  335. <H1 align="right"><A name="INSTALL"><IMG align="right" alt="1" height="100"
  336. hspace="10" src="1.gif" width="100"></A>Building, Installing, and
  337. Packaging Mini-XML</H1>
  338. <P>This chapter describes how to build, install, and package Mini-XML on
  339. your system from the source archive. You will need an ANSI/ISO-C
  340. compatible compiler to build Mini-XML - GCC works, as do most vendors'
  341. C compilers. If you are building Mini-XML on Windows, we recommend
  342. using the Visual C++ environment with the supplied solution file. For
  343. other operating systems, you'll need a POSIX-compatible shell and <TT>
  344. make</TT> program in addition to the C compiler.</P>
  345. <H2><A NAME="2_1">Compiling Mini-XML</A></H2>
  346. <P>Mini-XML comes with both an autoconf-based configure script and a
  347. Visual C++ solution that can be used to compile the library and
  348. associated tools.</P>
  349. <H3><A NAME="2_1_1">Compiling with Visual C++</A></H3>
  350. <P>Open the<VAR> mxml.sln</VAR> solution in the<VAR> vcnet</VAR> folder.
  351. Choose the desired build configuration, &quot;Debug&quot; (the default) or
  352. &quot;Release&quot;, and then choose<VAR> Build Solution</VAR> from the<VAR>
  353. Build</VAR> menu.</P>
  354. <H3><A NAME="2_1_2">Compiling with Command-Line Tools</A></H3>
  355. <P>Type the following command to configure the Mini-XML source code for
  356. your system:</P>
  357. <PRE>
  358. <KBD>./configure ENTER</KBD>
  359. </PRE>
  360. <P>The default install prefix is<VAR> /usr/local</VAR>, which can be
  361. overridden using the <KBD>--prefix</KBD> option:</P>
  362. <PRE>
  363. <KBD>./configure --prefix=/foo ENTER</KBD>
  364. </PRE>
  365. <P>Other configure options can be found using the <KBD>--help</KBD>
  366. option:</P>
  367. <PRE>
  368. <KBD>./configure --help ENTER</KBD>
  369. </PRE>
  370. <P>Once you have configured the software, use the <TT>make(1)</TT>
  371. program to do the build and run the test program to verify that things
  372. are working, as follows:</P>
  373. <PRE>
  374. <KBD>make ENTER</KBD>
  375. </PRE>
  376. <H2><A NAME="2_2">Installing Mini-XML</A></H2>
  377. <P>If you are using Visual C++, copy the<VAR> mxml.lib</VAR> and and<VAR>
  378. mxml.h</VAR> files to the Visual C++<VAR> lib</VAR> and<VAR> include<VAR>
  379. directories, respectively.</VAR></VAR></P>
  380. <P>Otherwise, use the <TT>make</TT> command with the <KBD>install</KBD>
  381. target to install Mini-XML in the configured directories:</P>
  382. <PRE>
  383. <KBD>make install ENTER</KBD>
  384. </PRE>
  385. <H2><A NAME="2_3">Creating Mini-XML Packages</A></H2>
  386. <P>Mini-XML includes two files that can be used to create binary
  387. packages. The first file is<VAR> mxml.spec</VAR> which is used by the <TT>
  388. rpmbuild(8)</TT> software to create Red Hat Package Manager (&quot;RPM&quot;)
  389. packages which are commonly used on Linux. Since <TT>rpmbuild</TT>
  390. wants to compile the software on its own, you can provide it with the
  391. Mini-XML tar file to build the package:</P>
  392. <PRE>
  393. <KBD>rpmbuild -ta mxml-<I>version</I>.tar.gz ENTER</KBD>
  394. </PRE>
  395. <P>The second file is<VAR> mxml.list</VAR> which is used by the <TT>
  396. epm(1)</TT> program to create software packages in a variety of formats.
  397. The <TT>epm</TT> program is available from the following URL:</P>
  398. <PRE>
  399. <A href="http://www.epmhome.org/">http://www.epmhome.org/</A>
  400. </PRE>
  401. <P>Use the <TT>make</TT> command with the <KBD>epm</KBD> target to
  402. create portable and native packages for your system:</P>
  403. <PRE>
  404. <KBD>make epm ENTER</KBD>
  405. </PRE>
  406. <P>The packages are stored in a subdirectory named<VAR> dist</VAR> for
  407. your convenience. The portable packages utilize scripts and tar files
  408. to install the software on the target system. After extracting the
  409. package archive, use the<VAR> mxml.install</VAR> script to install the
  410. software.</P>
  411. <P>The native packages will be in the local OS's native format: RPM for
  412. Red Hat Linux, DPKG for Debian Linux, PKG for Solaris, and so forth.
  413. Use the corresponding commands to install the native packages.</P>
  414. <HR NOSHADE>
  415. <H1 align="right"><A name="BASICS"><IMG align="right" alt="2" height="100"
  416. hspace="10" src="2.gif" width="100"></A>Getting Started with Mini-XML</H1>
  417. <P>This chapter describes how to write programs that use Mini-XML to
  418. access data in an XML file. Mini-XML provides the following
  419. functionality:</P>
  420. <UL>
  421. <LI>Functions for creating and managing XML documents in memory.</LI>
  422. <LI>Reading of UTF-8 and UTF-16 encoded XML files and strings.</LI>
  423. <LI>Writing of UTF-8 encoded XML files and strings.</LI>
  424. <LI>Support for arbitrary element names, attributes, and attribute
  425. values with no preset limits, just available memory.</LI>
  426. <LI>Support for integer, real, opaque (&quot;CDATA&quot;), and text data types in
  427. &quot;leaf&quot; nodes.</LI>
  428. <LI>&quot;Find&quot;, &quot;index&quot;, and &quot;walk&quot; functions for easily accessing data in
  429. an XML document.</LI>
  430. </UL>
  431. <P>Mini-XML doesn't do validation or other types of processing on the
  432. data based upon schema files or other sources of definition
  433. information, nor does it support character entities other than those
  434. required by the XML specification.</P>
  435. <H2><A NAME="3_1">The Basics</A></H2>
  436. <P>Mini-XML provides a single header file which you include:</P>
  437. <PRE>
  438. #include &lt;mxml.h&gt;
  439. </PRE>
  440. <P>The Mini-XML library is included with your program using the <KBD>
  441. -lmxml</KBD> option:</P>
  442. <PRE>
  443. <KBD>gcc -o myprogram myprogram.c -lmxml ENTER</KBD>
  444. </PRE>
  445. <P>If you have the <TT>pkg-config(1)</TT> software installed, you can
  446. use it to determine the proper compiler and linker options for your
  447. installation:</P>
  448. <PRE>
  449. <KBD>pkg-config --cflags mxml ENTER</KBD>
  450. <KBD>pkg-config --libs mxml ENTER</KBD>
  451. </PRE>
  452. <H2><A NAME="3_2">Nodes</A></H2>
  453. <P>Every piece of information in an XML file is stored in memory in
  454. &quot;nodes&quot;. Nodes are defined by the <A href="#mxml_node_t"><TT>
  455. mxml_node_t</TT></A> structure. Each node has a typed value, optional
  456. user data, a parent node, sibling nodes (previous and next), and
  457. potentially child nodes.</P>
  458. <P>For example, if you have an XML file like the following:</P>
  459. <PRE>
  460. &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  461. &lt;data&gt;
  462. &lt;node&gt;val1&lt;/node&gt;
  463. &lt;node&gt;val2&lt;/node&gt;
  464. &lt;node&gt;val3&lt;/node&gt;
  465. &lt;group&gt;
  466. &lt;node&gt;val4&lt;/node&gt;
  467. &lt;node&gt;val5&lt;/node&gt;
  468. &lt;node&gt;val6&lt;/node&gt;
  469. &lt;/group&gt;
  470. &lt;node&gt;val7&lt;/node&gt;
  471. &lt;node&gt;val8&lt;/node&gt;
  472. &lt;/data&gt;
  473. </PRE>
  474. <P>the node tree for the file would look like the following in memory:</P>
  475. <PRE>
  476. ?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?
  477. |
  478. data
  479. |
  480. node - node - node - group - node - node
  481. | | | | | |
  482. val1 val2 val3 | val7 val8
  483. |
  484. node - node - node
  485. | | |
  486. val4 val5 val6
  487. </PRE>
  488. <P>where &quot;-&quot; is a pointer to the sibling node and &quot;|&quot; is a pointer to
  489. the first child or parent node.</P>
  490. <P>The <A href="#mxmlGetType"><TT>mxmlGetType</TT></A> function gets the
  491. type of a node, one of <TT>MXML_CUSTOM</TT>, <TT>MXML_ELEMENT</TT>, <TT>
  492. MXML_INTEGER</TT>, <TT>MXML_OPAQUE</TT>, <TT>MXML_REAL</TT>, or <TT>
  493. MXML_TEXT</TT>. The parent and sibling nodes are accessed using the <A href="#mxmlGetParent">
  494. <TT>mxmlGetParent</TT></A>, <A href="#mxmlGetNext"><TT>mxmlGetNext</TT></A>
  495. , and <A href="#mxmlGetPrevious"><TT>mxmlGetPrevious</TT></A> functions.
  496. The <A href="#mxmlGetUserData"><TT>mxmlGetUserData</TT></A> function
  497. gets any user data associated with the node.</P>
  498. <H3><A NAME="3_2_1">CDATA Nodes</A></H3>
  499. <P>CDATA (<TT>MXML_ELEMENT</TT>) nodes are created using the <A href="#mxmlNewCDATA">
  500. <TT>mxmlNewCDATA</TT></A> function. The <A href="#mxmlGetCDATA"><TT>
  501. mxmlGetCDATA</TT></A> function retrieves the CDATA string pointer for a
  502. node.</P>
  503. <BLOCKQUOTE><B>Note:</B>
  504. <P>CDATA nodes are currently stored in memory as special elements. This
  505. will be changed in a future major release of Mini-XML.</P>
  506. </BLOCKQUOTE>
  507. <H3><A NAME="3_2_2">Custom Nodes</A></H3>
  508. <P>Custom (<TT>MXML_CUSTOM</TT>) nodes are created using the <A href="#mxmlNewCustom">
  509. <TT>mxmlNewCustom</TT></A> function or using a custom load callback
  510. specified using the <A href="#mxmlSetCustomHandlers"><TT>
  511. mxmlSetCustomHandlers</TT></A> function. The <A href="#mxmlGetCustom"><TT>
  512. mxmlGetCustom</TT></A> function retrieves the custom value pointer for a
  513. node.</P>
  514. <H3><A NAME="3_2_3">Comment Nodes</A></H3>
  515. <P>Comment (<TT>MXML_ELEMENT</TT>) nodes are created using the <A href="#mxmlNewElement">
  516. <TT>mxmlNewElement</TT></A> function. The <A href="#mxmlGetElement"><TT>
  517. mxmlGetElement</TT></A> function retrieves the comment string pointer
  518. for a node, including the surrounding &quot;!--&quot; and &quot;--&quot; characters.</P>
  519. <BLOCKQUOTE><B>Note:</B>
  520. <P>Comment nodes are currently stored in memory as special elements.
  521. This will be changed in a future major release of Mini-XML.</P>
  522. </BLOCKQUOTE>
  523. <H3><A NAME="3_2_4">Element Nodes</A></H3>
  524. <P>Element (<TT>MXML_ELEMENT</TT>) nodes are created using the <A href="#mxmlNewElement">
  525. <TT>mxmlNewElement</TT></A> function. The <A href="#mxmlGetElement"><TT>
  526. mxmlGetElement</TT></A> function retrieves the element name, the <A href="#mxmlElementGetAttr">
  527. <TT>mxmlElementGetAttr</TT></A> function retrieves the value string for
  528. a named attribute associated with the element, and the <A href="#mxmlGetFirstChild">
  529. <TT>mxmlGetFirstChild</TT></A> and <A href="#mxmlGetLastChild"><TT>
  530. mxmlGetLastChild</TT></A> functions retrieve the first and last child
  531. nodes for the element, respectively.</P>
  532. <H3><A NAME="3_2_5">Integer Nodes</A></H3>
  533. <P>Integer (<TT>MXML_INTEGER</TT>) nodes are created using the <A href="#mxmlNewInteger">
  534. <TT>mxmlNewInteger</TT></A> function. The <A href="#mxmlGetInteger"><TT>
  535. mxmlGetInteger</TT></A> function retrieves the integer value for a node.</P>
  536. <H3><A NAME="3_2_6">Opaque Nodes</A></H3>
  537. <P>Opaque (<TT>MXML_OPAQUE</TT>) nodes are created using the <A href="#mxmlNewOpaque">
  538. <TT>mxmlNewOpaque</TT></A> function. The <A href="#mxmlGetOpaque"><TT>
  539. mxmlGetOpaque</TT></A> function retrieves the opaque string pointer for
  540. a node. Opaque nodes are like string nodes but preserve all whitespace
  541. between nodes.</P>
  542. <H3><A NAME="3_2_7">Text Nodes</A></H3>
  543. <P>Text (<TT>MXML_TEXT</TT>) nodes are created using the <A href="#mxmlNewText">
  544. <TT>mxmlNewText</TT></A> and <A href="#mxmlNewTextf"><TT>mxmlNewTextf</TT>
  545. </A> functions. Each text node consists of a text string and (leading)
  546. whitespace value - the <A href="#mxmlGetText"><TT>mxmlGetText</TT></A>
  547. function retrieves the text string pointer and whitespace value for a
  548. node.</P>
  549. <!-- NEED 12 -->
  550. <H3><A NAME="3_2_8">Processing Instruction Nodes</A></H3>
  551. <P>Processing instruction (<TT>MXML_ELEMENT</TT>) nodes are created
  552. using the <A href="#mxmlNewElement"><TT>mxmlNewElement</TT></A>
  553. function. The <A href="#mxmlGetElement"><TT>mxmlGetElement</TT></A>
  554. function retrieves the processing instruction string for a node,
  555. including the surrounding &quot;?&quot; characters.</P>
  556. <BLOCKQUOTE><B>Note:</B>
  557. <P>Processing instruction nodes are currently stored in memory as
  558. special elements. This will be changed in a future major release of
  559. Mini-XML.</P>
  560. </BLOCKQUOTE>
  561. <H3><A NAME="3_2_9">Real Number Nodes</A></H3>
  562. <P>Real number (<TT>MXML_REAL</TT>) nodes are created using the <A href="#mxmlNewReal">
  563. <TT>mxmlNewReal</TT></A> function. The <A href="#mxmlGetReal"><TT>
  564. mxmlGetReal</TT></A> function retrieves the CDATA string pointer for a
  565. node.</P>
  566. <!-- NEED 15 -->
  567. <H3><A NAME="3_2_10">XML Declaration Nodes</A></H3>
  568. <P>XML declaration (<TT>MXML_ELEMENT</TT>) nodes are created using the <A
  569. href="#mxmlNewXML"><TT>mxmlNewXML</TT></A> function. The <A href="#mxmlGetElement">
  570. <TT>mxmlGetElement</TT></A> function retrieves the XML declaration
  571. string for a node, including the surrounding &quot;?&quot; characters.</P>
  572. <BLOCKQUOTE><B>Note:</B>
  573. <P>XML declaration nodes are currently stored in memory as special
  574. elements. This will be changed in a future major release of Mini-XML.</P>
  575. </BLOCKQUOTE>
  576. <!-- NEW PAGE -->
  577. <H2><A NAME="3_3">Creating XML Documents</A></H2>
  578. <P>You can create and update XML documents in memory using the various <TT>
  579. mxmlNew</TT> functions. The following code will create the XML document
  580. described in the previous section:</P>
  581. <PRE>
  582. mxml_node_t *xml; /* &lt;?xml ... ?&gt; */
  583. mxml_node_t *data; /* &lt;data&gt; */
  584. mxml_node_t *node; /* &lt;node&gt; */
  585. mxml_node_t *group; /* &lt;group&gt; */
  586. xml = mxmlNewXML(&quot;1.0&quot;);
  587. data = mxmlNewElement(xml, &quot;data&quot;);
  588. node = mxmlNewElement(data, &quot;node&quot;);
  589. mxmlNewText(node, 0, &quot;val1&quot;);
  590. node = mxmlNewElement(data, &quot;node&quot;);
  591. mxmlNewText(node, 0, &quot;val2&quot;);
  592. node = mxmlNewElement(data, &quot;node&quot;);
  593. mxmlNewText(node, 0, &quot;val3&quot;);
  594. group = mxmlNewElement(data, &quot;group&quot;);
  595. node = mxmlNewElement(group, &quot;node&quot;);
  596. mxmlNewText(node, 0, &quot;val4&quot;);
  597. node = mxmlNewElement(group, &quot;node&quot;);
  598. mxmlNewText(node, 0, &quot;val5&quot;);
  599. node = mxmlNewElement(group, &quot;node&quot;);
  600. mxmlNewText(node, 0, &quot;val6&quot;);
  601. node = mxmlNewElement(data, &quot;node&quot;);
  602. mxmlNewText(node, 0, &quot;val7&quot;);
  603. node = mxmlNewElement(data, &quot;node&quot;);
  604. mxmlNewText(node, 0, &quot;val8&quot;);
  605. </PRE>
  606. <!-- NEED 6 -->
  607. <P>We start by creating the declaration node common to all XML files
  608. using the <A href="#mxmlNewXML"><TT>mxmlNewXML</TT></A> function:</P>
  609. <PRE>
  610. xml = mxmlNewXML(&quot;1.0&quot;);
  611. </PRE>
  612. <P>We then create the <TT>&lt;data&gt;</TT> node used for this document using
  613. the <A href="#mxmlNewElement"><TT>mxmlNewElement</TT></A> function. The
  614. first argument specifies the parent node (<TT>xml</TT>) while the
  615. second specifies the element name (<TT>data</TT>):</P>
  616. <PRE>
  617. data = mxmlNewElement(xml, &quot;data&quot;);
  618. </PRE>
  619. <P>Each <TT>&lt;node&gt;...&lt;/node&gt;</TT> in the file is created using the <TT>
  620. mxmlNewElement</TT> and <A href="#mxmlNewText"><TT>mxmlNewText</TT></A>
  621. functions. The first argument of <TT>mxmlNewText</TT> specifies the
  622. parent node (<TT>node</TT>). The second argument specifies whether
  623. whitespace appears before the text - 0 or false in this case. The last
  624. argument specifies the actual text to add:</P>
  625. <PRE>
  626. node = mxmlNewElement(data, &quot;node&quot;);
  627. mxmlNewText(node, 0, &quot;val1&quot;);
  628. </PRE>
  629. <P>The resulting in-memory XML document can then be saved or processed
  630. just like one loaded from disk or a string.</P>
  631. <!-- NEED 15 -->
  632. <H2><A NAME="3_4">Loading XML</A></H2>
  633. <P>You load an XML file using the <A href="#mxmlLoadFile"><TT>
  634. mxmlLoadFile</TT></A> function:</P>
  635. <PRE>
  636. FILE *fp;
  637. mxml_node_t *tree;
  638. fp = fopen(&quot;filename.xml&quot;, &quot;r&quot;);
  639. tree = mxmlLoadFile(NULL, fp,
  640. MXML_TEXT_CALLBACK);
  641. fclose(fp);
  642. </PRE>
  643. <P>The first argument specifies an existing XML parent node, if any.
  644. Normally you will pass <TT>NULL</TT> for this argument unless you are
  645. combining multiple XML sources. The XML file must contain a complete
  646. XML document including the <TT>?xml</TT> element if the parent node is <TT>
  647. NULL</TT>.</P>
  648. <P>The second argument specifies the stdio file to read from, as opened
  649. by <TT>fopen()</TT> or <TT>popen()</TT>. You can also use <TT>stdin</TT>
  650. if you are implementing an XML filter program.</P>
  651. <P>The third argument specifies a callback function which returns the
  652. value type of the immediate children for a new element node: <TT>
  653. MXML_CUSTOM</TT>, <TT>MXML_IGNORE</TT>, <TT>MXML_INTEGER</TT>, <TT>
  654. MXML_OPAQUE</TT>, <TT>MXML_REAL</TT>, or <TT>MXML_TEXT</TT>. Load
  655. callbacks are described in detail in <A href="#LOAD_CALLBACKS">Chapter
  656. 3</A>. The example code uses the <TT>MXML_TEXT_CALLBACK</TT> constant
  657. which specifies that all data nodes in the document contain
  658. whitespace-separated text values. Other standard callbacks include <TT>
  659. MXML_IGNORE_CALLBACK</TT>, <TT>MXML_INTEGER_CALLBACK</TT>, <TT>
  660. MXML_OPAQUE_CALLBACK</TT>, and <TT>MXML_REAL_CALLBACK</TT>.</P>
  661. <P>The <A href="#mxmlLoadString"><TT>mxmlLoadString</TT></A> function
  662. loads XML node trees from a string:</P>
  663. <!-- NEED 10 -->
  664. <PRE>
  665. char buffer[8192];
  666. mxml_node_t *tree;
  667. ...
  668. tree = mxmlLoadString(NULL, buffer,
  669. MXML_TEXT_CALLBACK);
  670. </PRE>
  671. <P>The first and third arguments are the same as used for <TT>
  672. mxmlLoadFile()</TT>. The second argument specifies the string or
  673. character buffer to load and must be a complete XML document including
  674. the <TT>?xml</TT> element if the parent node is <TT>NULL</TT>.</P>
  675. <!-- NEED 15 -->
  676. <H2><A NAME="3_5">Saving XML</A></H2>
  677. <P>You save an XML file using the <A href="#mxmlSaveFile"><TT>
  678. mxmlSaveFile</TT></A> function:</P>
  679. <PRE>
  680. FILE *fp;
  681. mxml_node_t *tree;
  682. fp = fopen(&quot;filename.xml&quot;, &quot;w&quot;);
  683. mxmlSaveFile(tree, fp, MXML_NO_CALLBACK);
  684. fclose(fp);
  685. </PRE>
  686. <P>The first argument is the XML node tree to save. It should normally
  687. be a pointer to the top-level <TT>?xml</TT> node in your XML document.</P>
  688. <P>The second argument is the stdio file to write to, as opened by <TT>
  689. fopen()</TT> or <TT>popen()</TT>. You can also use <TT>stdout</TT> if
  690. you are implementing an XML filter program.</P>
  691. <P>The third argument is the whitespace callback to use when saving the
  692. file. Whitespace callbacks are covered in detail in <A href="SAVE_CALLBACKS">
  693. Chapter 3</A>. The previous example code uses the <TT>MXML_NO_CALLBACK</TT>
  694. constant to specify that no special whitespace handling is required.</P>
  695. <P>The <A href="#mxmlSaveAllocString"><TT>mxmlSaveAllocString</TT></A>,
  696. and <A href="#mxmlSaveString"><TT>mxmlSaveString</TT></A> functions
  697. save XML node trees to strings:</P>
  698. <PRE>
  699. char buffer[8192];
  700. char *ptr;
  701. mxml_node_t *tree;
  702. ...
  703. mxmlSaveString(tree, buffer, sizeof(buffer),
  704. MXML_NO_CALLBACK);
  705. ...
  706. ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK);
  707. </PRE>
  708. <P>The first and last arguments are the same as used for <TT>
  709. mxmlSaveFile()</TT>. The <TT>mxmlSaveString</TT> function takes pointer
  710. and size arguments for saving the XML document to a fixed-size buffer,
  711. while <TT>mxmlSaveAllocString()</TT> returns a string buffer that was
  712. allocated using <TT>malloc()</TT>.</P>
  713. <!-- NEED 15 -->
  714. <H3><A NAME="3_5_1">Controlling Line Wrapping</A></H3>
  715. <P>When saving XML documents, Mini-XML normally wraps output lines at
  716. column 75 so that the text is readable in terminal windows. The <A href="#mxmlSetWrapMargin">
  717. <TT>mxmlSetWrapMargin</TT></A> function overrides the default wrap
  718. margin:</P>
  719. <PRE>
  720. /* Set the margin to 132 columns */
  721. mxmlSetWrapMargin(132);
  722. /* Disable wrapping */
  723. mxmlSetWrapMargin(0);
  724. </PRE>
  725. <H2><A NAME="3_6">Memory Management</A></H2>
  726. <P>Once you are done with the XML data, use the <A href="#mxmlDelete"><TT>
  727. mxmlDelete</TT></A> function to recursively free the memory that is used
  728. for a particular node or the entire tree:</P>
  729. <PRE>
  730. mxmlDelete(tree);
  731. </PRE>
  732. <P>You can also use reference counting to manage memory usage. The <A href="#mxmlRetain">
  733. <TT>mxmlRetain</TT></A> and <A href="#mxmlRelease"><TT>mxmlRelease</TT></A>
  734. functions increment and decrement a node's use count, respectively.
  735. When the use count goes to 0, <TT>mxmlRelease</TT> will automatically
  736. call <TT>mxmlDelete</TT> to actually free the memory used by the node
  737. tree. New nodes automatically start with a use count of 1.</P>
  738. <!-- NEW PAGE-->
  739. <H2><A NAME="3_7">Finding and Iterating Nodes</A></H2>
  740. <P>The <A href="#mxmlWalkPrev"><TT>mxmlWalkPrev</TT></A> and <A href="#mxmlWalkNext">
  741. <TT>mxmlWalkNext</TT></A>functions can be used to iterate through the
  742. XML node tree:</P>
  743. <PRE>
  744. mxml_node_t *node;
  745. node = mxmlWalkPrev(current, tree,
  746. MXML_DESCEND);
  747. node = mxmlWalkNext(current, tree,
  748. MXML_DESCEND);
  749. </PRE>
  750. <P>In addition, you can find a named element/node using the <A href="#mxmlFindElement">
  751. <TT>mxmlFindElement</TT></A> function:</P>
  752. <PRE>
  753. mxml_node_t *node;
  754. node = mxmlFindElement(tree, tree, &quot;name&quot;,
  755. &quot;attr&quot;, &quot;value&quot;,
  756. MXML_DESCEND);
  757. </PRE>
  758. <P>The <TT>name</TT>, <TT>attr</TT>, and <TT>value</TT> arguments can be
  759. passed as <TT>NULL</TT> to act as wildcards, e.g.:</P>
  760. <!-- NEED 4 -->
  761. <PRE>
  762. /* Find the first &quot;a&quot; element */
  763. node = mxmlFindElement(tree, tree, &quot;a&quot;,
  764. NULL, NULL,
  765. MXML_DESCEND);
  766. </PRE>
  767. <!-- NEED 5 -->
  768. <PRE>
  769. /* Find the first &quot;a&quot; element with &quot;href&quot;
  770. attribute */
  771. node = mxmlFindElement(tree, tree, &quot;a&quot;,
  772. &quot;href&quot;, NULL,
  773. MXML_DESCEND);
  774. </PRE>
  775. <!-- NEED 6 -->
  776. <PRE>
  777. /* Find the first &quot;a&quot; element with &quot;href&quot;
  778. to a URL */
  779. node = mxmlFindElement(tree, tree, &quot;a&quot;,
  780. &quot;href&quot;,
  781. &quot;http://www.easysw.com/&quot;,
  782. MXML_DESCEND);
  783. </PRE>
  784. <!-- NEED 5 -->
  785. <PRE>
  786. /* Find the first element with a &quot;src&quot;
  787. attribute */
  788. node = mxmlFindElement(tree, tree, NULL,
  789. &quot;src&quot;, NULL,
  790. MXML_DESCEND);
  791. </PRE>
  792. <!-- NEED 5 -->
  793. <PRE>
  794. /* Find the first element with a &quot;src&quot;
  795. = &quot;foo.jpg&quot; */
  796. node = mxmlFindElement(tree, tree, NULL,
  797. &quot;src&quot;, &quot;foo.jpg&quot;,
  798. MXML_DESCEND);
  799. </PRE>
  800. <P>You can also iterate with the same function:</P>
  801. <PRE>
  802. mxml_node_t *node;
  803. for (node = mxmlFindElement(tree, tree,
  804. &quot;name&quot;,
  805. NULL, NULL,
  806. MXML_DESCEND);
  807. node != NULL;
  808. node = mxmlFindElement(node, tree,
  809. &quot;name&quot;,
  810. NULL, NULL,
  811. MXML_DESCEND))
  812. {
  813. ... do something ...
  814. }
  815. </PRE>
  816. <!-- NEED 10 -->
  817. <P>The <TT>MXML_DESCEND</TT> argument can actually be one of three
  818. constants:</P>
  819. <UL>
  820. <LI><TT>MXML_NO_DESCEND</TT> means to not to look at any child nodes in
  821. the element hierarchy, just look at siblings at the same level or
  822. parent nodes until the top node or top-of-tree is reached.
  823. <P>The previous node from &quot;group&quot; would be the &quot;node&quot; element to the
  824. left, while the next node from &quot;group&quot; would be the &quot;node&quot; element to
  825. the right.
  826. <BR>
  827. <BR></P>
  828. </LI>
  829. <LI><TT>MXML_DESCEND_FIRST</TT> means that it is OK to descend to the
  830. first child of a node, but not to descend further when searching.
  831. You'll normally use this when iterating through direct children of a
  832. parent node, e.g. all of the &quot;node&quot; and &quot;group&quot; elements under the
  833. &quot;?xml&quot; parent node in the example above.
  834. <P>This mode is only applicable to the search function; the walk
  835. functions treat this as <TT>MXML_DESCEND</TT> since every call is a
  836. first time.
  837. <BR>
  838. <BR></P>
  839. </LI>
  840. <LI><TT>MXML_DESCEND</TT> means to keep descending until you hit the
  841. bottom of the tree. The previous node from &quot;group&quot; would be the &quot;val3&quot;
  842. node and the next node would be the first node element under &quot;group&quot;.
  843. <P>If you were to walk from the root node &quot;?xml&quot; to the end of the tree
  844. with <TT>mxmlWalkNext()</TT>, the order would be:</P>
  845. <P><TT>?xml data node val1 node val2 node val3 group node val4 node val5
  846. node val6 node val7 node val8</TT></P>
  847. <P>If you started at &quot;val8&quot; and walked using <TT>mxmlWalkPrev()</TT>,
  848. the order would be reversed, ending at &quot;?xml&quot;.</P>
  849. </LI>
  850. </UL>
  851. <H2><A NAME="3_8">Finding Specific Nodes</A></H2>
  852. <P>You can find specific nodes in the tree using the <A href="#mxmlFindValue">
  853. <TT>mxmlFindPath</TT></A>, for example:</P>
  854. <PRE>
  855. mxml_node_t *value;
  856. value = mxmlFindPath(tree, &quot;path/to/*/foo/bar&quot;);
  857. </PRE>
  858. <P>The second argument is a &quot;path&quot; to the parent node. Each component of
  859. the path is separated by a slash (/) and represents a named element in
  860. the document tree or a wildcard (*) path representing 0 or more
  861. intervening nodes.</P>
  862. <HR NOSHADE>
  863. <H1 align="right"><A name="ADVANCED"><IMG align="right" alt="3" height="100"
  864. hspace="10" src="3.gif" width="100"></A>More Mini-XML Programming
  865. Techniques</H1>
  866. <P>This chapter shows additional ways to use the Mini-XML library in
  867. your programs.</P>
  868. <H2><A name="LOAD_CALLBACKS">Load Callbacks</A></H2>
  869. <P><A href="#LOAD_XML">Chapter 2</A> introduced the <A href="#mxmlLoadFile">
  870. <TT>mxmlLoadFile()</TT></A> and <A href="#mxmlLoadString"><TT>
  871. mxmlLoadString()</TT></A> functions. The last argument to these
  872. functions is a callback function which is used to determine the value
  873. type of each data node in an XML document.</P>
  874. <P>Mini-XML defines several standard callbacks for simple XML data
  875. files:</P>
  876. <UL>
  877. <LI><TT>MXML_INTEGER_CALLBACK</TT> - All data nodes contain
  878. whitespace-separated integers.</LI>
  879. <LI><TT>MXML_OPAQUE_CALLBACK</TT> - All data nodes contain opaque
  880. strings (&quot;CDATA&quot;).</LI>
  881. <LI><TT>MXML_REAL_CALLBACK</TT> - All data nodes contain
  882. whitespace-separated floating-point numbers.</LI>
  883. <LI><TT>MXML_TEXT_CALLBACK</TT> - All data nodes contain
  884. whitespace-separated strings.</LI>
  885. </UL>
  886. <P>You can provide your own callback functions for more complex XML
  887. documents. Your callback function will receive a pointer to the current
  888. element node and must return the value type of the immediate children
  889. for that element node: <TT>MXML_INTEGER</TT>, <TT>MXML_OPAQUE</TT>, <TT>
  890. MXML_REAL</TT>, or <TT>MXML_TEXT</TT>. The function is called<I> after</I>
  891. the element and its attributes have been read, so you can look at the
  892. element name, attributes, and attribute values to determine the proper
  893. value type to return.</P>
  894. <!-- NEED 2in -->
  895. <P>The following callback function looks for an attribute named &quot;type&quot;
  896. or the element name to determine the value type for its child nodes:</P>
  897. <PRE>
  898. mxml_type_t
  899. type_cb(mxml_node_t *node)
  900. {
  901. const char *type;
  902. /*
  903. * You can lookup attributes and/or use the
  904. * element name, hierarchy, etc...
  905. */
  906. type = mxmlElementGetAttr(node, &quot;type&quot;);
  907. if (type == NULL)
  908. type = mxmlGetElement(node);
  909. if (!strcmp(type, &quot;integer&quot;))
  910. return (MXML_INTEGER);
  911. else if (!strcmp(type, &quot;opaque&quot;))
  912. return (MXML_OPAQUE);
  913. else if (!strcmp(type, &quot;real&quot;))
  914. return (MXML_REAL);
  915. else
  916. return (MXML_TEXT);
  917. }
  918. </PRE>
  919. <P>To use this callback function, simply use the name when you call any
  920. of the load functions:</P>
  921. <PRE>
  922. FILE *fp;
  923. mxml_node_t *tree;
  924. fp = fopen(&quot;filename.xml&quot;, &quot;r&quot;);
  925. tree = mxmlLoadFile(NULL, fp, <B>type_cb</B>);
  926. fclose(fp);
  927. </PRE>
  928. <H2><A name="SAVE_CALLBACKS">Save Callbacks</A></H2>
  929. <P><A href="#LOAD_XML">Chapter 2</A> also introduced the <A href="#mxmlSaveFile">
  930. <TT>mxmlSaveFile()</TT></A>, <A href="#mxmlSaveString"><TT>
  931. mxmlSaveString()</TT></A>, and <A href="#mxmlSaveAllocString"><TT>
  932. mxmlSaveAllocString()</TT></A> functions. The last argument to these
  933. functions is a callback function which is used to automatically insert
  934. whitespace in an XML document.</P>
  935. <P>Your callback function will be called up to four times for each
  936. element node with a pointer to the node and a &quot;where&quot; value of <TT>
  937. MXML_WS_BEFORE_OPEN</TT>, <TT>MXML_WS_AFTER_OPEN</TT>, <TT>
  938. MXML_WS_BEFORE_CLOSE</TT>, or <TT>MXML_WS_AFTER_CLOSE</TT>. The callback
  939. function should return <TT>NULL</TT> if no whitespace should be added
  940. and the string to insert (spaces, tabs, carriage returns, and newlines)
  941. otherwise.</P>
  942. <P>The following whitespace callback can be used to add whitespace to
  943. XHTML output to make it more readable in a standard text editor:</P>
  944. <PRE>
  945. const char *
  946. whitespace_cb(mxml_node_t *node,
  947. int where)
  948. {
  949. const char *name;
  950. /*
  951. * We can conditionally break to a new line
  952. * before or after any element. These are
  953. * just common HTML elements...
  954. */
  955. name = mxmlGetElement(node);
  956. if (!strcmp(name, &quot;html&quot;) ||
  957. !strcmp(name, &quot;head&quot;) ||
  958. !strcmp(name, &quot;body&quot;) ||
  959. !strcmp(name, &quot;pre&quot;) ||
  960. !strcmp(name, &quot;p&quot;) ||
  961. !strcmp(name, &quot;h1&quot;) ||
  962. !strcmp(name, &quot;h2&quot;) ||
  963. !strcmp(name, &quot;h3&quot;) ||
  964. !strcmp(name, &quot;h4&quot;) ||
  965. !strcmp(name, &quot;h5&quot;) ||
  966. !strcmp(name, &quot;h6&quot;))
  967. {
  968. /*
  969. * Newlines before open and after
  970. * close...
  971. */
  972. if (where == MXML_WS_BEFORE_OPEN ||
  973. where == MXML_WS_AFTER_CLOSE)
  974. return (&quot;\n&quot;);
  975. }
  976. else if (!strcmp(name, &quot;dl&quot;) ||
  977. !strcmp(name, &quot;ol&quot;) ||
  978. !strcmp(name, &quot;ul&quot;))
  979. {
  980. /*
  981. * Put a newline before and after list
  982. * elements...
  983. */
  984. return (&quot;\n&quot;);
  985. }
  986. else if (!strcmp(name, &quot;dd&quot;) ||
  987. !strcmp(name, &quot;dt&quot;) ||
  988. !strcmp(name, &quot;li&quot;))
  989. {
  990. /*
  991. * Put a tab before &lt;li&gt;'s, * &lt;dd&gt;'s,
  992. * and &lt;dt&gt;'s, and a newline after them...
  993. */
  994. if (where == MXML_WS_BEFORE_OPEN)
  995. return (&quot;\t&quot;);
  996. else if (where == MXML_WS_AFTER_CLOSE)
  997. return (&quot;\n&quot;);
  998. }
  999. /*
  1000. * Return NULL for no added whitespace...
  1001. */
  1002. return (NULL);
  1003. }
  1004. </PRE>
  1005. <P>To use this callback function, simply use the name when you call any
  1006. of the save functions:</P>
  1007. <PRE>
  1008. FILE *fp;
  1009. mxml_node_t *tree;
  1010. fp = fopen(&quot;filename.xml&quot;, &quot;w&quot;);
  1011. mxmlSaveFile(tree, fp, <B>whitespace_cb</B>);
  1012. fclose(fp);
  1013. </PRE>
  1014. <!-- NEED 10 -->
  1015. <H2><A NAME="4_3">Custom Data Types</A></H2>
  1016. <P>Mini-XML supports custom data types via global load and save
  1017. callbacks. Only a single set of callbacks can be active at any time,
  1018. however your callbacks can store additional information in order to
  1019. support multiple custom data types as needed. The <TT>MXML_CUSTOM</TT>
  1020. node type identifies custom data nodes.</P>
  1021. <P>The load callback receives a pointer to the current data node and a
  1022. string of opaque character data from the XML source with character
  1023. entities converted to the corresponding UTF-8 characters. For example,
  1024. if we wanted to support a custom date/time type whose value is encoded
  1025. as &quot;yyyy-mm-ddThh:mm:ssZ&quot; (ISO format), the load callback would look
  1026. like the following:</P>
  1027. <PRE>
  1028. typedef struct
  1029. {
  1030. unsigned year, /* Year */
  1031. month, /* Month */
  1032. day, /* Day */
  1033. hour, /* Hour */
  1034. minute, /* Minute */
  1035. second; /* Second */
  1036. time_t unix; /* UNIX time */
  1037. } iso_date_time_t;
  1038. int
  1039. load_custom(mxml_node_t *node,
  1040. const char *data)
  1041. {
  1042. iso_date_time_t *dt;
  1043. struct tm tmdata;
  1044. /*
  1045. * Allocate data structure...
  1046. */
  1047. dt = calloc(1, sizeof(iso_date_time_t));
  1048. /*
  1049. * Try reading 6 unsigned integers from the
  1050. * data string...
  1051. */
  1052. if (sscanf(data, &quot;%u-%u-%uT%u:%u:%uZ&quot;,
  1053. &amp;(dt-&gt;year), &amp;(dt-&gt;month),
  1054. &amp;(dt-&gt;day), &amp;(dt-&gt;hour),
  1055. &amp;(dt-&gt;minute),
  1056. &amp;(dt-&gt;second)) != 6)
  1057. {
  1058. /*
  1059. * Unable to read numbers, free the data
  1060. * structure and return an error...
  1061. */
  1062. free(dt);
  1063. return (-1);
  1064. }
  1065. /*
  1066. * Range check values...
  1067. */
  1068. if (dt-&gt;month &lt;1 || dt-&gt;month &gt; 12 ||
  1069. dt-&gt;day &lt;1 || dt-&gt;day &gt; 31 ||
  1070. dt-&gt;hour &lt;0 || dt-&gt;hour &gt; 23 ||
  1071. dt-&gt;minute &lt;0 || dt-&gt;minute &gt; 59 ||
  1072. dt-&gt;second &lt;0 || dt-&gt;second &gt; 59)
  1073. {
  1074. /*
  1075. * Date information is out of range...
  1076. */
  1077. free(dt);
  1078. return (-1);
  1079. }
  1080. /*
  1081. * Convert ISO time to UNIX time in
  1082. * seconds...
  1083. */
  1084. tmdata.tm_year = dt-&gt;year - 1900;
  1085. tmdata.tm_mon = dt-&gt;month - 1;
  1086. tmdata.tm_day = dt-&gt;day;
  1087. tmdata.tm_hour = dt-&gt;hour;
  1088. tmdata.tm_min = dt-&gt;minute;
  1089. tmdata.tm_sec = dt-&gt;second;
  1090. dt-&gt;unix = gmtime(&amp;tmdata);
  1091. /*
  1092. * Assign custom node data and destroy
  1093. * function pointers...
  1094. */
  1095. mxmlSetCustom(node, data, destroy);
  1096. /*
  1097. * Return with no errors...
  1098. */
  1099. return (0);
  1100. }
  1101. </PRE>
  1102. <P>The function itself can return 0 on success or -1 if it is unable to
  1103. decode the custom data or the data contains an error. Custom data nodes
  1104. contain a <TT>void</TT> pointer to the allocated custom data for the
  1105. node and a pointer to a destructor function which will free the custom
  1106. data when the node is deleted.</P>
  1107. <!-- NEED 15 -->
  1108. <P>The save callback receives the node pointer and returns an allocated
  1109. string containing the custom data value. The following save callback
  1110. could be used for our ISO date/time type:</P>
  1111. <PRE>
  1112. char *
  1113. save_custom(mxml_node_t *node)
  1114. {
  1115. char data[255];
  1116. iso_date_time_t *dt;
  1117. dt = (iso_date_time_t *)mxmlGetCustom(node);
  1118. snprintf(data, sizeof(data),
  1119. &quot;%04u-%02u-%02uT%02u:%02u:%02uZ&quot;,
  1120. dt-&gt;year, dt-&gt;month, dt-&gt;day,
  1121. dt-&gt;hour, dt-&gt;minute, dt-&gt;second);
  1122. return (strdup(data));
  1123. }
  1124. </PRE>
  1125. <P>You register the callback functions using the <A href="#mxmlSetCustomHandlers">
  1126. <TT>mxmlSetCustomHandlers()</TT></A> function:</P>
  1127. <PRE>
  1128. mxmlSetCustomHandlers(<B>load_custom</B>,
  1129. <B>save_custom</B>);
  1130. </PRE>
  1131. <!-- NEED 20 -->
  1132. <H2><A NAME="4_4">Changing Node Values</A></H2>
  1133. <P>All of the examples so far have concentrated on creating and loading
  1134. new XML data nodes. Many applications, however, need to manipulate or
  1135. change the nodes during their operation, so Mini-XML provides functions
  1136. to change node values safely and without leaking memory.</P>
  1137. <P>Existing nodes can be changed using the <A href="#mxmlSetElement"><TT>
  1138. mxmlSetElement()</TT></A>, <A href="#mxmlSetInteger"><TT>
  1139. mxmlSetInteger()</TT></A>, <A href="#mxmlSetOpaque"><TT>mxmlSetOpaque()</TT>
  1140. </A>, <A href="#mxmlSetReal"><TT>mxmlSetReal()</TT></A>, <A href="#mxmlSetText">
  1141. <TT>mxmlSetText()</TT></A>, and <A href="#mxmlSetTextf"><TT>
  1142. mxmlSetTextf()</TT></A> functions. For example, use the following
  1143. function call to change a text node to contain the text &quot;new&quot; with
  1144. leading whitespace:</P>
  1145. <PRE>
  1146. mxml_node_t *node;
  1147. mxmlSetText(node, 1, &quot;new&quot;);
  1148. </PRE>
  1149. <H2><A NAME="4_5">Formatted Text</A></H2>
  1150. <P>The <A href="#mxmlNewTextf"><TT>mxmlNewTextf()</TT></A> and <A href="#mxmlSetTextf">
  1151. <TT>mxmlSetTextf()</TT></A> functions create and change text nodes,
  1152. respectively, using <TT>printf</TT>-style format strings and arguments.
  1153. For example, use the following function call to create a new text node
  1154. containing a constructed filename:</P>
  1155. <PRE>
  1156. mxml_node_t *node;
  1157. node = mxmlNewTextf(node, 1, &quot;%s/%s&quot;,
  1158. path, filename);
  1159. </PRE>
  1160. <H2><A NAME="4_6">Indexing</A></H2>
  1161. <P>Mini-XML provides functions for managing indices of nodes. The
  1162. current implementation provides the same functionality as <A href="#mxmlFindElement">
  1163. <TT>mxmlFindElement()</TT></A>. The advantage of using an index is that
  1164. searching and enumeration of elements is significantly faster. The only
  1165. disadvantage is that each index is a static snapshot of the XML
  1166. document, so indices are not well suited to XML data that is updated
  1167. more often than it is searched. The overhead of creating an index is
  1168. approximately equal to walking the XML document tree. Nodes in the
  1169. index are sorted by element name and attribute value.</P>
  1170. <P>Indices are stored in <A href="#mxml_index_t"><TT>mxml_index_t</TT></A>
  1171. structures. The <A href="#mxmlIndexNew"><TT>mxmlIndexNew()</TT></A>
  1172. function creates a new index:</P>
  1173. <PRE>
  1174. mxml_node_t *tree;
  1175. mxml_index_t *ind;
  1176. ind = mxmlIndexNew(tree, &quot;element&quot;,
  1177. &quot;attribute&quot;);
  1178. </PRE>
  1179. <P>The first argument is the XML node tree to index. Normally this will
  1180. be a pointer to the <TT>?xml</TT> element.</P>
  1181. <P>The second argument contains the element to index; passing <TT>NULL</TT>
  1182. indexes all element nodes alphabetically.</P>
  1183. <P>The third argument contains the attribute to index; passing <TT>NULL</TT>
  1184. causes only the element name to be indexed.</P>
  1185. <P>Once the index is created, the <A href="#mxmlIndexEnum"><TT>
  1186. mxmlIndexEnum()</TT></A>, <A href="#mxmlIndexFind"><TT>mxmlIndexFind()</TT>
  1187. </A>, and <A href="#mxmlIndexReset"><TT>mxmlIndexReset()</TT></A>
  1188. functions are used to access the nodes in the index. The <A href="#mxmlIndexReset">
  1189. <TT>mxmlIndexReset()</TT></A> function resets the &quot;current&quot; node pointer
  1190. in the index, allowing you to do new searches and enumerations on the
  1191. same index. Typically you will call this function prior to your calls
  1192. to <A href="#mxmlIndexEnum"><TT>mxmlIndexEnum()</TT></A> and <A href="#mxmlIndexFind">
  1193. <TT>mxmlIndexFind()</TT></A>.</P>
  1194. <P>The <A href="#mxmlIndexEnum"><TT>mxmlIndexEnum()</TT></A> function
  1195. enumerates each of the nodes in the index and can be used in a loop as
  1196. follows:</P>
  1197. <PRE>
  1198. mxml_node_t *node;
  1199. mxmlIndexReset(ind);
  1200. while ((node = mxmlIndexEnum(ind)) != NULL)
  1201. {
  1202. // do something with node
  1203. }
  1204. </PRE>
  1205. <P>The <A href="#mxmlIndexFind"><TT>mxmlIndexFind()</TT></A> function
  1206. locates the next occurrence of the named element and attribute value in
  1207. the index. It can be used to find all matching elements in an index, as
  1208. follows:</P>
  1209. <PRE>
  1210. mxml_node_t *node;
  1211. mxmlIndexReset(ind);
  1212. while ((node = mxmlIndexFind(ind, &quot;element&quot;,
  1213. &quot;attr-value&quot;))
  1214. != NULL)
  1215. {
  1216. // do something with node
  1217. }
  1218. </PRE>
  1219. <P>The second and third arguments represent the element name and
  1220. attribute value, respectively. A <TT>NULL</TT> pointer is used to
  1221. return all elements or attributes in the index. Passing <TT>NULL</TT>
  1222. for both the element name and attribute value is equivalent to calling <TT>
  1223. mxmlIndexEnum</TT>.</P>
  1224. <P>When you are done using the index, delete it using the <A href="#mxmlIndexDelete()">
  1225. <TT>mxmlIndexDelete()</TT></A> function:</P>
  1226. <PRE>
  1227. mxmlIndexDelete(ind);
  1228. </PRE>
  1229. <H2><A NAME="4_7">SAX (Stream) Loading of Documents</A></H2>
  1230. <P>Mini-XML supports an implementation of the Simple API for XML (SAX)
  1231. which allows you to load and process an XML document as a stream of
  1232. nodes. Aside from allowing you to process XML documents of any size,
  1233. the Mini-XML implementation also allows you to retain portions of the
  1234. document in memory for later processing.</P>
  1235. <P>The <A href="#mxmlSAXLoad"><TT>mxmlSAXLoadFd</TT></A>, <A href="#mxmlSAXLoadFile">
  1236. <TT>mxmlSAXLoadFile</TT></A>, and <A href="#mxmlSAXLoadString"><TT>
  1237. mxmlSAXLoadString</TT></A> functions provide the SAX loading APIs. Each
  1238. function works like the corresponding <TT>mxmlLoad</TT> function but
  1239. uses a callback to process each node as it is read.</P>
  1240. <P>The callback function receives the node, an event code, and a user
  1241. data pointer you supply:</P>
  1242. <PRE>
  1243. void
  1244. sax_cb(mxml_node_t *node,
  1245. mxml_sax_event_t event,
  1246. void *data)
  1247. {
  1248. ... do something ...
  1249. }
  1250. </PRE>
  1251. <P>The event will be one of the following:</P>
  1252. <UL>
  1253. <LI><TT>MXML_SAX_CDATA</TT> - CDATA was just read</LI>
  1254. <LI><TT>MXML_SAX_COMMENT</TT> - A comment was just read</LI>
  1255. <LI><TT>MXML_SAX_DATA</TT> - Data (custom, integer, opaque, real, or
  1256. text) was just read</LI>
  1257. <LI><TT>MXML_SAX_DIRECTIVE</TT> - A processing directive was just read</LI>
  1258. <LI><TT>MXML_SAX_ELEMENT_CLOSE</TT> - A close element was just read (<TT>
  1259. &lt;/element&gt;</TT>)</LI>
  1260. <LI><TT>MXML_SAX_ELEMENT_OPEN</TT> - An open element was just read (<TT>
  1261. &lt;element&gt;</TT>)</LI>
  1262. </UL>
  1263. <P>Elements are<EM> released</EM> after the close element is processed.
  1264. All other nodes are released after they are processed. The SAX callback
  1265. can<EM> retain</EM> the node using the <A href="#mxmlRetain"><TT>
  1266. mxmlRetain</TT></A> function. For example, the following SAX callback
  1267. will retain all nodes, effectively simulating a normal in-memory load:</P>
  1268. <PRE>
  1269. void
  1270. sax_cb(mxml_node_t *node,
  1271. mxml_sax_event_t event,
  1272. void *data)
  1273. {
  1274. if (event != MXML_SAX_ELEMENT_CLOSE)
  1275. mxmlRetain(node);
  1276. }
  1277. </PRE>
  1278. <P>More typically the SAX callback will only retain a small portion of
  1279. the document that is needed for post-processing. For example, the
  1280. following SAX callback will retain the title and headings in an XHTML
  1281. file. It also retains the (parent) elements like <TT>&lt;html&gt;</TT>, <TT>
  1282. &lt;head&gt;</TT>, and <TT>&lt;body&gt;</TT>, and processing directives like <TT>
  1283. &lt;?xml ... ?&gt;</TT> and <TT>&lt;!DOCTYPE ... &gt;</TT>:</P>
  1284. <!-- NEED 10 -->
  1285. <PRE>
  1286. void
  1287. sax_cb(mxml_node_t *node,
  1288. mxml_sax_event_t event,
  1289. void *data)
  1290. {
  1291. if (event == MXML_SAX_ELEMENT_OPEN)
  1292. {
  1293. /*
  1294. * Retain headings and titles...
  1295. */
  1296. char *name = mxmlGetElement(node);
  1297. if (!strcmp(name, &quot;html&quot;) ||
  1298. !strcmp(name, &quot;head&quot;) ||
  1299. !strcmp(name, &quot;title&quot;) ||
  1300. !strcmp(name, &quot;body&quot;) ||
  1301. !strcmp(name, &quot;h1&quot;) ||
  1302. !strcmp(name, &quot;h2&quot;) ||
  1303. !strcmp(name, &quot;h3&quot;) ||
  1304. !strcmp(name, &quot;h4&quot;) ||
  1305. !strcmp(name, &quot;h5&quot;) ||
  1306. !strcmp(name, &quot;h6&quot;))
  1307. mxmlRetain(node);
  1308. }
  1309. else if (event == MXML_SAX_DIRECTIVE)
  1310. mxmlRetain(node);
  1311. else if (event == MXML_SAX_DATA)
  1312. {
  1313. if (mxmlGetRefCount(mxmlGetParent(node)) &gt; 1)
  1314. {
  1315. /*
  1316. * If the parent was retained, then retain
  1317. * this data node as well.
  1318. */
  1319. mxmlRetain(node);
  1320. }
  1321. }
  1322. }
  1323. </PRE>
  1324. <P>The resulting skeleton document tree can then be searched just like
  1325. one loaded using the <TT>mxmlLoad</TT> functions. For example, a filter
  1326. that reads an XHTML document from stdin and then shows the title and
  1327. headings in the document would look like:</P>
  1328. <PRE>
  1329. mxml_node_t *doc, *title, *body, *heading;
  1330. doc = mxmlSAXLoadFd(NULL, 0,
  1331. MXML_TEXT_CALLBACK,
  1332. <B>sax_cb</B>, NULL);
  1333. title = mxmlFindElement(doc, doc, &quot;title&quot;,
  1334. NULL, NULL,
  1335. MXML_DESCEND);
  1336. if (title)
  1337. print_children(title);
  1338. body = mxmlFindElement(doc, doc, &quot;body&quot;,
  1339. NULL, NULL,
  1340. MXML_DESCEND);
  1341. if (body)
  1342. {
  1343. for (heading = mxmlGetFirstChild(body);
  1344. heading;
  1345. heading = mxmlGetNextSibling(heading))
  1346. print_children(heading);
  1347. }
  1348. </PRE>
  1349. <HR NOSHADE>
  1350. <H1 align="right"><A name="MXMLDOC"><IMG align="right" alt="4" height="100"
  1351. hspace="10" src="4.gif" width="100"></A>Using the mxmldoc Utility</H1>
  1352. <P>This chapter describes how to use <TT>mxmldoc(1)</TT> program to
  1353. automatically generate documentation from C and C++ source files.</P>
  1354. <H2><A NAME="5_1">The Basics</A></H2>
  1355. <P>Originally developed to generate the Mini-XML and CUPS API
  1356. documentation, <TT>mxmldoc</TT> is now a general-purpose utility which
  1357. scans C and C++ source files to produce HTML and man page documentation
  1358. along with an XML file representing the functions, types, and
  1359. definitions in those source files. Unlike popular documentation
  1360. generators like Doxygen or Javadoc, <TT>mxmldoc</TT> uses in-line
  1361. comments rather than comment headers, allowing for more &quot;natural&quot; code
  1362. documentation.</P>
  1363. <P>By default, <TT>mxmldoc</TT> produces HTML documentation. For
  1364. example, the following command will scan all of the C source and header
  1365. files in the current directory and produce a HTML documentation file
  1366. called<VAR> filename.html</VAR>:</P>
  1367. <PRE>
  1368. <KBD>mxmldoc *.h *.c &gt;filename.html ENTER</KBD>
  1369. </PRE>
  1370. <P>You can also specify an XML file to create which contains all of the
  1371. information from the source files. For example, the following command
  1372. creates an XML file called<VAR> filename.xml</VAR> in addition to the
  1373. HTML file:</P>
  1374. <PRE>
  1375. <KBD>mxmldoc filename.xml *.h *.c &gt;filename.html ENTER</KBD>
  1376. </PRE>
  1377. <P>The <TT>--no-output</TT> option disables the normal HTML output:</P>
  1378. <PRE>
  1379. <KBD>mxmldoc --no-output filename.xml *.h *.c ENTER</KBD>
  1380. </PRE>
  1381. <P>You can then run <TT>mxmldoc</TT> again with the XML file alone to
  1382. generate the HTML documentation:</P>
  1383. <PRE>
  1384. <KBD>mxmldoc filename.xml &gt;filename.html ENTER</KBD>
  1385. </PRE>
  1386. <H3><A NAME="5_1_1">Creating Man Pages</A></H3>
  1387. <P>The <TT>--man filename</TT> option tells <TT>mxmldoc</TT> to create a
  1388. man page instead of HTML documentation, for example:</P>
  1389. <PRE>
  1390. <KBD>mxmldoc --man filename filename.xml \
  1391. &gt;filename.man ENTER</KBD>
  1392. <KBD>mxmldoc --man filename *.h *.c \
  1393. &gt;filename.man ENTER</KBD>
  1394. </PRE>
  1395. <H3><A NAME="5_1_2">Creating Xcode Documentation Sets</A></H3>
  1396. <P>The <TT>--docset directory.docset</TT> option tells <TT>mxmldoc</TT>
  1397. to create an Xcode documentation set containing the HTML documentation,
  1398. for example:</P>
  1399. <PRE>
  1400. <KBD>mxmldoc --docset foo.docset *.h *.c foo.xml ENTER</KBD>
  1401. </PRE>
  1402. <P>Xcode documentation sets can only be built on Mac OS X with Xcode 3.0
  1403. or higher installed.</P>
  1404. <H2><A NAME="5_2">Commenting Your Code</A></H2>
  1405. <P>As noted previously, <TT>mxmldoc</TT> looks for in-line comments to
  1406. describe the functions, types, and constants in your code. <TT>Mxmldoc</TT>
  1407. will document all public names it finds in your source files - any
  1408. names starting with the underscore character (_) or names that are
  1409. documented with the <A HREF="#ATDIRECTIVES">@private@</A> directive are
  1410. treated as private and are not documented.</P>
  1411. <P>Comments appearing directly before a function or type definition are
  1412. used to document that function or type. Comments appearing after
  1413. argument, definition, return type, or variable declarations are used to
  1414. document that argument, definition, return type, or variable. For
  1415. example, the following code excerpt defines a key/value structure and a
  1416. function that creates a new instance of that structure:</P>
  1417. <PRE>
  1418. /* A key/value pair. This is used with the
  1419. dictionary structure. */
  1420. struct keyval
  1421. {
  1422. char *key; /* Key string */
  1423. char *val; /* Value string */
  1424. };
  1425. /* Create a new key/value pair. */
  1426. struct keyval * /* New key/value pair */
  1427. new_keyval(
  1428. const char *key, /* Key string */
  1429. const char *val) /* Value string */
  1430. {
  1431. ...
  1432. }
  1433. </PRE>
  1434. <P><TT>Mxmldoc</TT> also knows to remove extra asterisks (*) from the
  1435. comment string, so the comment string:</P>
  1436. <PRE>
  1437. /*
  1438. * Compute the value of PI.
  1439. *
  1440. * The function connects to an Internet server
  1441. * that streams audio of mathematical monks
  1442. * chanting the first 100 digits of PI.
  1443. */
  1444. </PRE>
  1445. <P>will be shown as:</P>
  1446. <PRE>
  1447. Compute the value of PI.
  1448. The function connects to an Internet server
  1449. that streams audio of mathematical monks
  1450. chanting the first 100 digits of PI.
  1451. </PRE>
  1452. <P><A name="ATDIRECTIVES">Comments</A> can also include the following
  1453. special <TT>@name ...@</TT> directive strings:</P>
  1454. <UL>
  1455. <LI><TT>@deprecated@</TT> - flags the item as deprecated to discourage
  1456. its use</LI>
  1457. <LI><TT>@private@</TT> - flags the item as private so it will not be
  1458. included in the documentation</LI>
  1459. <LI><TT>@since ...@</TT> - flags the item as new since a particular
  1460. release. The text following the <TT>@since</TT> up to the closing <TT>@</TT>
  1461. is highlighted in the generated documentation, e.g. <TT>@since Mini-XML
  1462. 2.7@</TT>.</LI>
  1463. </UL>
  1464. <!-- NEED 10 -->
  1465. <H2><A NAME="5_3">Titles, Sections, and Introductions</A></H2>
  1466. <P><TT>Mxmldoc</TT> also provides options to set the title, section, and
  1467. introduction text for the generated documentation. The <TT>--title text</TT>
  1468. option specifies the title for the documentation. The title string is
  1469. usually put in quotes:</P>
  1470. <PRE>
  1471. <KBD>mxmldoc filename.xml \
  1472. --title &quot;My Famous Documentation&quot; \
  1473. &gt;filename.html ENTER</KBD>
  1474. </PRE>
  1475. <P>The <TT>--section name</TT> option specifies the section for the
  1476. documentation. For HTML documentation, the name is placed in a HTML
  1477. comment such as:</P>
  1478. <PRE>
  1479. &lt;!-- SECTION: name --&gt;
  1480. </PRE>
  1481. <P>For man pages, the section name is usually just a number (&quot;3&quot;), or a
  1482. number followed by a vendor name (&quot;3acme&quot;). The section name is used in
  1483. the <TT>.TH</TT> directive in the man page:</P>
  1484. <PRE>
  1485. .TH mylibrary 3acme &quot;My Title&quot; ...
  1486. </PRE>
  1487. <P>The default section name for man page output is &quot;3&quot;. There is no
  1488. default section name for HTML output.</P>
  1489. <P>Finally, the <TT>--intro filename</TT> option specifies a file to
  1490. embed after the title and section but before the generated
  1491. documentation. For HTML documentation, the file must consist of valid
  1492. HTML without the usual <TT>DOCTYPE</TT>, <TT>html</TT>, and <TT>body</TT>
  1493. elements. For man page documentation, the file must consist of valid <TT>
  1494. nroff(1)</TT> text.</P>
  1495. <HR NOSHADE>
  1496. <H1 align="right"><A name="LICENSE"><IMG align="right" alt="A" height="100"
  1497. hspace="10" src="A.gif" width="100"></A>Mini-XML License</H1>
  1498. <P>The Mini-XML library and included programs are provided under the
  1499. terms of the GNU Library General Public License version 2 (LGPL2) with
  1500. the following exceptions:</P>
  1501. <P><B>1.</B> Static linking of applications to the Mini-XML library does
  1502. not constitute a derivative work and does not require the author to
  1503. provide source code for the application, use the shared Mini-XML
  1504. libraries, or link their applications against a user-supplied version
  1505. of Mini-XML.</P>
  1506. <P><I>If you link the application to a modified version of Mini-XML,
  1507. then the changes to Mini-XML must be provided under the terms of the
  1508. LGPL2 in sections 1, 2, and 4.</I></P>
  1509. <P><B>2.</B> You do not have to provide a copy of the Mini-XML license
  1510. with programs that are linked to the Mini-XML library, nor do you have
  1511. to identify the Mini-XML license in your program or documentation as
  1512. required by section 6 of the LGPL2.</P>
  1513. <P>&nbsp;</P>
  1514. <P align="center"><B>GNU LIBRARY GENERAL PUBLIC LICENSE</B></P>
  1515. <P align="center">Version 2, June 1991
  1516. <BR> Copyright (C) 1991 Free Software Foundation, Inc.
  1517. <BR> 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  1518. <BR> Everyone is permitted to copy and distribute verbatim copies of
  1519. this license document, but changing it is not allowed.
  1520. <BR> [This is the first released version of the library GPL. It is
  1521. numbered 2 because it goes with version 2 of the ordinary GPL.]</P>
  1522. <P><B>Preamble</B></P>
  1523. <P>The licenses for most software are designed to take away your freedom
  1524. to share and change it. By contrast, the GNU General Public Licenses
  1525. are intended to guarantee your freedom to share and change free
  1526. software--to make sure the software is free for all its users.</P>
  1527. <P>This license, the Library General Public License, applies to some
  1528. specially designated Free Software Foundation software, and to any
  1529. other libraries whose authors decide to use it. You can use it for your
  1530. libraries, too.</P>
  1531. <P>When we speak of free software, we are referring to freedom, not
  1532. price. Our General Public Licenses are designed to make sure that you
  1533. have the freedom to distribute copies of free software (and charge for
  1534. this service if you wish), that you receive source code or can get it
  1535. if you want it, that you can change the software or use pieces of it in
  1536. new free programs; and that you know you can do these things.</P>
  1537. <P>To protect your rights, we need to make restrictions that forbid
  1538. anyone to deny you these rights or to ask you to surrender the rights.
  1539. These restrictions translate to certain responsibilities for you if you
  1540. distribute copies of the library, or if you modify it.</P>
  1541. <P>For example, if you distribute copies of the library, whether gratis
  1542. or for a fee, you must give the recipients all the rights that we gave
  1543. you. You must make sure that they, too, receive or can get the source
  1544. code. If you link a program with the library, you must provide complete
  1545. object files to the recipients so that they can relink them with the
  1546. library, after making changes to the library and recompiling it. And
  1547. you must show them these terms so they know their rights.</P>
  1548. <P>Our method of protecting your rights has two steps: (1) copyright the
  1549. library, and (2) offer you this license which gives you legal
  1550. permission to copy, distribute and/or modify the library.</P>
  1551. <P>Also, for each distributor's protection, we want to make certain that
  1552. everyone understands that there is no warranty for this free library.
  1553. If the library is modified by someone else and passed on, we want its
  1554. recipients to know that what they have is not the original version, so
  1555. that any problems introduced by others will not reflect on the original
  1556. authors' reputations.</P>
  1557. <P>Finally, any free program is threatened constantly by software
  1558. patents. We wish to avoid the danger that companies distributing free
  1559. software will individually obtain patent licenses, thus in effect
  1560. transforming the program into proprietary software. To prevent this, we
  1561. have made it clear that any patent must be licensed for everyone's free
  1562. use or not licensed at all.</P>
  1563. <P>Most GNU software, including some libraries, is covered by the
  1564. ordinary GNU General Public License, which was designed for utility
  1565. programs. This license, the GNU Library General Public License, applies
  1566. to certain designated libraries. This license is quite different from
  1567. the ordinary one; be sure to read it in full, and don't assume that
  1568. anything in it is the same as in the ordinary license.</P>
  1569. <P>The reason we have a separate public license for some libraries is
  1570. that they blur the distinction we usually make between modifying or
  1571. adding to a program and simply using it. Linking a program with a
  1572. library, without changing the library, is in some sense simply using
  1573. the library, and is analogous to running a utility program or
  1574. application program. However, in a textual and legal sense, the linked
  1575. executable is a combined work, a derivative of the original library,
  1576. and the ordinary General Public License treats it as such.</P>
  1577. <P>Because of this blurred distinction, using the ordinary General
  1578. Public License for libraries did not effectively promote software
  1579. sharing, because most developers did not use the libraries. We
  1580. concluded that weaker conditions might promote sharing better.</P>
  1581. <P>However, unrestricted linking of non-free programs would deprive the
  1582. users of those programs of all benefit from the free status of the
  1583. libraries themselves. This Library General Public License is intended
  1584. to permit developers of non-free programs to use free libraries, while
  1585. preserving your freedom as a user of such programs to change the free
  1586. libraries that are incorporated in them. (We have not seen how to
  1587. achieve this as regards changes in header files, but we have achieved
  1588. it as regards changes in the actual functions of the Library.) The hope
  1589. is that this will lead to faster development of free libraries.</P>
  1590. <P>The precise terms and conditions for copying, distribution and
  1591. modification follow. Pay close attention to the difference between a
  1592. &quot;work based on the libary&quot; and a &quot;work that uses the library&quot;. The
  1593. former contains code derived from the library, while the latter only
  1594. works together with the library.</P>
  1595. <P>Note that it is possible for a library to be covered by the ordinary
  1596. General Public License rather than by this special one.</P>
  1597. <P align="center"><B>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
  1598. MODIFICATION</B></P>
  1599. <P><STRONG>0.</STRONG> This License Agreement applies to any software
  1600. library which contains a notice placed by the copyright holder or other
  1601. authorized party saying it may be distributed under the terms of this
  1602. Library General Public License (also called &quot;this License&quot;). Each
  1603. licensee is addressed as &quot;you&quot;.</P>
  1604. <P>A &quot;library&quot; means a collection of software functions and/or data
  1605. prepared so as to be conveniently linked with application programs
  1606. (which use some of those functions and data) to form executables.</P>
  1607. <P>The &quot;Library&quot;, below, refers to any such software library or work
  1608. which has been distributed under these terms. A &quot;work based on the
  1609. Library&quot; means either the Library or any derivative work under
  1610. copyright law: that is to say, a work containing the Library or a
  1611. portion of it, either verbatim or with modifications and/or translated
  1612. straightforwardly into another language. (Hereinafter, translation is
  1613. included without limitation in the term &quot;modification&quot;.)</P>
  1614. <P>&quot;Source code&quot; for a work means the preferred form of the work for
  1615. making modifications to it. For a library, complete source code means
  1616. all the source code for all modules it contains, plus any associated
  1617. interface definition files, plus the scripts used to control
  1618. compilation and installation of the library.</P>
  1619. <P>Activities other than copying, distribution and modification are not
  1620. covered by this License; they are outside its scope. The act of running
  1621. a program using the Library is not restricted, and output from such a
  1622. program is covered only if its contents constitute a work based on the
  1623. Library (independent of the use of the Library in a tool for writing
  1624. it). Whether that is true depends on what the Library does and what the
  1625. program that uses the Library does.</P>
  1626. <P><STRONG>1.</STRONG> You may copy and distribute verbatim copies of
  1627. the Library's complete source code as you receive it, in any medium,
  1628. provided that you conspicuously and appropriately publish on each copy
  1629. an appropriate copyright notice and disclaimer of warranty; keep intact
  1630. all the notices that refer to this License and to the absence of any
  1631. warranty; and distribute a copy of this License along with the Library.</P>
  1632. <P>You may charge a fee for the physical act of transferring a copy, and
  1633. you may at your option offer warranty protection in exchange for a fee.</P>
  1634. <P><STRONG>2.</STRONG> You may modify your copy or copies of the Library
  1635. or any portion of it, thus forming a work based on the Library, and
  1636. copy and distribute such modifications or work under the terms of
  1637. Section 1 above, provided that you also meet all of these conditions:</P>
  1638. <UL>
  1639. <P><STRONG>a)</STRONG> The modified work must itself be a software
  1640. library.</P>
  1641. <P><STRONG>b)</STRONG> You must cause the files modified to carry
  1642. prominent notices stating that you changed the files and the date of
  1643. any change.</P>
  1644. <P><STRONG>c)</STRONG> You must cause the whole of the work to be
  1645. licensed at no charge to all third parties under the terms of this
  1646. License.</P>
  1647. <P><STRONG>d)</STRONG> If a facility in the modified Library refers to a
  1648. function or a table of data to be supplied by an application program
  1649. that uses the facility, other than as an argument passed when the
  1650. facility is invoked, then you must make a good faith effort to ensure
  1651. that, in the event an application does not supply such function or
  1652. table, the facility still operates, and performs whatever part of its
  1653. purpose remains meaningful.</P>
  1654. <P>(For example, a function in a library to compute square roots has a
  1655. purpose that is entirely well-defined independent of the application.
  1656. Therefore, Subsection 2d requires that any application-supplied
  1657. function or table used by this function must be optional: if the
  1658. application does not supply it, the square root function must still
  1659. compute square roots.)</P>
  1660. </UL>
  1661. <P>These requirements apply to the modified work as a whole. If
  1662. identifiable sections of that work are not derived from the Library,
  1663. and can be reasonably considered independent and separate works in
  1664. themselves, then this License, and its terms, do not apply to those
  1665. sections when you distribute them as separate works. But when you
  1666. distribute the same sections as part of a whole which is a work based
  1667. on the Library, the distribution of the whole must be on the terms of
  1668. this License, whose permissions for other licensees extend to the
  1669. entire whole, and thus to each and every part regardless of who wrote
  1670. it.</P>
  1671. <P>Thus, it is not the intent of this section to claim rights or contest
  1672. your rights to work written entirely by you; rather, the intent is to
  1673. exercise the right to control the distribution of derivative or
  1674. collective works based on the Library.</P>
  1675. <P>In addition, mere aggregation of another work not based on the
  1676. Library with the Library (or with a work based on the Library) on a
  1677. volume of a storage or distribution medium does not bring the other
  1678. work under the scope of this License.</P>
  1679. <P><STRONG>3.</STRONG> You may opt to apply the terms of the ordinary
  1680. GNU General Public License instead of this License to a given copy of
  1681. the Library. To do this, you must alter all the notices that refer to
  1682. this License, so that they refer to the ordinary GNU General Public
  1683. License, version 2, instead of to this License. (If a newer version
  1684. than version 2 of the ordinary GNU General Public License has appeared,
  1685. then you can specify that version instead if you wish.) Do not make any
  1686. other change in these notices.</P>
  1687. <P>Once this change is made in a given copy, it is irreversible for that
  1688. copy, so the ordinary GNU General Public License applies to all
  1689. subsequent copies and derivative works made from that copy.</P>
  1690. <P>This option is useful when you wish to copy part of the code of the
  1691. Library into a program that is not a library.</P>
  1692. <P><STRONG>4.</STRONG> You may copy and distribute the Library (or a
  1693. portion or derivative of it, under Section 2) in object code or
  1694. executable form under the terms of Sections 1 and 2 above provided that
  1695. you accompany it with the complete corresponding machine-readable
  1696. source code, which must be distributed under the terms of Sections 1
  1697. and 2 above on a medium customarily used for software interchange.</P>
  1698. <P>If distribution of object code is made by offering access to copy
  1699. from a designated place, then offering equivalent access to copy the
  1700. source code from the same place satisfies the requirement to distribute
  1701. the source code, even though third parties are not compelled to copy
  1702. the source along with the object code.</P>
  1703. <P><STRONG>5.</STRONG> A program that contains no derivative of any
  1704. portion of the Library, but is designed to work with the Library by
  1705. being compiled or linked with it, is called a &quot;work that uses the
  1706. Library&quot;. Such a work, in isolation, is not a derivative work of the
  1707. Library, and therefore falls outside the scope of this License.</P>
  1708. <P>However, linking a &quot;work that uses the Library&quot; with the Library
  1709. creates an executable that is a derivative of the Library (because it
  1710. contains portions of the Library), rather than a &quot;work that uses the
  1711. library&quot;. The executable is therefore covered by this License. Section
  1712. 6 states terms for distribution of such executables.</P>
  1713. <P>When a &quot;work that uses the Library&quot; uses material from a header file
  1714. that is part of the Library, the object code for the work may be a
  1715. derivative work of the Library even though the source code is not.
  1716. Whether this is true is especially significant if the work can be
  1717. linked without the Library, or if the work is itself a library. The
  1718. threshold for this to be true is not precisely defined by law.</P>
  1719. <P>If such an object file uses only numerical parameters, data structure
  1720. layouts and accessors, and small macros and small inline functions (ten
  1721. lines or less in length), then the use of the object file is
  1722. unrestricted, regardless of whether it is legally a derivative work.
  1723. (Executables containing this object code plus portions of the Library
  1724. will still fall under Section 6.)</P>
  1725. <P>Otherwise, if the work is a derivative of the Library, you may
  1726. distribute the object code for the work under the terms of Section 6.
  1727. Any executables containing that work also fall under Section 6, whether
  1728. or not they are linked directly with the Library itself.</P>
  1729. <P><STRONG>6.</STRONG> As an exception to the Sections above, you may
  1730. also compile or link a &quot;work that uses the Library&quot; with the Library to
  1731. produce a work containing portions of the Library, and distribute that
  1732. work under terms of your choice, provided that the terms permit
  1733. modification of the work for the customer's own use and reverse
  1734. engineering for debugging such modifications.</P>
  1735. <P>You must give prominent notice with each copy of the work that the
  1736. Library is used in it and that the Library and its use are covered by
  1737. this License. You must supply a copy of this License. If the work
  1738. during execution displays copyright notices, you must include the
  1739. copyright notice for the Library among them, as well as a reference
  1740. directing the user to the copy of this License. Also, you must do one
  1741. of these things:</P>
  1742. <UL><STRONG> a)</STRONG> Accompany the work with the complete
  1743. corresponding machine-readable source code for the Library including
  1744. whatever changes were used in the work (which must be distributed under
  1745. Sections 1 and 2 above); and, if the work is an executable linked with
  1746. the Library, with the complete machine-readable &quot;work that uses the
  1747. Library&quot;, as object code and/or source code, so that the user can
  1748. modify the Library and then relink to produce a modified executable
  1749. containing the modified Library. (It is understood that the user who
  1750. changes the contents of definitions files in the Library will not
  1751. necessarily be able to recompile the application to use the modified
  1752. definitions.)
  1753. <P><STRONG>b)</STRONG> Accompany the work with a written offer, valid
  1754. for at least three years, to give the same user the materials specified
  1755. in Subsection 6a, above, for a charge no more than the cost of
  1756. performing this distribution.</P>
  1757. <P><STRONG>c)</STRONG> If distribution of the work is made by offering
  1758. access to copy from a designated place, offer equivalent access to copy
  1759. the above specified materials from the same place.</P>
  1760. <P><STRONG>d)</STRONG> Verify that the user has already received a copy
  1761. of these materials or that you have already sent this user a copy.</P>
  1762. </UL>
  1763. <P>For an executable, the required form of the &quot;work that uses the
  1764. Library&quot; must include any data and utility programs needed for
  1765. reproducing the executable from it. However, as a special exception,
  1766. the source code distributed need not include anything that is normally
  1767. distributed (in either source or binary form) with the major components
  1768. (compiler, kernel, and so on) of the operating system on which the
  1769. executable runs, unless that component itself accompanies the
  1770. executable.</P>
  1771. <P>It may happen that this requirement contradicts the license
  1772. restrictions of other proprietary libraries that do not normally
  1773. accompany the operating system. Such a contradiction means you cannot
  1774. use both them and the Library together in an executable that you
  1775. distribute.</P>
  1776. <P><STRONG>7.</STRONG> You may place library facilities that are a work
  1777. based on the Library side-by-side in a single library together with
  1778. other library facilities not covered by this License, and distribute
  1779. such a combined library, provided that the separate distribution of the
  1780. work based on the Library and of the other library facilities is
  1781. otherwise permitted, and provided that you do these two things:</P>
  1782. <UL><STRONG> a)</STRONG> Accompany the combined library with a copy of
  1783. the same work based on the Library, uncombined with any other library
  1784. facilities. This must be distributed under the terms of the Sections
  1785. above.
  1786. <P><STRONG>b)</STRONG> Give prominent notice with the combined library
  1787. of the fact that part of it is a work based on the Library, and
  1788. explaining where to find the accompanying uncombined form of the same
  1789. work.</P>
  1790. </UL>
  1791. <P><STRONG>8.</STRONG> You may not copy, modify, sublicense, link with,
  1792. or distribute the Library except as expressly provided under this
  1793. License. Any attempt otherwise to copy, modify, sublicense, link with,
  1794. or distribute the Library is void, and will automatically terminate
  1795. your rights under this License. However, parties who have received
  1796. copies, or rights, from you under this License will not have their
  1797. licenses terminated so long as such parties remain in full compliance.</P>
  1798. <P><STRONG>9.</STRONG> You are not required to accept this License,
  1799. since you have not signed it. However, nothing else grants you
  1800. permission to modify or distribute the Library or its derivative works.
  1801. These actions are prohibited by law if you do not accept this License.
  1802. Therefore, by modifying or distributing the Library (or any work based
  1803. on the Library), you indicate your acceptance of this License to do so,
  1804. and all its terms and conditions for copying, distributing or modifying
  1805. the Library or works based on it.</P>
  1806. <P><STRONG>10.</STRONG> Each time you redistribute the Library (or any
  1807. work based on the Library), the recipient automatically receives a
  1808. license from the original licensor to copy, distribute, link with or
  1809. modify the Library subject to these terms and conditions. You may not
  1810. impose any further restrictions on the recipients' exercise of the
  1811. rights granted herein. You are not responsible for enforcing compliance
  1812. by third parties to this License.</P>
  1813. <P><STRONG>11.</STRONG> If, as a consequence of a court judgment or
  1814. allegation of patent infringement or for any other reason (not limited
  1815. to patent issues), conditions are imposed on you (whether by court
  1816. order, agreement or otherwise) that contradict the conditions of this
  1817. License, they do not excuse you from the conditions of this License. If
  1818. you cannot distribute so as to satisfy simultaneously your obligations
  1819. under this License and any other pertinent obligations, then as a
  1820. consequence you may not distribute the Library at all. For example, if
  1821. a patent license would not permit royalty-free redistribution of the
  1822. Library by all those who receive copies directly or indirectly through
  1823. you, then the only way you could satisfy both it and this License would
  1824. be to refrain entirely from distribution of the Library.</P>
  1825. <P>If any portion of this section is held invalid or unenforceable under
  1826. any particular circumstance, the balance of the section is intended to
  1827. apply, and the section as a whole is intended to apply in other
  1828. circumstances.</P>
  1829. <P>It is not the purpose of this section to induce you to infringe any
  1830. patents or other property right claims or to contest validity of any
  1831. such claims; this section has the sole purpose of protecting the
  1832. integrity of the free software distribution system which is implemented
  1833. by public license practices. Many people have made generous
  1834. contributions to the wide range of software distributed through that
  1835. system in reliance on consistent application of that system; it is up
  1836. to the author/donor to decide if he or she is willing to distribute
  1837. software through any other system and a licensee cannot impose that
  1838. choice.</P>
  1839. <P>This section is intended to make thoroughly clear what is believed to
  1840. be a consequence of the rest of this License.</P>
  1841. <P><STRONG>12.</STRONG> If the distribution and/or use of the Library is
  1842. restricted in certain countries either by patents or by copyrighted
  1843. interfaces, the original copyright holder who places the Library under
  1844. this License may add an explicit geographical distribution limitation
  1845. excluding those countries, so that distribution is permitted only in or
  1846. among countries not thus excluded. In such case, this License
  1847. incorporates the limitation as if written in the body of this License.</P>
  1848. <P><STRONG>13.</STRONG> The Free Software Foundation may publish revised
  1849. and/or new versions of the Library General Public License from time to
  1850. time. Such new versions will be similar in spirit to the present
  1851. version, but may differ in detail to address new problems or concerns.</P>
  1852. <P>Each version is given a distinguishing version number. If the Library
  1853. specifies a version number of this License which applies to it and &quot;any
  1854. later version&quot;, you have the option of following the terms and
  1855. conditions either of that version or of any later version published by
  1856. the Free Software Foundation. If the Library does not specify a license
  1857. version number, you may choose any version ever published by the Free
  1858. Software Foundation.</P>
  1859. <P><STRONG>14.</STRONG> If you wish to incorporate parts of the Library
  1860. into other free programs whose distribution conditions are incompatible
  1861. with these, write to the author to ask for permission. For software
  1862. which is copyrighted by the Free Software Foundation, write to the Free
  1863. Software Foundation; we sometimes make exceptions for this. Our
  1864. decision will be guided by the two goals of preserving the free status
  1865. of all derivatives of our free software and of promoting the sharing
  1866. and reuse of software generally.</P>
  1867. <P align="center"><B>NO WARRANTY</B></P>
  1868. <P><STRONG>15.</STRONG> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE,
  1869. THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY
  1870. APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
  1871. HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT
  1872. WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
  1873. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  1874. PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
  1875. OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU
  1876. ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</P>
  1877. <P><STRONG>16.</STRONG> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR
  1878. AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO
  1879. MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE
  1880. LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL
  1881. OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
  1882. LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
  1883. RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
  1884. FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
  1885. SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  1886. DAMAGES.</P>
  1887. <P align="center"><B>END OF TERMS AND CONDITIONS</B></P>
  1888. <P><B>How to Apply These Terms to Your New Libraries</B></P>
  1889. <P>If you develop a new library, and you want it to be of the greatest
  1890. possible use to the public, we recommend making it free software that
  1891. everyone can redistribute and change. You can do so by permitting
  1892. redistribution under these terms (or, alternatively, under the terms of
  1893. the ordinary General Public License).</P>
  1894. <P>To apply these terms, attach the following notices to the library. It
  1895. is safest to attach them to the start of each source file to most
  1896. effectively convey the exclusion of warranty; and each file should have
  1897. at least the &quot;copyright&quot; line and a pointer to where the full notice is
  1898. found.</P>
  1899. <UL>
  1900. <P><VAR>one line to give the library's name and an idea of what it does.</VAR>
  1901. <BR> Copyright (C)<VAR> year</VAR><VAR> name of author</VAR></P>
  1902. <P>This library is free software; you can redistribute it and/or modify
  1903. it under the terms of the GNU Lesser General Public License as
  1904. published by the Free Software Foundation; either version 2.1 of the
  1905. License, or (at your option) any later version.</P>
  1906. <P>This library is distributed in the hope that it will be useful, but
  1907. WITHOUT ANY WARRANTY; without even the implied warranty of
  1908. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
  1909. General Public License for more details.</P>
  1910. <P>You should have received a copy of the GNU Lesser General Public
  1911. License along with this library; if not, write to the Free Software
  1912. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</P>
  1913. </UL>
  1914. <P>Also add information on how to contact you by electronic and paper
  1915. mail.</P>
  1916. <P>You should also get your employer (if you work as a programmer) or
  1917. your school, if any, to sign a &quot;copyright disclaimer&quot; for the library,
  1918. if necessary. Here is a sample; alter the names:</P>
  1919. <UL>
  1920. <P>Yoyodyne, Inc., hereby disclaims all copyright interest in the
  1921. library `Frob' (a library for tweaking knobs) written by James Random
  1922. Hacker.</P>
  1923. <P><VAR>signature of Ty Coon</VAR>, 1 April 1990 Ty Coon, President of
  1924. Vice</P>
  1925. </UL>
  1926. <P>That's all there is to it!</P>
  1927. <HR NOSHADE>
  1928. <H1 align="right"><A name="RELNOTES"><IMG align="right" alt="B" height="100"
  1929. hspace="10" src="B.gif" width="100"></A>Release Notes</H1>
  1930. <H2><A NAME="7_1">Changes in Mini-XML 2.10</A></H2>
  1931. <UL>
  1932. <LI>The version number in mxml.h was wrong (Bug #532)</LI>
  1933. <LI>The mxml.spec file was out of date (Bug #521)</LI>
  1934. <LI>Mini-XML no longer allows malformed element names (Bug #509)</LI>
  1935. <LI>mxmlLoad* and mxmlSAXLoad* did not properly create text nodes when
  1936. MXML_TEXT_CALLBACK was specified (Bug #531)</LI>
  1937. <LI>mxmlDelete used a recursive algorithm which could require large
  1938. amounts of stack space depending on the file (Bug #549, CVE-2016-4570)</LI>
  1939. <LI>mxmlWrite* used a recursive algorithm which could require large
  1940. amounts of stack space depending on the file (Bug #549, CVE-2016-4571)</LI>
  1941. </UL>
  1942. <H2><A NAME="7_2">Changes in Mini-XML 2.9</A></H2>
  1943. <UL>
  1944. <LI>mxmlLoad* did not correctly load value nodes with MXML_NO_CALLBACK
  1945. or MXML_TEXT_CALLBACK (Bug #502)</LI>
  1946. </UL>
  1947. <H2><A NAME="7_3">Changes in Mini-XML 2.8</A></H2>
  1948. <UL>
  1949. <LI>Now call docsetutil using xcrun on OS X (Bug #458)</LI>
  1950. <LI>mxmldoc did not escape special HTML characters inside @code foo@
  1951. comments.</LI>
  1952. <LI>Fixed a memory leak in mxmlElementDeleteAttr (Bug #452)</LI>
  1953. <LI>Added MXML_MAJOR/MINOR_VERSION definitions to mxml.h (Bug $461)</LI>
  1954. <LI>Fixed a bug reading UTF-16 characters from a file (Bug #454)</LI>
  1955. <LI>Fixed a memory leak when loading invalid XML (Bug #496)</LI>
  1956. <LI>Fixed an XML fragment loading problem (Bug #494)</LI>
  1957. </UL>
  1958. <H2><A NAME="7_4">Changes in Mini-XML 2.7</A></H2>
  1959. <UL>
  1960. <LI>Added 64-bit configurations to the VC++ project files (STR #129)</LI>
  1961. <LI>Fixed conformance of mxmldoc's HTML and CSS output.</LI>
  1962. <LI>Added data accessor (&quot;get&quot;) functions and made the mxml_node_t and
  1963. mxml_index_t structures private but still available in the Mini-XML
  1964. header to preserve source compatibility (STR #118)</LI>
  1965. <LI>Updated the source headers to reference the Mini-XML license and its
  1966. exceptions to the LGPL2 (STR #108)</LI>
  1967. <LI>Added a new mxmlFindPath() function to find the value node of a
  1968. named element (STR #110)</LI>
  1969. <LI>Building a static version of the library did not work on Windows
  1970. (STR #112)</LI>
  1971. <LI>The shared library did not include a destructor for the thread-
  1972. specific data key on UNIX-based operating systems (STR #103)</LI>
  1973. <LI>mxmlLoad* did not error out on XML with multiple root nodes (STR
  1974. #101)</LI>
  1975. <LI>Fixed an issue with the _mxml_vstrdupf function (STR #107)</LI>
  1976. <LI>mxmlSave* no longer write all siblings of the passed node, just that
  1977. node and its children (STR #109)</LI>
  1978. </UL>
  1979. <H2><A NAME="7_5">Changes in Mini-XML 2.6</A></H2>
  1980. <UL>
  1981. <LI>Documentation fixes (STR #91, STR #92)</LI>
  1982. <LI>The mxmldoc program did not handle typedef comments properly (STR
  1983. #72)</LI>
  1984. <LI>Added support for &quot;long long&quot; printf formats.</LI>
  1985. <LI>The XML parser now ignores BOMs in UTF-8 XML files (STR #89)</LI>
  1986. <LI>The mxmldoc program now supports generating Xcode documentation
  1987. sets.</LI>
  1988. <LI>mxmlSave*() did not output UTF-8 correctly on some platforms.</LI>
  1989. <LI>mxmlNewXML() now adds encoding=&quot;utf-8&quot; in the ?xml directive to
  1990. avoid problems with non-conformant XML parsers that assume something
  1991. other than UTF-8 as the default encoding.</LI>
  1992. <LI>Wrapping was not disabled when mxmlSetWrapMargin(0) was called, and
  1993. &quot;&lt;?xml ... ?&gt;&quot; was always followed by a newline (STR #76)</LI>
  1994. <LI>The mxml.pc.in file was broken (STR #79)</LI>
  1995. <LI>The mxmldoc program now handles &quot;typedef enum name {} name&quot;
  1996. correctly (STR #72)</LI>
  1997. </UL>
  1998. <H2><A NAME="7_6">Changes in Mini-XML 2.5</A></H2>
  1999. <UL>
  2000. <LI>The mxmldoc program now makes greater use of CSS and supports a
  2001. --css option to embed an alternate stylesheet.</LI>
  2002. <LI>The mxmldoc program now supports --header and --footer options to
  2003. insert documentation content before and after the generated content.</LI>
  2004. <LI>The mxmldoc program now supports a --framed option to generate
  2005. framed HTML output.</LI>
  2006. <LI>The mxmldoc program now creates a table of contents including any
  2007. headings in the --intro file when generating HTML output.</LI>
  2008. <LI>The man pages and man page output from mxmldoc did not use &quot;\-&quot; for
  2009. dashes (STR #68)</LI>
  2010. <LI>The debug version of the Mini-XML DLL could not be built (STR #65)</LI>
  2011. <LI>Processing instructions and directives did not work when not at the
  2012. top level of a document (STR #67)</LI>
  2013. <LI>Spaces around the &quot;=&quot; in attributes were not supported (STR #67)</LI>
  2014. </UL>
  2015. <H2><A NAME="7_7">Changes in Mini-XML 2.4</A></H2>
  2016. <UL>
  2017. <LI>Fixed shared library build problems on HP-UX and Mac OS X.</LI>
  2018. <LI>The mxmldoc program did not output argument descriptions for
  2019. functions properly.</LI>
  2020. <LI>All global settings (custom, error, and entity callbacks and the
  2021. wrap margin) are now managed separately for each thread.</LI>
  2022. <LI>Added mxmlElementDeleteAttr() function (STR #59)</LI>
  2023. <LI>mxmlElementSetAttrf() did not work (STR #57)</LI>
  2024. <LI>mxmlLoad*() incorrectly treated declarations as parent elements (STR
  2025. #56)</LI>
  2026. <LI>mxmlLoad*() incorrectly allowed attributes without values (STR #47)</LI>
  2027. <LI>Fixed Visual C++ build problems (STR #49)</LI>
  2028. <LI>mxmlLoad*() did not return NULL when an element contained an error
  2029. (STR #46)</LI>
  2030. <LI>Added support for the apos character entity (STR #54)</LI>
  2031. <LI>Fixed whitespace detection with Unicode characters (STR #48)</LI>
  2032. <LI>mxmlWalkNext() and mxmlWalkPrev() did not work correctly when called
  2033. with a node with no children as the top node (STR #53)</LI>
  2034. </UL>
  2035. <H2><A NAME="7_8">Changes in Mini-XML 2.3</A></H2>
  2036. <UL>
  2037. <LI>Added two exceptions to the LGPL to support static linking of
  2038. applications against Mini-XML</LI>
  2039. <LI>The mxmldoc utility can now generate man pages, too.</LI>
  2040. <LI>Added a mxmlNewXML() function</LI>
  2041. <LI>Added a mxmlElementSetAttrf() function (STR #43)</LI>
  2042. <LI>Added a snprintf() emulation function for the test program (STR #32)</LI>
  2043. <LI>Added the _CRT_SECURE_NO_DEPRECATE definition when building on VC++
  2044. 2005 (STR #36)</LI>
  2045. <LI>mxmlLoad*() did not detect missing &gt; characters in elements (STR
  2046. #41)</LI>
  2047. <LI>mxmlLoad*() did not detect missing close tags at the end of an XML
  2048. document (STR #45)</LI>
  2049. <LI>Added user_data and ref_count members to mxml_node_t structure</LI>
  2050. <LI>Added mxmlReleaseNode() and mxmlRetainNode() APIs for
  2051. reference-counted nodes</LI>
  2052. <LI>Added mxmlSetWrapMargin() to control the wrapping of XML output</LI>
  2053. <LI>Added conditional check for EINTR error code for certain Windows
  2054. compilers that do not define it (STR #33)</LI>
  2055. <LI>The mxmldoc program now generates correct HTML 4.0 output -
  2056. previously it generated invalid XHTML</LI>
  2057. <LI>The mxmldoc program now supports &quot;@deprecated@, &quot;@private@&quot;, and
  2058. &quot;@since version@&quot; comments</LI>
  2059. <LI>Fixed function and enumeration type bugs in mxmldoc</LI>
  2060. <LI>Fixed the XML schema for mxmldoc</LI>
  2061. <LI>The mxmldoc program now supports --intro, --section, and --title
  2062. options</LI>
  2063. <LI>The mxmlLoad*() functions could leak a node on an error (STR #27)</LI>
  2064. <LI>The mxml_vsnprintf() function could get in an infinite loop on a
  2065. buffer overflow (STR #25)</LI>
  2066. <LI>Added new mxmlNewCDATA() and mxmlSetCDATA() functions to create and
  2067. set CDATA nodes, which are really just special element nodes</LI>
  2068. <LI>Added new MXML_IGNORE type and MXML_IGNORE_CB callback to ignore
  2069. non-element nodes, e.g. whitespace</LI>
  2070. <LI>mxmlLoad*() did not treat custom data as opaque, so whitespace
  2071. characters would be lost</LI>
  2072. </UL>
  2073. <H2><A NAME="7_9">Changes in Mini-XML 2.2.2</A></H2>
  2074. <UL>
  2075. <LI>mxmlLoad*() did not treat custom data as opaque, so whitespace
  2076. characters would be lost.</LI>
  2077. </UL>
  2078. <H2><A NAME="7_10">Changes in Mini-XML 2.2.1</A></H2>
  2079. <UL>
  2080. <LI>mxmlLoadFd(), mxmlLoadFile(), and mxmlLoadString() now correctly
  2081. return NULL on error (STR #21)</LI>
  2082. <LI>mxmlNewInteger(), mxmlNewOpaque(), mxmlNewReal(), mxmlNewText(), and
  2083. mxmlNewTextf() incorrectly required a parent node (STR #22)</LI>
  2084. <LI>Fixed an XML output bug in mxmldoc.</LI>
  2085. <LI>The &quot;make install&quot; target now uses the install command to set the
  2086. proper permissions on UNIX/Linux/OSX.</LI>
  2087. <LI>Fixed a MingW/Cygwin compilation problem (STR #18)</LI>
  2088. </UL>
  2089. <H2><A NAME="7_11">Changes in Mini-XML 2.2</A></H2>
  2090. <UL>
  2091. <LI>Added shared library support (STR #17)</LI>
  2092. <LI>mxmlLoad*() now returns an error when an XML stream contains illegal
  2093. control characters (STR #10)</LI>
  2094. <LI>mxmlLoad*() now returns an error when an element contains two
  2095. attributes with the same name in conformance with the XML spec (STR
  2096. #16)</LI>
  2097. <LI>Added support for CDATA (STR #14, STR #15)</LI>
  2098. <LI>Updated comment and processing instruction handling - no entity
  2099. support per XML specification.</LI>
  2100. <LI>Added checking for invalid comment termination (&quot;---&gt;&quot; is not
  2101. allowed)</LI>
  2102. </UL>
  2103. <H2><A NAME="7_12">Changes in Mini-XML 2.1</A></H2>
  2104. <UL>
  2105. <LI>Added support for custom data nodes (STR #6)</LI>
  2106. <LI>Now treat UTF-8 sequences which are longer than necessary as an
  2107. error (STR #4)</LI>
  2108. <LI>Fixed entity number support (STR #8)</LI>
  2109. <LI>Fixed mxmlLoadString() bug with UTF-8 (STR #7)</LI>
  2110. <LI>Fixed entity lookup bug (STR #5)</LI>
  2111. <LI>Added mxmlLoadFd() and mxmlSaveFd() functions.</LI>
  2112. <LI>Fixed multi-word UTF-16 handling.</LI>
  2113. </UL>
  2114. <H2><A NAME="7_13">Changes in Mini-XML 2.0</A></H2>
  2115. <UL>
  2116. <LI>New programmers manual.</LI>
  2117. <LI>Added Visual C++ project files for Microsoft Windows users.</LI>
  2118. <LI>Added optimizations to mxmldoc, mxmlSaveFile(), and mxmlIndexNew()
  2119. (STR #2)</LI>
  2120. <LI>mxmlEntityAddCallback() now returns an integer status (STR #2)</LI>
  2121. <LI>Added UTF-16 support (input only; all output is UTF-8)</LI>
  2122. <LI>Added index functions to build a searchable index of XML nodes.</LI>
  2123. <LI>Added character entity callback interface to support additional
  2124. character entities beyond those defined in the XHTML specification.</LI>
  2125. <LI>Added support for XHTML character entities.</LI>
  2126. <LI>The mxmldoc utility now produces XML output which conforms to an
  2127. updated XML schema, described in the file &quot;doc/mxmldoc.xsd&quot;.</LI>
  2128. <LI>Changed the whitespace callback interface to return strings instead
  2129. of a single character, allowing for greater control over the formatting
  2130. of XML files written using Mini-XML. THIS CHANGE WILL REQUIRE CHANGES
  2131. TO YOUR 1.x CODE IF YOU USE WHITESPACE CALLBACKS.</LI>
  2132. <LI>The mxmldoc utility now produces XML output which conforms to an
  2133. updated XML schema, described in the file &quot;doc/mxmldoc.xsd&quot;.</LI>
  2134. <LI>Changed the whitespace callback interface to return strings instead
  2135. of a single character, allowing for greater control over the formatting
  2136. of XML files written using Mini-XML. THIS CHANGE WILL REQUIRE CHANGES
  2137. TO YOUR 1.x CODE IF YOU USE WHITESPACE CALLBACKS.</LI>
  2138. <LI>The mxmldoc utility is now capable of documenting C++ classes,
  2139. functions, and structures, and correctly handles C++ comments.</LI>
  2140. <LI>Added new modular tests for mxmldoc.</LI>
  2141. <LI>Updated the mxmldoc output to be more compatible with embedding in
  2142. manuals produced with HTMLDOC.</LI>
  2143. <LI>The makefile incorrectly included a &quot;/&quot; separator between the
  2144. destination path and install path. This caused problems when building
  2145. and installing with MingW.</LI>
  2146. </UL>
  2147. <H2><A NAME="7_14">Changes in Mini-XML 1.3</A></H2>
  2148. <UL>
  2149. <LI>Fixes for mxmldoc.</LI>
  2150. <LI>Added support for reading standard HTML entity names.</LI>
  2151. <LI>mxmlLoadString/File() did not decode character entities in element
  2152. names, attribute names, or attribute values.</LI>
  2153. <LI>mxmlLoadString/File() would crash when loading non- conformant XML
  2154. data under an existing parent (top) node.</LI>
  2155. <LI>Fixed several bugs in the mxmldoc utility.</LI>
  2156. <LI>Added new error callback function to catch a variety of errors and
  2157. log them to someplace other than stderr.</LI>
  2158. <LI>The mxmlElementSetAttr() function now allows for NULL attribute
  2159. values.</LI>
  2160. <LI>The load and save functions now properly handle quoted element and
  2161. attribute name strings properly, e.g. for !DOCTYPE declarations.</LI>
  2162. </UL>
  2163. <H2><A NAME="7_15">Changes in Mini-XML 1.2</A></H2>
  2164. <UL>
  2165. <LI>Added new &quot;set&quot; methods to set the value of a node.</LI>
  2166. <LI>Added new formatted text methods mxmlNewTextf() and mxmlSetTextf()
  2167. to create/set a text node value using printf-style formats.</LI>
  2168. <LI>Added new standard callbacks for use with the mxmlLoad functions.</LI>
  2169. <LI>Updated the HTML documentation to include examples of the walk and
  2170. load function output.</LI>
  2171. <LI>Added --with/without-ansi configure option to control the strdup()
  2172. function check.</LI>
  2173. <LI>Added --with/without-snprintf configure option to control the
  2174. snprintf() and vsnprintf() function checks.</LI>
  2175. </UL>
  2176. <H2><A NAME="7_16">Changes in Mini-XML 1.1.2</A></H2>
  2177. <UL>
  2178. <LI>The mxml(3) man page wasn't updated for the string functions.</LI>
  2179. <LI>mxmlSaveString() returned the wrong number of characters.</LI>
  2180. <LI>mxml_add_char() updated the buffer pointer in the wrong place.</LI>
  2181. </UL>
  2182. <H2><A NAME="7_17">Changes in Mini-XML 1.1.1</A></H2>
  2183. <UL>
  2184. <LI>The private mxml_add_ch() function did not update the
  2185. start-of-buffer pointer which could cause a crash when using
  2186. mxmlSaveString().</LI>
  2187. <LI>The private mxml_write_ws() function called putc() instead of using
  2188. the proper callback which could cause a crash when using
  2189. mxmlSaveString().</LI>
  2190. <LI>Added a mxmlSaveAllocString() convenience function for saving an XML
  2191. node tree to an allocated string.</LI>
  2192. </UL>
  2193. <H2><A NAME="7_18">Changes in Mini-XML 1.1</A></H2>
  2194. <UL>
  2195. <LI>The mxmlLoadFile() function now uses dynamically allocated string
  2196. buffers for element names, attribute names, and attribute values.
  2197. Previously they were capped at 16383, 255, and 255 bytes, respectively.</LI>
  2198. <LI>Added a new mxmlLoadString() function for loading an XML node tree
  2199. from a string.</LI>
  2200. <LI>Added a new mxmlSaveString() function for saving an XML node tree to
  2201. a string.</LI>
  2202. <LI>Add emulation of strdup() if the local platform does not provide the
  2203. function.</LI>
  2204. </UL>
  2205. <H2><A NAME="7_19">Changes in Mini-XML 1.0</A></H2>
  2206. <UL>
  2207. <LI>The mxmldoc program now handles function arguments, structures,
  2208. unions, enumerations, classes, and typedefs properly.</LI>
  2209. <LI>Documentation provided via mxmldoc and more in-line comments in the
  2210. code.</LI>
  2211. <LI>Added man pages and packaging files.</LI>
  2212. </UL>
  2213. <H2><A NAME="7_20">Changes in Mini-XML 0.93</A></H2>
  2214. <UL>
  2215. <LI>New mxmldoc example program that is also used to create and update
  2216. code documentation using XML and produce HTML reference pages.</LI>
  2217. <LI>Added mxmlAdd() and mxmlRemove() functions to add and remove nodes
  2218. from a tree. This provides more flexibility over where the nodes are
  2219. inserted and allows nodes to be moved within the tree as needed.</LI>
  2220. <LI>mxmlLoadFile() now correctly handles comments.</LI>
  2221. <LI>mxmlLoadFile() now supports the required &quot;gt&quot;, &quot;quot&quot;, and &quot;nbsp&quot;
  2222. character entities.</LI>
  2223. <LI>mxmlSaveFile() now uses newlines as whitespace when valid to do so.</LI>
  2224. <LI>mxmlFindElement() now also takes attribute name and attribute value
  2225. string arguments to limit the search to specific elements with
  2226. attributes and/or values.</LI>
  2227. NULL pointers can be used as &quot;wildcards&quot;.
  2228. <LI>Added uninstall target to makefile, and auto-reconfig if Makefile.in
  2229. or configure.in are changed.</LI>
  2230. <LI>mxmlFindElement(), mxmlWalkNext(), and mxmlWalkPrev() now all
  2231. provide &quot;descend&quot; arguments to control whether they descend into child
  2232. nodes in the tree.</LI>
  2233. <LI>Fixed some whitespace issues in mxmlLoadFile().</LI>
  2234. <LI>Fixed Unicode output and whitespace issues in mxmlSaveFile().</LI>
  2235. <LI>mxmlSaveFile() now supports a whitespace callback to provide more
  2236. human-readable XML output under program control.</LI>
  2237. </UL>
  2238. <H2><A NAME="7_21">Changes in Mini-XML 0.92</A></H2>
  2239. <UL>
  2240. <LI>mxmlSaveFile() didn't return a value on success.</LI>
  2241. </UL>
  2242. <H2><A NAME="7_22">Changes in Mini-XML 0.91</A></H2>
  2243. <UL>
  2244. <LI>mxmlWalkNext() would go into an infinite loop.</LI>
  2245. </UL>
  2246. <H2><A NAME="7_23">Changes in Mini-XML 0.9</A></H2>
  2247. <UL>
  2248. <LI>Initial public release.</LI>
  2249. </UL>
  2250. <HR NOSHADE>
  2251. <DIV class="body">
  2252. <H1 align="right"><A name="REFERENCE"><IMG align="right" alt="C" height="100"
  2253. hspace="10" src="C.gif" width="100"></A>Library Reference</H1>
  2254. <H2 class="title"><A NAME="8_1">Contents</A></H2>
  2255. <UL class="contents">
  2256. <LI><A href="#FUNCTIONS">Functions</A>
  2257. <UL class="code">
  2258. <LI><A href="#mxmlAdd" title="Add a node to a tree.">mxmlAdd</A></LI>
  2259. <LI><A href="#mxmlDelete" title="Delete a node and all of its children.">
  2260. mxmlDelete</A></LI>
  2261. <LI><A href="#mxmlElementDeleteAttr" title="Delete an attribute.">
  2262. mxmlElementDeleteAttr</A></LI>
  2263. <LI><A href="#mxmlElementGetAttr" title="Get an attribute.">
  2264. mxmlElementGetAttr</A></LI>
  2265. <LI><A href="#mxmlElementSetAttr" title="Set an attribute.">
  2266. mxmlElementSetAttr</A></LI>
  2267. <LI><A href="#mxmlElementSetAttrf" title="Set an attribute with a formatted value.">
  2268. mxmlElementSetAttrf</A></LI>
  2269. <LI><A href="#mxmlEntityAddCallback" title="Add a callback to convert entities to Unicode.">
  2270. mxmlEntityAddCallback</A></LI>
  2271. <LI><A href="#mxmlEntityGetName" title="Get the name that corresponds to the character value.">
  2272. mxmlEntityGetName</A></LI>
  2273. <LI><A href="#mxmlEntityGetValue" title="Get the character corresponding to a named entity.">
  2274. mxmlEntityGetValue</A></LI>
  2275. <LI><A href="#mxmlEntityRemoveCallback" title="Remove a callback.">
  2276. mxmlEntityRemoveCallback</A></LI>
  2277. <LI><A href="#mxmlFindElement" title="Find the named element.">
  2278. mxmlFindElement</A></LI>
  2279. <LI><A href="#mxmlFindPath" title="Find a node with the given path.">
  2280. mxmlFindPath</A></LI>
  2281. <LI><A href="#mxmlGetCDATA" title="Get the value for a CDATA node.">
  2282. mxmlGetCDATA</A></LI>
  2283. <LI><A href="#mxmlGetCustom" title="Get the value for a custom node.">
  2284. mxmlGetCustom</A></LI>
  2285. <LI><A href="#mxmlGetElement" title="Get the name for an element node.">
  2286. mxmlGetElement</A></LI>
  2287. <LI><A href="#mxmlGetFirstChild" title="Get the first child of an element node.">
  2288. mxmlGetFirstChild</A></LI>
  2289. <LI><A href="#mxmlGetInteger" title="Get the integer value from the specified node or its first child.">
  2290. mxmlGetInteger</A></LI>
  2291. <LI><A href="#mxmlGetLastChild" title="Get the last child of an element node.">
  2292. mxmlGetLastChild</A></LI>
  2293. <LI><A href="#mxmlGetNextSibling" title="Return the node type...">
  2294. mxmlGetNextSibling</A></LI>
  2295. <LI><A href="#mxmlGetOpaque" title="Get an opaque string value for a node or its first child.">
  2296. mxmlGetOpaque</A></LI>
  2297. <LI><A href="#mxmlGetParent" title="Get the parent node.">mxmlGetParent</A>
  2298. </LI>
  2299. <LI><A href="#mxmlGetPrevSibling" title="Get the previous node for the current parent.">
  2300. mxmlGetPrevSibling</A></LI>
  2301. <LI><A href="#mxmlGetReal" title="Get the real value for a node or its first child.">
  2302. mxmlGetReal</A></LI>
  2303. <LI><A href="#mxmlGetRefCount" title="Get the current reference (use) count for a node.">
  2304. mxmlGetRefCount</A></LI>
  2305. <LI><A href="#mxmlGetText" title="Get the text value for a node or its first child.">
  2306. mxmlGetText</A></LI>
  2307. <LI><A href="#mxmlGetType" title="Get the node type.">mxmlGetType</A></LI>
  2308. <LI><A href="#mxmlGetUserData" title="Get the user data pointer for a node.">
  2309. mxmlGetUserData</A></LI>
  2310. <LI><A href="#mxmlIndexDelete" title="Delete an index.">mxmlIndexDelete</A>
  2311. </LI>
  2312. <LI><A href="#mxmlIndexEnum" title="Return the next node in the index.">
  2313. mxmlIndexEnum</A></LI>
  2314. <LI><A href="#mxmlIndexFind" title="Find the next matching node.">
  2315. mxmlIndexFind</A></LI>
  2316. <LI><A href="#mxmlIndexGetCount" title="Get the number of nodes in an index.">
  2317. mxmlIndexGetCount</A></LI>
  2318. <LI><A href="#mxmlIndexNew" title="Create a new index.">mxmlIndexNew</A></LI>
  2319. <LI><A href="#mxmlIndexReset" title="Reset the enumeration/find pointer in the index and return the first node in the index.">
  2320. mxmlIndexReset</A></LI>
  2321. <LI><A href="#mxmlLoadFd" title="Load a file descriptor into an XML node tree.">
  2322. mxmlLoadFd</A></LI>
  2323. <LI><A href="#mxmlLoadFile" title="Load a file into an XML node tree.">
  2324. mxmlLoadFile</A></LI>
  2325. <LI><A href="#mxmlLoadString" title="Load a string into an XML node tree.">
  2326. mxmlLoadString</A></LI>
  2327. <LI><A href="#mxmlNewCDATA" title="Create a new CDATA node.">
  2328. mxmlNewCDATA</A></LI>
  2329. <LI><A href="#mxmlNewCustom" title="Create a new custom data node.">
  2330. mxmlNewCustom</A></LI>
  2331. <LI><A href="#mxmlNewElement" title="Create a new element node.">
  2332. mxmlNewElement</A></LI>
  2333. <LI><A href="#mxmlNewInteger" title="Create a new integer node.">
  2334. mxmlNewInteger</A></LI>
  2335. <LI><A href="#mxmlNewOpaque" title="Create a new opaque string.">
  2336. mxmlNewOpaque</A></LI>
  2337. <LI><A href="#mxmlNewReal" title="Create a new real number node.">
  2338. mxmlNewReal</A></LI>
  2339. <LI><A href="#mxmlNewText" title="Create a new text fragment node.">
  2340. mxmlNewText</A></LI>
  2341. <LI><A href="#mxmlNewTextf" title="Create a new formatted text fragment node.">
  2342. mxmlNewTextf</A></LI>
  2343. <LI><A href="#mxmlNewXML" title="Create a new XML document tree.">
  2344. mxmlNewXML</A></LI>
  2345. <LI><A href="#mxmlRelease" title="Release a node.">mxmlRelease</A></LI>
  2346. <LI><A href="#mxmlRemove" title="Remove a node from its parent.">
  2347. mxmlRemove</A></LI>
  2348. <LI><A href="#mxmlRetain" title="Retain a node.">mxmlRetain</A></LI>
  2349. <LI><A href="#mxmlSAXLoadFd" title="Load a file descriptor into an XML node tree using a SAX callback.">
  2350. mxmlSAXLoadFd</A></LI>
  2351. <LI><A href="#mxmlSAXLoadFile" title="Load a file into an XML node tree using a SAX callback.">
  2352. mxmlSAXLoadFile</A></LI>
  2353. <LI><A href="#mxmlSAXLoadString" title="Load a string into an XML node tree using a SAX callback.">
  2354. mxmlSAXLoadString</A></LI>
  2355. <LI><A href="#mxmlSaveAllocString" title="Save an XML tree to an allocated string.">
  2356. mxmlSaveAllocString</A></LI>
  2357. <LI><A href="#mxmlSaveFd" title="Save an XML tree to a file descriptor.">
  2358. mxmlSaveFd</A></LI>
  2359. <LI><A href="#mxmlSaveFile" title="Save an XML tree to a file.">
  2360. mxmlSaveFile</A></LI>
  2361. <LI><A href="#mxmlSaveString" title="Save an XML node tree to a string.">
  2362. mxmlSaveString</A></LI>
  2363. <LI><A href="#mxmlSetCDATA" title="Set the element name of a CDATA node.">
  2364. mxmlSetCDATA</A></LI>
  2365. <LI><A href="#mxmlSetCustom" title="Set the data and destructor of a custom data node.">
  2366. mxmlSetCustom</A></LI>
  2367. <LI><A href="#mxmlSetCustomHandlers" title="Set the handling functions for custom data.">
  2368. mxmlSetCustomHandlers</A></LI>
  2369. <LI><A href="#mxmlSetElement" title="Set the name of an element node.">
  2370. mxmlSetElement</A></LI>
  2371. <LI><A href="#mxmlSetErrorCallback" title="Set the error message callback.">
  2372. mxmlSetErrorCallback</A></LI>
  2373. <LI><A href="#mxmlSetInteger" title="Set the value of an integer node.">
  2374. mxmlSetInteger</A></LI>
  2375. <LI><A href="#mxmlSetOpaque" title="Set the value of an opaque node.">
  2376. mxmlSetOpaque</A></LI>
  2377. <LI><A href="#mxmlSetReal" title="Set the value of a real number node.">
  2378. mxmlSetReal</A></LI>
  2379. <LI><A href="#mxmlSetText" title="Set the value of a text node.">
  2380. mxmlSetText</A></LI>
  2381. <LI><A href="#mxmlSetTextf" title="Set the value of a text node to a formatted string.">
  2382. mxmlSetTextf</A></LI>
  2383. <LI><A href="#mxmlSetUserData" title="Set the user data pointer for a node.">
  2384. mxmlSetUserData</A></LI>
  2385. <LI><A href="#mxmlSetWrapMargin" title="Set the wrap margin when saving XML data.">
  2386. mxmlSetWrapMargin</A></LI>
  2387. <LI><A href="#mxmlWalkNext" title="Walk to the next logical node in the tree.">
  2388. mxmlWalkNext</A></LI>
  2389. <LI><A href="#mxmlWalkPrev" title="Walk to the previous logical node in the tree.">
  2390. mxmlWalkPrev</A></LI>
  2391. </UL>
  2392. </LI>
  2393. <LI><A href="#TYPES">Data Types</A>
  2394. <UL class="code">
  2395. <LI><A href="#mxml_custom_destroy_cb_t" title="Custom data destructor">
  2396. mxml_custom_destroy_cb_t</A></LI>
  2397. <LI><A href="#mxml_custom_load_cb_t" title="Custom data load callback function">
  2398. mxml_custom_load_cb_t</A></LI>
  2399. <LI><A href="#mxml_custom_save_cb_t" title="Custom data save callback function">
  2400. mxml_custom_save_cb_t</A></LI>
  2401. <LI><A href="#mxml_entity_cb_t" title="Entity callback function">
  2402. mxml_entity_cb_t</A></LI>
  2403. <LI><A href="#mxml_error_cb_t" title="Error callback function">
  2404. mxml_error_cb_t</A></LI>
  2405. <LI><A href="#mxml_index_t" title="An XML node index.">mxml_index_t</A></LI>
  2406. <LI><A href="#mxml_load_cb_t" title="Load callback function">
  2407. mxml_load_cb_t</A></LI>
  2408. <LI><A href="#mxml_node_t" title="An XML node.">mxml_node_t</A></LI>
  2409. <LI><A href="#mxml_save_cb_t" title="Save callback function">
  2410. mxml_save_cb_t</A></LI>
  2411. <LI><A href="#mxml_sax_cb_t" title="SAX callback function">mxml_sax_cb_t</A>
  2412. </LI>
  2413. <LI><A href="#mxml_sax_event_t" title="SAX event type.">mxml_sax_event_t</A>
  2414. </LI>
  2415. <LI><A href="#mxml_type_t" title="The XML node type.">mxml_type_t</A></LI>
  2416. </UL>
  2417. </LI>
  2418. <LI><A href="#ENUMERATIONS">Constants</A>
  2419. <UL class="code">
  2420. <LI><A href="#mxml_sax_event_e" title="SAX event type.">mxml_sax_event_e</A>
  2421. </LI>
  2422. <LI><A href="#mxml_type_e" title="The XML node type.">mxml_type_e</A></LI>
  2423. </UL>
  2424. </LI>
  2425. </UL>
  2426. <H2 class="title"><A name="FUNCTIONS">Functions</A></H2>
  2427. <H3 class="function"><A name="mxmlAdd">mxmlAdd</A></H3>
  2428. <P class="description">Add a node to a tree.</P>
  2429. <P class="code"> void mxmlAdd (
  2430. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *parent,
  2431. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int where,
  2432. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *child,
  2433. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2434. <BR> );</P>
  2435. <H4 class="parameters">Parameters</H4>
  2436. <DL>
  2437. <DT>parent</DT>
  2438. <DD class="description">Parent node</DD>
  2439. <DT>where</DT>
  2440. <DD class="description">Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER</DD>
  2441. <DT>child</DT>
  2442. <DD class="description">Child node for where or MXML_ADD_TO_PARENT</DD>
  2443. <DT>node</DT>
  2444. <DD class="description">Node to add</DD>
  2445. </DL>
  2446. <H4 class="discussion">Discussion</H4>
  2447. <P class="discussion">Adds the specified node to the parent. If the
  2448. child argument is not NULL, puts the new node before or after the
  2449. specified child depending on the value of the where argument. If the
  2450. child argument is NULL, puts the new node at the beginning of the child
  2451. list (MXML_ADD_BEFORE) or at the end of the child list
  2452. (MXML_ADD_AFTER). The constant MXML_ADD_TO_PARENT can be used to
  2453. specify a NULL child pointer.</P>
  2454. <H3 class="function"><A name="mxmlDelete">mxmlDelete</A></H3>
  2455. <P class="description">Delete a node and all of its children.</P>
  2456. <P class="code"> void mxmlDelete (
  2457. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2458. <BR> );</P>
  2459. <H4 class="parameters">Parameters</H4>
  2460. <DL>
  2461. <DT>node</DT>
  2462. <DD class="description">Node to delete</DD>
  2463. </DL>
  2464. <H4 class="discussion">Discussion</H4>
  2465. <P class="discussion">If the specified node has a parent, this function
  2466. first removes the node from its parent using the mxmlRemove() function.</P>
  2467. <H3 class="function"><A NAME="8_2_3">
  2468. <!--span class=&quot;info&quot;-->
  2469. &nbsp;Mini-XML 2.4&nbsp;<A name="mxmlElementDeleteAttr">mxmlElementDeleteAttr</A></A>
  2470. </H3>
  2471. <P class="description">Delete an attribute.</P>
  2472. <P class="code"> void mxmlElementDeleteAttr (
  2473. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  2474. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *name
  2475. <BR> );</P>
  2476. <H4 class="parameters">Parameters</H4>
  2477. <DL>
  2478. <DT>node</DT>
  2479. <DD class="description">Element</DD>
  2480. <DT>name</DT>
  2481. <DD class="description">Attribute name</DD>
  2482. </DL>
  2483. <H3 class="function"><A name="mxmlElementGetAttr">mxmlElementGetAttr</A></H3>
  2484. <P class="description">Get an attribute.</P>
  2485. <P class="code"> const char *mxmlElementGetAttr (
  2486. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  2487. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *name
  2488. <BR> );</P>
  2489. <H4 class="parameters">Parameters</H4>
  2490. <DL>
  2491. <DT>node</DT>
  2492. <DD class="description">Element node</DD>
  2493. <DT>name</DT>
  2494. <DD class="description">Name of attribute</DD>
  2495. </DL>
  2496. <H4 class="returnvalue">Return Value</H4>
  2497. <P class="description">Attribute value or NULL</P>
  2498. <H4 class="discussion">Discussion</H4>
  2499. <P class="discussion">This function returns NULL if the node is not an
  2500. element or the named attribute does not exist.</P>
  2501. <H3 class="function"><A name="mxmlElementSetAttr">mxmlElementSetAttr</A></H3>
  2502. <P class="description">Set an attribute.</P>
  2503. <P class="code"> void mxmlElementSetAttr (
  2504. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  2505. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *name,
  2506. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *value
  2507. <BR> );</P>
  2508. <H4 class="parameters">Parameters</H4>
  2509. <DL>
  2510. <DT>node</DT>
  2511. <DD class="description">Element node</DD>
  2512. <DT>name</DT>
  2513. <DD class="description">Name of attribute</DD>
  2514. <DT>value</DT>
  2515. <DD class="description">Attribute value</DD>
  2516. </DL>
  2517. <H4 class="discussion">Discussion</H4>
  2518. <P class="discussion">If the named attribute already exists, the value
  2519. of the attribute is replaced by the new string value. The string value
  2520. is copied into the element node. This function does nothing if the node
  2521. is not an element.</P>
  2522. <H3 class="function"><A NAME="8_2_6">
  2523. <!--span class=&quot;info&quot;-->
  2524. &nbsp;Mini-XML 2.3&nbsp;<A name="mxmlElementSetAttrf">mxmlElementSetAttrf</A></A></H3>
  2525. <P class="description">Set an attribute with a formatted value.</P>
  2526. <P class="code"> void mxmlElementSetAttrf (
  2527. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  2528. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *name,
  2529. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *format,
  2530. <BR> &nbsp;&nbsp;&nbsp;&nbsp;...
  2531. <BR> );</P>
  2532. <H4 class="parameters">Parameters</H4>
  2533. <DL>
  2534. <DT>node</DT>
  2535. <DD class="description">Element node</DD>
  2536. <DT>name</DT>
  2537. <DD class="description">Name of attribute</DD>
  2538. <DT>format</DT>
  2539. <DD class="description">Printf-style attribute value</DD>
  2540. <DT>...</DT>
  2541. <DD class="description">Additional arguments as needed</DD>
  2542. </DL>
  2543. <H4 class="discussion">Discussion</H4>
  2544. <P class="discussion">If the named attribute already exists, the value
  2545. of the attribute is replaced by the new formatted string. The formatted
  2546. string value is copied into the element node. This function does
  2547. nothing if the node is not an element.</P>
  2548. <H3 class="function"><A name="mxmlEntityAddCallback">
  2549. mxmlEntityAddCallback</A></H3>
  2550. <P class="description">Add a callback to convert entities to Unicode.</P>
  2551. <P class="code"> int mxmlEntityAddCallback (
  2552. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_entity_cb_t">mxml_entity_cb_t</A> cb
  2553. <BR> );</P>
  2554. <H4 class="parameters">Parameters</H4>
  2555. <DL>
  2556. <DT>cb</DT>
  2557. <DD class="description">Callback function to add</DD>
  2558. </DL>
  2559. <H4 class="returnvalue">Return Value</H4>
  2560. <P class="description">0 on success, -1 on failure</P>
  2561. <H3 class="function"><A name="mxmlEntityGetName">mxmlEntityGetName</A></H3>
  2562. <P class="description">Get the name that corresponds to the character
  2563. value.</P>
  2564. <P class="code"> const char *mxmlEntityGetName (
  2565. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int val
  2566. <BR> );</P>
  2567. <H4 class="parameters">Parameters</H4>
  2568. <DL>
  2569. <DT>val</DT>
  2570. <DD class="description">Character value</DD>
  2571. </DL>
  2572. <H4 class="returnvalue">Return Value</H4>
  2573. <P class="description">Entity name or NULL</P>
  2574. <H4 class="discussion">Discussion</H4>
  2575. <P class="discussion">If val does not need to be represented by a named
  2576. entity, NULL is returned.</P>
  2577. <H3 class="function"><A name="mxmlEntityGetValue">mxmlEntityGetValue</A></H3>
  2578. <P class="description">Get the character corresponding to a named
  2579. entity.</P>
  2580. <P class="code"> int mxmlEntityGetValue (
  2581. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *name
  2582. <BR> );</P>
  2583. <H4 class="parameters">Parameters</H4>
  2584. <DL>
  2585. <DT>name</DT>
  2586. <DD class="description">Entity name</DD>
  2587. </DL>
  2588. <H4 class="returnvalue">Return Value</H4>
  2589. <P class="description">Character value or -1 on error</P>
  2590. <H4 class="discussion">Discussion</H4>
  2591. <P class="discussion">The entity name can also be a numeric constant. -1
  2592. is returned if the name is not known.</P>
  2593. <H3 class="function"><A name="mxmlEntityRemoveCallback">
  2594. mxmlEntityRemoveCallback</A></H3>
  2595. <P class="description">Remove a callback.</P>
  2596. <P class="code"> void mxmlEntityRemoveCallback (
  2597. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_entity_cb_t">mxml_entity_cb_t</A> cb
  2598. <BR> );</P>
  2599. <H4 class="parameters">Parameters</H4>
  2600. <DL>
  2601. <DT>cb</DT>
  2602. <DD class="description">Callback function to remove</DD>
  2603. </DL>
  2604. <H3 class="function"><A name="mxmlFindElement">mxmlFindElement</A></H3>
  2605. <P class="description">Find the named element.</P>
  2606. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlFindElement
  2607. (
  2608. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  2609. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *top,
  2610. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *name,
  2611. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *attr,
  2612. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *value,
  2613. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int descend
  2614. <BR> );</P>
  2615. <H4 class="parameters">Parameters</H4>
  2616. <DL>
  2617. <DT>node</DT>
  2618. <DD class="description">Current node</DD>
  2619. <DT>top</DT>
  2620. <DD class="description">Top node</DD>
  2621. <DT>name</DT>
  2622. <DD class="description">Element name or NULL for any</DD>
  2623. <DT>attr</DT>
  2624. <DD class="description">Attribute name, or NULL for none</DD>
  2625. <DT>value</DT>
  2626. <DD class="description">Attribute value, or NULL for any</DD>
  2627. <DT>descend</DT>
  2628. <DD class="description">Descend into tree - MXML_DESCEND,
  2629. MXML_NO_DESCEND, or MXML_DESCEND_FIRST</DD>
  2630. </DL>
  2631. <H4 class="returnvalue">Return Value</H4>
  2632. <P class="description">Element node or NULL</P>
  2633. <H4 class="discussion">Discussion</H4>
  2634. <P class="discussion">The search is constrained by the name, attribute
  2635. name, and value; any NULL names or values are treated as wildcards, so
  2636. different kinds of searches can be implemented by looking for all
  2637. elements of a given name or all elements with a specific attribute. The
  2638. descend argument determines whether the search descends into child
  2639. nodes; normally you will use MXML_DESCEND_FIRST for the initial search
  2640. and MXML_NO_DESCEND to find additional direct descendents of the node.
  2641. The top node argument constrains the search to a particular node's
  2642. children.</P>
  2643. <H3 class="function"><A NAME="8_2_12">
  2644. <!--span class=&quot;info&quot;-->
  2645. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlFindPath">mxmlFindPath</A></A></H3>
  2646. <P class="description">Find a node with the given path.</P>
  2647. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlFindPath (
  2648. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *top,
  2649. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *path
  2650. <BR> );</P>
  2651. <H4 class="parameters">Parameters</H4>
  2652. <DL>
  2653. <DT>top</DT>
  2654. <DD class="description">Top node</DD>
  2655. <DT>path</DT>
  2656. <DD class="description">Path to element</DD>
  2657. </DL>
  2658. <H4 class="returnvalue">Return Value</H4>
  2659. <P class="description">Found node or NULL</P>
  2660. <H4 class="discussion">Discussion</H4>
  2661. <P class="discussion">The &quot;path&quot; is a slash-separated list of element
  2662. names. The name &quot;*&quot; is considered a wildcard for one or more levels of
  2663. elements. For example, &quot;foo/one/two&quot;, &quot;bar/two/one&quot;, &quot;*/one&quot;, and so
  2664. forth.
  2665. <BR>
  2666. <BR> The first child node of the found node is returned if the given
  2667. node has children and the first child is a value node.</P>
  2668. <H3 class="function"><A NAME="8_2_13">
  2669. <!--span class=&quot;info&quot;-->
  2670. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetCDATA">mxmlGetCDATA</A></A></H3>
  2671. <P class="description">Get the value for a CDATA node.</P>
  2672. <P class="code"> const char *mxmlGetCDATA (
  2673. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2674. <BR> );</P>
  2675. <H4 class="parameters">Parameters</H4>
  2676. <DL>
  2677. <DT>node</DT>
  2678. <DD class="description">Node to get</DD>
  2679. </DL>
  2680. <H4 class="returnvalue">Return Value</H4>
  2681. <P class="description">CDATA value or NULL</P>
  2682. <H4 class="discussion">Discussion</H4>
  2683. <P class="discussion"><CODE>NULL</CODE> is returned if the node is not a
  2684. CDATA element.</P>
  2685. <H3 class="function"><A NAME="8_2_14">
  2686. <!--span class=&quot;info&quot;-->
  2687. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetCustom">mxmlGetCustom</A></A></H3>
  2688. <P class="description">Get the value for a custom node.</P>
  2689. <P class="code"> const void *mxmlGetCustom (
  2690. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2691. <BR> );</P>
  2692. <H4 class="parameters">Parameters</H4>
  2693. <DL>
  2694. <DT>node</DT>
  2695. <DD class="description">Node to get</DD>
  2696. </DL>
  2697. <H4 class="returnvalue">Return Value</H4>
  2698. <P class="description">Custom value or NULL</P>
  2699. <H4 class="discussion">Discussion</H4>
  2700. <P class="discussion"><CODE>NULL</CODE> is returned if the node (or its
  2701. first child) is not a custom value node.</P>
  2702. <H3 class="function"><A NAME="8_2_15">
  2703. <!--span class=&quot;info&quot;-->
  2704. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetElement">mxmlGetElement</A></A></H3>
  2705. <P class="description">Get the name for an element node.</P>
  2706. <P class="code"> const char *mxmlGetElement (
  2707. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2708. <BR> );</P>
  2709. <H4 class="parameters">Parameters</H4>
  2710. <DL>
  2711. <DT>node</DT>
  2712. <DD class="description">Node to get</DD>
  2713. </DL>
  2714. <H4 class="returnvalue">Return Value</H4>
  2715. <P class="description">Element name or NULL</P>
  2716. <H4 class="discussion">Discussion</H4>
  2717. <P class="discussion"><CODE>NULL</CODE> is returned if the node is not
  2718. an element node.</P>
  2719. <H3 class="function"><A NAME="8_2_16">
  2720. <!--span class=&quot;info&quot;-->
  2721. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetFirstChild">mxmlGetFirstChild</A></A></H3>
  2722. <P class="description">Get the first child of an element node.</P>
  2723. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A>
  2724. *mxmlGetFirstChild (
  2725. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2726. <BR> );</P>
  2727. <H4 class="parameters">Parameters</H4>
  2728. <DL>
  2729. <DT>node</DT>
  2730. <DD class="description">Node to get</DD>
  2731. </DL>
  2732. <H4 class="returnvalue">Return Value</H4>
  2733. <P class="description">First child or NULL</P>
  2734. <H4 class="discussion">Discussion</H4>
  2735. <P class="discussion"><CODE>NULL</CODE> is returned if the node is not
  2736. an element node or if the node has no children.</P>
  2737. <H3 class="function"><A NAME="8_2_17">
  2738. <!--span class=&quot;info&quot;-->
  2739. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetInteger">mxmlGetInteger</A></A></H3>
  2740. <P class="description">Get the integer value from the specified node or
  2741. its first child.</P>
  2742. <P class="code"> int mxmlGetInteger (
  2743. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2744. <BR> );</P>
  2745. <H4 class="parameters">Parameters</H4>
  2746. <DL>
  2747. <DT>node</DT>
  2748. <DD class="description">Node to get</DD>
  2749. </DL>
  2750. <H4 class="returnvalue">Return Value</H4>
  2751. <P class="description">Integer value or 0</P>
  2752. <H4 class="discussion">Discussion</H4>
  2753. <P class="discussion">0 is returned if the node (or its first child) is
  2754. not an integer value node.</P>
  2755. <H3 class="function"><A NAME="8_2_18">
  2756. <!--span class=&quot;info&quot;-->
  2757. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetLastChild">mxmlGetLastChild</A></A></H3>
  2758. <P class="description">Get the last child of an element node.</P>
  2759. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A>
  2760. *mxmlGetLastChild (
  2761. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2762. <BR> );</P>
  2763. <H4 class="parameters">Parameters</H4>
  2764. <DL>
  2765. <DT>node</DT>
  2766. <DD class="description">Node to get</DD>
  2767. </DL>
  2768. <H4 class="returnvalue">Return Value</H4>
  2769. <P class="description">Last child or NULL</P>
  2770. <H4 class="discussion">Discussion</H4>
  2771. <P class="discussion"><CODE>NULL</CODE> is returned if the node is not
  2772. an element node or if the node has no children.</P>
  2773. <H3 class="function"><A name="mxmlGetNextSibling">mxmlGetNextSibling</A></H3>
  2774. <P class="description">Return the node type...</P>
  2775. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A>
  2776. *mxmlGetNextSibling (
  2777. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2778. <BR> );</P>
  2779. <H4 class="parameters">Parameters</H4>
  2780. <DL>
  2781. <DT>node</DT>
  2782. <DD class="description">Node to get</DD>
  2783. </DL>
  2784. <H4 class="returnvalue">Return Value</H4>
  2785. <P class="description">Get the next node for the current parent.</P>
  2786. <P class="discussion"><CODE>NULL</CODE> is returned if this is the last
  2787. child for the current parent.</P>
  2788. <H3 class="function"><A NAME="8_2_20">
  2789. <!--span class=&quot;info&quot;-->
  2790. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetOpaque">mxmlGetOpaque</A></A></H3>
  2791. <P class="description">Get an opaque string value for a node or its
  2792. first child.</P>
  2793. <P class="code"> const char *mxmlGetOpaque (
  2794. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2795. <BR> );</P>
  2796. <H4 class="parameters">Parameters</H4>
  2797. <DL>
  2798. <DT>node</DT>
  2799. <DD class="description">Node to get</DD>
  2800. </DL>
  2801. <H4 class="returnvalue">Return Value</H4>
  2802. <P class="description">Opaque string or NULL</P>
  2803. <H4 class="discussion">Discussion</H4>
  2804. <P class="discussion"><CODE>NULL</CODE> is returned if the node (or its
  2805. first child) is not an opaque value node.</P>
  2806. <H3 class="function"><A NAME="8_2_21">
  2807. <!--span class=&quot;info&quot;-->
  2808. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetParent">mxmlGetParent</A></A></H3>
  2809. <P class="description">Get the parent node.</P>
  2810. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlGetParent (
  2811. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2812. <BR> );</P>
  2813. <H4 class="parameters">Parameters</H4>
  2814. <DL>
  2815. <DT>node</DT>
  2816. <DD class="description">Node to get</DD>
  2817. </DL>
  2818. <H4 class="returnvalue">Return Value</H4>
  2819. <P class="description">Parent node or NULL</P>
  2820. <H4 class="discussion">Discussion</H4>
  2821. <P class="discussion"><CODE>NULL</CODE> is returned for a root node.</P>
  2822. <H3 class="function"><A NAME="8_2_22">
  2823. <!--span class=&quot;info&quot;-->
  2824. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetPrevSibling">mxmlGetPrevSibling</A></A></H3>
  2825. <P class="description">Get the previous node for the current parent.</P>
  2826. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A>
  2827. *mxmlGetPrevSibling (
  2828. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2829. <BR> );</P>
  2830. <H4 class="parameters">Parameters</H4>
  2831. <DL>
  2832. <DT>node</DT>
  2833. <DD class="description">Node to get</DD>
  2834. </DL>
  2835. <H4 class="returnvalue">Return Value</H4>
  2836. <P class="description">Previous node or NULL</P>
  2837. <H4 class="discussion">Discussion</H4>
  2838. <P class="discussion"><CODE>NULL</CODE> is returned if this is the first
  2839. child for the current parent.</P>
  2840. <H3 class="function"><A NAME="8_2_23">
  2841. <!--span class=&quot;info&quot;-->
  2842. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetReal">mxmlGetReal</A></A></H3>
  2843. <P class="description">Get the real value for a node or its first child.</P>
  2844. <P class="code"> double mxmlGetReal (
  2845. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2846. <BR> );</P>
  2847. <H4 class="parameters">Parameters</H4>
  2848. <DL>
  2849. <DT>node</DT>
  2850. <DD class="description">Node to get</DD>
  2851. </DL>
  2852. <H4 class="returnvalue">Return Value</H4>
  2853. <P class="description">Real value or 0.0</P>
  2854. <H4 class="discussion">Discussion</H4>
  2855. <P class="discussion">0.0 is returned if the node (or its first child)
  2856. is not a real value node.</P>
  2857. <H3 class="function"><A NAME="8_2_24">
  2858. <!--span class=&quot;info&quot;-->
  2859. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetRefCount">mxmlGetRefCount</A></A></H3>
  2860. <P class="description">Get the current reference (use) count for a node.</P>
  2861. <P class="code"> int mxmlGetRefCount (
  2862. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2863. <BR> );</P>
  2864. <H4 class="parameters">Parameters</H4>
  2865. <DL>
  2866. <DT>node</DT>
  2867. <DD class="description">Node</DD>
  2868. </DL>
  2869. <H4 class="returnvalue">Return Value</H4>
  2870. <P class="description">Reference count</P>
  2871. <H4 class="discussion">Discussion</H4>
  2872. <P class="discussion">The initial reference count of new nodes is 1. Use
  2873. the <A href="#mxmlRetain"><CODE>mxmlRetain</CODE></A> and <A href="#mxmlRelease">
  2874. <CODE>mxmlRelease</CODE></A> functions to increment and decrement a
  2875. node's reference count. .</P>
  2876. <H3 class="function"><A NAME="8_2_25">
  2877. <!--span class=&quot;info&quot;-->
  2878. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetText">mxmlGetText</A></A></H3>
  2879. <P class="description">Get the text value for a node or its first child.</P>
  2880. <P class="code"> const char *mxmlGetText (
  2881. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  2882. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int *whitespace
  2883. <BR> );</P>
  2884. <H4 class="parameters">Parameters</H4>
  2885. <DL>
  2886. <DT>node</DT>
  2887. <DD class="description">Node to get</DD>
  2888. <DT>whitespace</DT>
  2889. <DD class="description">1 if string is preceded by whitespace, 0
  2890. otherwise</DD>
  2891. </DL>
  2892. <H4 class="returnvalue">Return Value</H4>
  2893. <P class="description">Text string or NULL</P>
  2894. <H4 class="discussion">Discussion</H4>
  2895. <P class="discussion"><CODE>NULL</CODE> is returned if the node (or its
  2896. first child) is not a text node. The &quot;whitespace&quot; argument can be NULL.</P>
  2897. <H3 class="function"><A NAME="8_2_26">
  2898. <!--span class=&quot;info&quot;-->
  2899. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetType">mxmlGetType</A></A></H3>
  2900. <P class="description">Get the node type.</P>
  2901. <P class="code"> <A href="#mxml_type_t">mxml_type_t</A> mxmlGetType (
  2902. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2903. <BR> );</P>
  2904. <H4 class="parameters">Parameters</H4>
  2905. <DL>
  2906. <DT>node</DT>
  2907. <DD class="description">Node to get</DD>
  2908. </DL>
  2909. <H4 class="returnvalue">Return Value</H4>
  2910. <P class="description">Type of node</P>
  2911. <H4 class="discussion">Discussion</H4>
  2912. <P class="discussion"><CODE>MXML_IGNORE</CODE> is returned if &quot;node&quot; is <CODE>
  2913. NULL</CODE>.</P>
  2914. <H3 class="function"><A NAME="8_2_27">
  2915. <!--span class=&quot;info&quot;-->
  2916. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlGetUserData">mxmlGetUserData</A></A></H3>
  2917. <P class="description">Get the user data pointer for a node.</P>
  2918. <P class="code"> void *mxmlGetUserData (
  2919. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  2920. <BR> );</P>
  2921. <H4 class="parameters">Parameters</H4>
  2922. <DL>
  2923. <DT>node</DT>
  2924. <DD class="description">Node to get</DD>
  2925. </DL>
  2926. <H4 class="returnvalue">Return Value</H4>
  2927. <P class="description">User data pointer</P>
  2928. <H3 class="function"><A name="mxmlIndexDelete">mxmlIndexDelete</A></H3>
  2929. <P class="description">Delete an index.</P>
  2930. <P class="code"> void mxmlIndexDelete (
  2931. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_index_t">mxml_index_t</A> *ind
  2932. <BR> );</P>
  2933. <H4 class="parameters">Parameters</H4>
  2934. <DL>
  2935. <DT>ind</DT>
  2936. <DD class="description">Index to delete</DD>
  2937. </DL>
  2938. <H3 class="function"><A name="mxmlIndexEnum">mxmlIndexEnum</A></H3>
  2939. <P class="description">Return the next node in the index.</P>
  2940. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlIndexEnum (
  2941. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_index_t">mxml_index_t</A> *ind
  2942. <BR> );</P>
  2943. <H4 class="parameters">Parameters</H4>
  2944. <DL>
  2945. <DT>ind</DT>
  2946. <DD class="description">Index to enumerate</DD>
  2947. </DL>
  2948. <H4 class="returnvalue">Return Value</H4>
  2949. <P class="description">Next node or NULL if there is none</P>
  2950. <H4 class="discussion">Discussion</H4>
  2951. <P class="discussion">Nodes are returned in the sorted order of the
  2952. index.</P>
  2953. <H3 class="function"><A name="mxmlIndexFind">mxmlIndexFind</A></H3>
  2954. <P class="description">Find the next matching node.</P>
  2955. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlIndexFind (
  2956. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_index_t">mxml_index_t</A> *ind,
  2957. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *element,
  2958. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *value
  2959. <BR> );</P>
  2960. <H4 class="parameters">Parameters</H4>
  2961. <DL>
  2962. <DT>ind</DT>
  2963. <DD class="description">Index to search</DD>
  2964. <DT>element</DT>
  2965. <DD class="description">Element name to find, if any</DD>
  2966. <DT>value</DT>
  2967. <DD class="description">Attribute value, if any</DD>
  2968. </DL>
  2969. <H4 class="returnvalue">Return Value</H4>
  2970. <P class="description">Node or NULL if none found</P>
  2971. <H4 class="discussion">Discussion</H4>
  2972. <P class="discussion">You should call mxmlIndexReset() prior to using
  2973. this function for the first time with a particular set of &quot;element&quot; and
  2974. &quot;value&quot; strings. Passing NULL for both &quot;element&quot; and &quot;value&quot; is
  2975. equivalent to calling mxmlIndexEnum().</P>
  2976. <H3 class="function"><A NAME="8_2_31">
  2977. <!--span class=&quot;info&quot;-->
  2978. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlIndexGetCount">mxmlIndexGetCount</A></A></H3>
  2979. <P class="description">Get the number of nodes in an index.</P>
  2980. <P class="code"> int mxmlIndexGetCount (
  2981. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_index_t">mxml_index_t</A> *ind
  2982. <BR> );</P>
  2983. <H4 class="parameters">Parameters</H4>
  2984. <DL>
  2985. <DT>ind</DT>
  2986. <DD class="description">Index of nodes</DD>
  2987. </DL>
  2988. <H4 class="returnvalue">Return Value</H4>
  2989. <P class="description">Number of nodes in index</P>
  2990. <H3 class="function"><A name="mxmlIndexNew">mxmlIndexNew</A></H3>
  2991. <P class="description">Create a new index.</P>
  2992. <P class="code"> <A href="#mxml_index_t">mxml_index_t</A> *mxmlIndexNew
  2993. (
  2994. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  2995. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *element,
  2996. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *attr
  2997. <BR> );</P>
  2998. <H4 class="parameters">Parameters</H4>
  2999. <DL>
  3000. <DT>node</DT>
  3001. <DD class="description">XML node tree</DD>
  3002. <DT>element</DT>
  3003. <DD class="description">Element to index or NULL for all</DD>
  3004. <DT>attr</DT>
  3005. <DD class="description">Attribute to index or NULL for none</DD>
  3006. </DL>
  3007. <H4 class="returnvalue">Return Value</H4>
  3008. <P class="description">New index</P>
  3009. <H4 class="discussion">Discussion</H4>
  3010. <P class="discussion">The index will contain all nodes that contain the
  3011. named element and/or attribute. If both &quot;element&quot; and &quot;attr&quot; are NULL,
  3012. then the index will contain a sorted list of the elements in the node
  3013. tree. Nodes are sorted by element name and optionally by attribute
  3014. value if the &quot;attr&quot; argument is not NULL.</P>
  3015. <H3 class="function"><A name="mxmlIndexReset">mxmlIndexReset</A></H3>
  3016. <P class="description">Reset the enumeration/find pointer in the index
  3017. and return the first node in the index.</P>
  3018. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlIndexReset
  3019. (
  3020. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_index_t">mxml_index_t</A> *ind
  3021. <BR> );</P>
  3022. <H4 class="parameters">Parameters</H4>
  3023. <DL>
  3024. <DT>ind</DT>
  3025. <DD class="description">Index to reset</DD>
  3026. </DL>
  3027. <H4 class="returnvalue">Return Value</H4>
  3028. <P class="description">First node or NULL if there is none</P>
  3029. <H4 class="discussion">Discussion</H4>
  3030. <P class="discussion">This function should be called prior to using
  3031. mxmlIndexEnum() or mxmlIndexFind() for the first time.</P>
  3032. <H3 class="function"><A name="mxmlLoadFd">mxmlLoadFd</A></H3>
  3033. <P class="description">Load a file descriptor into an XML node tree.</P>
  3034. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlLoadFd (
  3035. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *top,
  3036. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int fd,
  3037. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_load_cb_t">mxml_load_cb_t</A> cb
  3038. <BR> );</P>
  3039. <H4 class="parameters">Parameters</H4>
  3040. <DL>
  3041. <DT>top</DT>
  3042. <DD class="description">Top node</DD>
  3043. <DT>fd</DT>
  3044. <DD class="description">File descriptor to read from</DD>
  3045. <DT>cb</DT>
  3046. <DD class="description">Callback function or MXML_NO_CALLBACK</DD>
  3047. </DL>
  3048. <H4 class="returnvalue">Return Value</H4>
  3049. <P class="description">First node or NULL if the file could not be read.</P>
  3050. <H4 class="discussion">Discussion</H4>
  3051. <P class="discussion">The nodes in the specified file are added to the
  3052. specified top node. If no top node is provided, the XML file MUST be
  3053. well-formed with a single parent node like &lt;?xml&gt; for the entire file.
  3054. The callback function returns the value type that should be used for
  3055. child nodes. If MXML_NO_CALLBACK is specified then all child nodes will
  3056. be either MXML_ELEMENT or MXML_TEXT nodes.
  3057. <BR>
  3058. <BR> The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
  3059. MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
  3060. child nodes of the specified type.</P>
  3061. <H3 class="function"><A name="mxmlLoadFile">mxmlLoadFile</A></H3>
  3062. <P class="description">Load a file into an XML node tree.</P>
  3063. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlLoadFile (
  3064. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *top,
  3065. <BR> &nbsp;&nbsp;&nbsp;&nbsp;FILE *fp,
  3066. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_load_cb_t">mxml_load_cb_t</A> cb
  3067. <BR> );</P>
  3068. <H4 class="parameters">Parameters</H4>
  3069. <DL>
  3070. <DT>top</DT>
  3071. <DD class="description">Top node</DD>
  3072. <DT>fp</DT>
  3073. <DD class="description">File to read from</DD>
  3074. <DT>cb</DT>
  3075. <DD class="description">Callback function or MXML_NO_CALLBACK</DD>
  3076. </DL>
  3077. <H4 class="returnvalue">Return Value</H4>
  3078. <P class="description">First node or NULL if the file could not be read.</P>
  3079. <H4 class="discussion">Discussion</H4>
  3080. <P class="discussion">The nodes in the specified file are added to the
  3081. specified top node. If no top node is provided, the XML file MUST be
  3082. well-formed with a single parent node like &lt;?xml&gt; for the entire file.
  3083. The callback function returns the value type that should be used for
  3084. child nodes. If MXML_NO_CALLBACK is specified then all child nodes will
  3085. be either MXML_ELEMENT or MXML_TEXT nodes.
  3086. <BR>
  3087. <BR> The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
  3088. MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
  3089. child nodes of the specified type.</P>
  3090. <H3 class="function"><A name="mxmlLoadString">mxmlLoadString</A></H3>
  3091. <P class="description">Load a string into an XML node tree.</P>
  3092. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlLoadString
  3093. (
  3094. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *top,
  3095. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *s,
  3096. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_load_cb_t">mxml_load_cb_t</A> cb
  3097. <BR> );</P>
  3098. <H4 class="parameters">Parameters</H4>
  3099. <DL>
  3100. <DT>top</DT>
  3101. <DD class="description">Top node</DD>
  3102. <DT>s</DT>
  3103. <DD class="description">String to load</DD>
  3104. <DT>cb</DT>
  3105. <DD class="description">Callback function or MXML_NO_CALLBACK</DD>
  3106. </DL>
  3107. <H4 class="returnvalue">Return Value</H4>
  3108. <P class="description">First node or NULL if the string has errors.</P>
  3109. <H4 class="discussion">Discussion</H4>
  3110. <P class="discussion">The nodes in the specified string are added to the
  3111. specified top node. If no top node is provided, the XML string MUST be
  3112. well-formed with a single parent node like &lt;?xml&gt; for the entire
  3113. string. The callback function returns the value type that should be
  3114. used for child nodes. If MXML_NO_CALLBACK is specified then all child
  3115. nodes will be either MXML_ELEMENT or MXML_TEXT nodes.
  3116. <BR>
  3117. <BR> The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
  3118. MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
  3119. child nodes of the specified type.</P>
  3120. <H3 class="function"><A NAME="8_2_37">
  3121. <!--span class=&quot;info&quot;-->
  3122. &nbsp;Mini-XML 2.3&nbsp;<A name="mxmlNewCDATA">mxmlNewCDATA</A></A></H3>
  3123. <P class="description">Create a new CDATA node.</P>
  3124. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlNewCDATA (
  3125. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *parent,
  3126. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *data
  3127. <BR> );</P>
  3128. <H4 class="parameters">Parameters</H4>
  3129. <DL>
  3130. <DT>parent</DT>
  3131. <DD class="description">Parent node or MXML_NO_PARENT</DD>
  3132. <DT>data</DT>
  3133. <DD class="description">Data string</DD>
  3134. </DL>
  3135. <H4 class="returnvalue">Return Value</H4>
  3136. <P class="description">New node</P>
  3137. <H4 class="discussion">Discussion</H4>
  3138. <P class="discussion">The new CDATA node is added to the end of the
  3139. specified parent's child list. The constant MXML_NO_PARENT can be used
  3140. to specify that the new CDATA node has no parent. The data string must
  3141. be nul-terminated and is copied into the new node. CDATA nodes use the
  3142. MXML_ELEMENT type.</P>
  3143. <H3 class="function"><A NAME="8_2_38">
  3144. <!--span class=&quot;info&quot;-->
  3145. &nbsp;Mini-XML 2.1&nbsp;<A name="mxmlNewCustom">mxmlNewCustom</A></A></H3>
  3146. <P class="description">Create a new custom data node.</P>
  3147. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlNewCustom (
  3148. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *parent,
  3149. <BR> &nbsp;&nbsp;&nbsp;&nbsp;void *data,
  3150. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</A>
  3151. destroy
  3152. <BR> );</P>
  3153. <H4 class="parameters">Parameters</H4>
  3154. <DL>
  3155. <DT>parent</DT>
  3156. <DD class="description">Parent node or MXML_NO_PARENT</DD>
  3157. <DT>data</DT>
  3158. <DD class="description">Pointer to data</DD>
  3159. <DT>destroy</DT>
  3160. <DD class="description">Function to destroy data</DD>
  3161. </DL>
  3162. <H4 class="returnvalue">Return Value</H4>
  3163. <P class="description">New node</P>
  3164. <H4 class="discussion">Discussion</H4>
  3165. <P class="discussion">The new custom node is added to the end of the
  3166. specified parent's child list. The constant MXML_NO_PARENT can be used
  3167. to specify that the new element node has no parent. NULL can be passed
  3168. when the data in the node is not dynamically allocated or is separately
  3169. managed.</P>
  3170. <H3 class="function"><A name="mxmlNewElement">mxmlNewElement</A></H3>
  3171. <P class="description">Create a new element node.</P>
  3172. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlNewElement
  3173. (
  3174. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *parent,
  3175. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *name
  3176. <BR> );</P>
  3177. <H4 class="parameters">Parameters</H4>
  3178. <DL>
  3179. <DT>parent</DT>
  3180. <DD class="description">Parent node or MXML_NO_PARENT</DD>
  3181. <DT>name</DT>
  3182. <DD class="description">Name of element</DD>
  3183. </DL>
  3184. <H4 class="returnvalue">Return Value</H4>
  3185. <P class="description">New node</P>
  3186. <H4 class="discussion">Discussion</H4>
  3187. <P class="discussion">The new element node is added to the end of the
  3188. specified parent's child list. The constant MXML_NO_PARENT can be used
  3189. to specify that the new element node has no parent.</P>
  3190. <H3 class="function"><A name="mxmlNewInteger">mxmlNewInteger</A></H3>
  3191. <P class="description">Create a new integer node.</P>
  3192. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlNewInteger
  3193. (
  3194. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *parent,
  3195. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int integer
  3196. <BR> );</P>
  3197. <H4 class="parameters">Parameters</H4>
  3198. <DL>
  3199. <DT>parent</DT>
  3200. <DD class="description">Parent node or MXML_NO_PARENT</DD>
  3201. <DT>integer</DT>
  3202. <DD class="description">Integer value</DD>
  3203. </DL>
  3204. <H4 class="returnvalue">Return Value</H4>
  3205. <P class="description">New node</P>
  3206. <H4 class="discussion">Discussion</H4>
  3207. <P class="discussion">The new integer node is added to the end of the
  3208. specified parent's child list. The constant MXML_NO_PARENT can be used
  3209. to specify that the new integer node has no parent.</P>
  3210. <H3 class="function"><A name="mxmlNewOpaque">mxmlNewOpaque</A></H3>
  3211. <P class="description">Create a new opaque string.</P>
  3212. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlNewOpaque (
  3213. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *parent,
  3214. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *opaque
  3215. <BR> );</P>
  3216. <H4 class="parameters">Parameters</H4>
  3217. <DL>
  3218. <DT>parent</DT>
  3219. <DD class="description">Parent node or MXML_NO_PARENT</DD>
  3220. <DT>opaque</DT>
  3221. <DD class="description">Opaque string</DD>
  3222. </DL>
  3223. <H4 class="returnvalue">Return Value</H4>
  3224. <P class="description">New node</P>
  3225. <H4 class="discussion">Discussion</H4>
  3226. <P class="discussion">The new opaque node is added to the end of the
  3227. specified parent's child list. The constant MXML_NO_PARENT can be used
  3228. to specify that the new opaque node has no parent. The opaque string
  3229. must be nul-terminated and is copied into the new node.</P>
  3230. <H3 class="function"><A name="mxmlNewReal">mxmlNewReal</A></H3>
  3231. <P class="description">Create a new real number node.</P>
  3232. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlNewReal (
  3233. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *parent,
  3234. <BR> &nbsp;&nbsp;&nbsp;&nbsp;double real
  3235. <BR> );</P>
  3236. <H4 class="parameters">Parameters</H4>
  3237. <DL>
  3238. <DT>parent</DT>
  3239. <DD class="description">Parent node or MXML_NO_PARENT</DD>
  3240. <DT>real</DT>
  3241. <DD class="description">Real number value</DD>
  3242. </DL>
  3243. <H4 class="returnvalue">Return Value</H4>
  3244. <P class="description">New node</P>
  3245. <H4 class="discussion">Discussion</H4>
  3246. <P class="discussion">The new real number node is added to the end of
  3247. the specified parent's child list. The constant MXML_NO_PARENT can be
  3248. used to specify that the new real number node has no parent.</P>
  3249. <H3 class="function"><A name="mxmlNewText">mxmlNewText</A></H3>
  3250. <P class="description">Create a new text fragment node.</P>
  3251. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlNewText (
  3252. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *parent,
  3253. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int whitespace,
  3254. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *string
  3255. <BR> );</P>
  3256. <H4 class="parameters">Parameters</H4>
  3257. <DL>
  3258. <DT>parent</DT>
  3259. <DD class="description">Parent node or MXML_NO_PARENT</DD>
  3260. <DT>whitespace</DT>
  3261. <DD class="description">1 = leading whitespace, 0 = no whitespace</DD>
  3262. <DT>string</DT>
  3263. <DD class="description">String</DD>
  3264. </DL>
  3265. <H4 class="returnvalue">Return Value</H4>
  3266. <P class="description">New node</P>
  3267. <H4 class="discussion">Discussion</H4>
  3268. <P class="discussion">The new text node is added to the end of the
  3269. specified parent's child list. The constant MXML_NO_PARENT can be used
  3270. to specify that the new text node has no parent. The whitespace
  3271. parameter is used to specify whether leading whitespace is present
  3272. before the node. The text string must be nul-terminated and is copied
  3273. into the new node.</P>
  3274. <H3 class="function"><A name="mxmlNewTextf">mxmlNewTextf</A></H3>
  3275. <P class="description">Create a new formatted text fragment node.</P>
  3276. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlNewTextf (
  3277. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *parent,
  3278. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int whitespace,
  3279. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *format,
  3280. <BR> &nbsp;&nbsp;&nbsp;&nbsp;...
  3281. <BR> );</P>
  3282. <H4 class="parameters">Parameters</H4>
  3283. <DL>
  3284. <DT>parent</DT>
  3285. <DD class="description">Parent node or MXML_NO_PARENT</DD>
  3286. <DT>whitespace</DT>
  3287. <DD class="description">1 = leading whitespace, 0 = no whitespace</DD>
  3288. <DT>format</DT>
  3289. <DD class="description">Printf-style frmat string</DD>
  3290. <DT>...</DT>
  3291. <DD class="description">Additional args as needed</DD>
  3292. </DL>
  3293. <H4 class="returnvalue">Return Value</H4>
  3294. <P class="description">New node</P>
  3295. <H4 class="discussion">Discussion</H4>
  3296. <P class="discussion">The new text node is added to the end of the
  3297. specified parent's child list. The constant MXML_NO_PARENT can be used
  3298. to specify that the new text node has no parent. The whitespace
  3299. parameter is used to specify whether leading whitespace is present
  3300. before the node. The format string must be nul-terminated and is
  3301. formatted into the new node.</P>
  3302. <H3 class="function"><A NAME="8_2_45">
  3303. <!--span class=&quot;info&quot;-->
  3304. &nbsp;Mini-XML 2.3&nbsp;<A name="mxmlNewXML">mxmlNewXML</A></A></H3>
  3305. <P class="description">Create a new XML document tree.</P>
  3306. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlNewXML (
  3307. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *version
  3308. <BR> );</P>
  3309. <H4 class="parameters">Parameters</H4>
  3310. <DL>
  3311. <DT>version</DT>
  3312. <DD class="description">Version number to use</DD>
  3313. </DL>
  3314. <H4 class="returnvalue">Return Value</H4>
  3315. <P class="description">New ?xml node</P>
  3316. <H4 class="discussion">Discussion</H4>
  3317. <P class="discussion">The &quot;version&quot; argument specifies the version
  3318. number to put in the ?xml element node. If NULL, version 1.0 is
  3319. assumed.</P>
  3320. <H3 class="function"><A NAME="8_2_46">
  3321. <!--span class=&quot;info&quot;-->
  3322. &nbsp;Mini-XML 2.3&nbsp;<A name="mxmlRelease">mxmlRelease</A></A></H3>
  3323. <P class="description">Release a node.</P>
  3324. <P class="code"> int mxmlRelease (
  3325. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  3326. <BR> );</P>
  3327. <H4 class="parameters">Parameters</H4>
  3328. <DL>
  3329. <DT>node</DT>
  3330. <DD class="description">Node</DD>
  3331. </DL>
  3332. <H4 class="returnvalue">Return Value</H4>
  3333. <P class="description">New reference count</P>
  3334. <H4 class="discussion">Discussion</H4>
  3335. <P class="discussion">When the reference count reaches zero, the node
  3336. (and any children) is deleted via mxmlDelete().</P>
  3337. <H3 class="function"><A name="mxmlRemove">mxmlRemove</A></H3>
  3338. <P class="description">Remove a node from its parent.</P>
  3339. <P class="code"> void mxmlRemove (
  3340. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  3341. <BR> );</P>
  3342. <H4 class="parameters">Parameters</H4>
  3343. <DL>
  3344. <DT>node</DT>
  3345. <DD class="description">Node to remove</DD>
  3346. </DL>
  3347. <H4 class="discussion">Discussion</H4>
  3348. <P class="discussion">Does not free memory used by the node - use
  3349. mxmlDelete() for that. This function does nothing if the node has no
  3350. parent.</P>
  3351. <H3 class="function"><A NAME="8_2_48">
  3352. <!--span class=&quot;info&quot;-->
  3353. &nbsp;Mini-XML 2.3&nbsp;<A name="mxmlRetain">mxmlRetain</A></A></H3>
  3354. <P class="description">Retain a node.</P>
  3355. <P class="code"> int mxmlRetain (
  3356. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node
  3357. <BR> );</P>
  3358. <H4 class="parameters">Parameters</H4>
  3359. <DL>
  3360. <DT>node</DT>
  3361. <DD class="description">Node</DD>
  3362. </DL>
  3363. <H4 class="returnvalue">Return Value</H4>
  3364. <P class="description">New reference count</P>
  3365. <H3 class="function"><A NAME="8_2_49">
  3366. <!--span class=&quot;info&quot;-->
  3367. &nbsp;Mini-XML 2.3&nbsp;<A name="mxmlSAXLoadFd">mxmlSAXLoadFd</A></A></H3>
  3368. <P class="description">Load a file descriptor into an XML node tree
  3369. using a SAX callback.</P>
  3370. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlSAXLoadFd (
  3371. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *top,
  3372. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int fd,
  3373. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_load_cb_t">mxml_load_cb_t</A> cb,
  3374. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_sax_cb_t">mxml_sax_cb_t</A> sax_cb,
  3375. <BR> &nbsp;&nbsp;&nbsp;&nbsp;void *sax_data
  3376. <BR> );</P>
  3377. <H4 class="parameters">Parameters</H4>
  3378. <DL>
  3379. <DT>top</DT>
  3380. <DD class="description">Top node</DD>
  3381. <DT>fd</DT>
  3382. <DD class="description">File descriptor to read from</DD>
  3383. <DT>cb</DT>
  3384. <DD class="description">Callback function or MXML_NO_CALLBACK</DD>
  3385. <DT>sax_cb</DT>
  3386. <DD class="description">SAX callback or MXML_NO_CALLBACK</DD>
  3387. <DT>sax_data</DT>
  3388. <DD class="description">SAX user data</DD>
  3389. </DL>
  3390. <H4 class="returnvalue">Return Value</H4>
  3391. <P class="description">First node or NULL if the file could not be read.</P>
  3392. <H4 class="discussion">Discussion</H4>
  3393. <P class="discussion">The nodes in the specified file are added to the
  3394. specified top node. If no top node is provided, the XML file MUST be
  3395. well-formed with a single parent node like &lt;?xml&gt; for the entire file.
  3396. The callback function returns the value type that should be used for
  3397. child nodes. If MXML_NO_CALLBACK is specified then all child nodes will
  3398. be either MXML_ELEMENT or MXML_TEXT nodes.
  3399. <BR>
  3400. <BR> The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
  3401. MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
  3402. child nodes of the specified type.
  3403. <BR>
  3404. <BR> The SAX callback must call mxmlRetain() for any nodes that need to
  3405. be kept for later use. Otherwise, nodes are deleted when the parent
  3406. node is closed or after each data, comment, CDATA, or directive node.</P>
  3407. <H3 class="function"><A NAME="8_2_50">
  3408. <!--span class=&quot;info&quot;-->
  3409. &nbsp;Mini-XML 2.3&nbsp;<A name="mxmlSAXLoadFile">mxmlSAXLoadFile</A></A></H3>
  3410. <P class="description">Load a file into an XML node tree using a SAX
  3411. callback.</P>
  3412. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlSAXLoadFile
  3413. (
  3414. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *top,
  3415. <BR> &nbsp;&nbsp;&nbsp;&nbsp;FILE *fp,
  3416. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_load_cb_t">mxml_load_cb_t</A> cb,
  3417. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_sax_cb_t">mxml_sax_cb_t</A> sax_cb,
  3418. <BR> &nbsp;&nbsp;&nbsp;&nbsp;void *sax_data
  3419. <BR> );</P>
  3420. <H4 class="parameters">Parameters</H4>
  3421. <DL>
  3422. <DT>top</DT>
  3423. <DD class="description">Top node</DD>
  3424. <DT>fp</DT>
  3425. <DD class="description">File to read from</DD>
  3426. <DT>cb</DT>
  3427. <DD class="description">Callback function or MXML_NO_CALLBACK</DD>
  3428. <DT>sax_cb</DT>
  3429. <DD class="description">SAX callback or MXML_NO_CALLBACK</DD>
  3430. <DT>sax_data</DT>
  3431. <DD class="description">SAX user data</DD>
  3432. </DL>
  3433. <H4 class="returnvalue">Return Value</H4>
  3434. <P class="description">First node or NULL if the file could not be read.</P>
  3435. <H4 class="discussion">Discussion</H4>
  3436. <P class="discussion">The nodes in the specified file are added to the
  3437. specified top node. If no top node is provided, the XML file MUST be
  3438. well-formed with a single parent node like &lt;?xml&gt; for the entire file.
  3439. The callback function returns the value type that should be used for
  3440. child nodes. If MXML_NO_CALLBACK is specified then all child nodes will
  3441. be either MXML_ELEMENT or MXML_TEXT nodes.
  3442. <BR>
  3443. <BR> The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
  3444. MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
  3445. child nodes of the specified type.
  3446. <BR>
  3447. <BR> The SAX callback must call mxmlRetain() for any nodes that need to
  3448. be kept for later use. Otherwise, nodes are deleted when the parent
  3449. node is closed or after each data, comment, CDATA, or directive node.</P>
  3450. <H3 class="function"><A NAME="8_2_51">
  3451. <!--span class=&quot;info&quot;-->
  3452. &nbsp;Mini-XML 2.3&nbsp;<A name="mxmlSAXLoadString">mxmlSAXLoadString</A></A></H3>
  3453. <P class="description">Load a string into an XML node tree using a SAX
  3454. callback.</P>
  3455. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A>
  3456. *mxmlSAXLoadString (
  3457. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *top,
  3458. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *s,
  3459. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_load_cb_t">mxml_load_cb_t</A> cb,
  3460. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_sax_cb_t">mxml_sax_cb_t</A> sax_cb,
  3461. <BR> &nbsp;&nbsp;&nbsp;&nbsp;void *sax_data
  3462. <BR> );</P>
  3463. <H4 class="parameters">Parameters</H4>
  3464. <DL>
  3465. <DT>top</DT>
  3466. <DD class="description">Top node</DD>
  3467. <DT>s</DT>
  3468. <DD class="description">String to load</DD>
  3469. <DT>cb</DT>
  3470. <DD class="description">Callback function or MXML_NO_CALLBACK</DD>
  3471. <DT>sax_cb</DT>
  3472. <DD class="description">SAX callback or MXML_NO_CALLBACK</DD>
  3473. <DT>sax_data</DT>
  3474. <DD class="description">SAX user data</DD>
  3475. </DL>
  3476. <H4 class="returnvalue">Return Value</H4>
  3477. <P class="description">First node or NULL if the string has errors.</P>
  3478. <H4 class="discussion">Discussion</H4>
  3479. <P class="discussion">The nodes in the specified string are added to the
  3480. specified top node. If no top node is provided, the XML string MUST be
  3481. well-formed with a single parent node like &lt;?xml&gt; for the entire
  3482. string. The callback function returns the value type that should be
  3483. used for child nodes. If MXML_NO_CALLBACK is specified then all child
  3484. nodes will be either MXML_ELEMENT or MXML_TEXT nodes.
  3485. <BR>
  3486. <BR> The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK,
  3487. MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading
  3488. child nodes of the specified type.
  3489. <BR>
  3490. <BR> The SAX callback must call mxmlRetain() for any nodes that need to
  3491. be kept for later use. Otherwise, nodes are deleted when the parent
  3492. node is closed or after each data, comment, CDATA, or directive node.</P>
  3493. <H3 class="function"><A name="mxmlSaveAllocString">mxmlSaveAllocString</A>
  3494. </H3>
  3495. <P class="description">Save an XML tree to an allocated string.</P>
  3496. <P class="code"> char *mxmlSaveAllocString (
  3497. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3498. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_save_cb_t">mxml_save_cb_t</A> cb
  3499. <BR> );</P>
  3500. <H4 class="parameters">Parameters</H4>
  3501. <DL>
  3502. <DT>node</DT>
  3503. <DD class="description">Node to write</DD>
  3504. <DT>cb</DT>
  3505. <DD class="description">Whitespace callback or MXML_NO_CALLBACK</DD>
  3506. </DL>
  3507. <H4 class="returnvalue">Return Value</H4>
  3508. <P class="description">Allocated string or NULL</P>
  3509. <H4 class="discussion">Discussion</H4>
  3510. <P class="discussion">This function returns a pointer to a string
  3511. containing the textual representation of the XML node tree. The string
  3512. should be freed using the free() function when you are done with it.
  3513. NULL is returned if the node would produce an empty string or if the
  3514. string cannot be allocated.
  3515. <BR>
  3516. <BR> The callback argument specifies a function that returns a
  3517. whitespace string or NULL before and after each element. If
  3518. MXML_NO_CALLBACK is specified, whitespace will only be added before
  3519. MXML_TEXT nodes with leading whitespace and before attribute names
  3520. inside opening element tags.</P>
  3521. <H3 class="function"><A name="mxmlSaveFd">mxmlSaveFd</A></H3>
  3522. <P class="description">Save an XML tree to a file descriptor.</P>
  3523. <P class="code"> int mxmlSaveFd (
  3524. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3525. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int fd,
  3526. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_save_cb_t">mxml_save_cb_t</A> cb
  3527. <BR> );</P>
  3528. <H4 class="parameters">Parameters</H4>
  3529. <DL>
  3530. <DT>node</DT>
  3531. <DD class="description">Node to write</DD>
  3532. <DT>fd</DT>
  3533. <DD class="description">File descriptor to write to</DD>
  3534. <DT>cb</DT>
  3535. <DD class="description">Whitespace callback or MXML_NO_CALLBACK</DD>
  3536. </DL>
  3537. <H4 class="returnvalue">Return Value</H4>
  3538. <P class="description">0 on success, -1 on error.</P>
  3539. <H4 class="discussion">Discussion</H4>
  3540. <P class="discussion">The callback argument specifies a function that
  3541. returns a whitespace string or NULL before and after each element. If
  3542. MXML_NO_CALLBACK is specified, whitespace will only be added before
  3543. MXML_TEXT nodes with leading whitespace and before attribute names
  3544. inside opening element tags.</P>
  3545. <H3 class="function"><A name="mxmlSaveFile">mxmlSaveFile</A></H3>
  3546. <P class="description">Save an XML tree to a file.</P>
  3547. <P class="code"> int mxmlSaveFile (
  3548. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3549. <BR> &nbsp;&nbsp;&nbsp;&nbsp;FILE *fp,
  3550. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_save_cb_t">mxml_save_cb_t</A> cb
  3551. <BR> );</P>
  3552. <H4 class="parameters">Parameters</H4>
  3553. <DL>
  3554. <DT>node</DT>
  3555. <DD class="description">Node to write</DD>
  3556. <DT>fp</DT>
  3557. <DD class="description">File to write to</DD>
  3558. <DT>cb</DT>
  3559. <DD class="description">Whitespace callback or MXML_NO_CALLBACK</DD>
  3560. </DL>
  3561. <H4 class="returnvalue">Return Value</H4>
  3562. <P class="description">0 on success, -1 on error.</P>
  3563. <H4 class="discussion">Discussion</H4>
  3564. <P class="discussion">The callback argument specifies a function that
  3565. returns a whitespace string or NULL before and after each element. If
  3566. MXML_NO_CALLBACK is specified, whitespace will only be added before
  3567. MXML_TEXT nodes with leading whitespace and before attribute names
  3568. inside opening element tags.</P>
  3569. <H3 class="function"><A name="mxmlSaveString">mxmlSaveString</A></H3>
  3570. <P class="description">Save an XML node tree to a string.</P>
  3571. <P class="code"> int mxmlSaveString (
  3572. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3573. <BR> &nbsp;&nbsp;&nbsp;&nbsp;char *buffer,
  3574. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int bufsize,
  3575. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_save_cb_t">mxml_save_cb_t</A> cb
  3576. <BR> );</P>
  3577. <H4 class="parameters">Parameters</H4>
  3578. <DL>
  3579. <DT>node</DT>
  3580. <DD class="description">Node to write</DD>
  3581. <DT>buffer</DT>
  3582. <DD class="description">String buffer</DD>
  3583. <DT>bufsize</DT>
  3584. <DD class="description">Size of string buffer</DD>
  3585. <DT>cb</DT>
  3586. <DD class="description">Whitespace callback or MXML_NO_CALLBACK</DD>
  3587. </DL>
  3588. <H4 class="returnvalue">Return Value</H4>
  3589. <P class="description">Size of string</P>
  3590. <H4 class="discussion">Discussion</H4>
  3591. <P class="discussion">This function returns the total number of bytes
  3592. that would be required for the string but only copies (bufsize - 1)
  3593. characters into the specified buffer.
  3594. <BR>
  3595. <BR> The callback argument specifies a function that returns a
  3596. whitespace string or NULL before and after each element. If
  3597. MXML_NO_CALLBACK is specified, whitespace will only be added before
  3598. MXML_TEXT nodes with leading whitespace and before attribute names
  3599. inside opening element tags.</P>
  3600. <H3 class="function"><A NAME="8_2_56">
  3601. <!--span class=&quot;info&quot;-->
  3602. &nbsp;Mini-XML 2.3&nbsp;<A name="mxmlSetCDATA">mxmlSetCDATA</A></A></H3>
  3603. <P class="description">Set the element name of a CDATA node.</P>
  3604. <P class="code"> int mxmlSetCDATA (
  3605. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3606. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *data
  3607. <BR> );</P>
  3608. <H4 class="parameters">Parameters</H4>
  3609. <DL>
  3610. <DT>node</DT>
  3611. <DD class="description">Node to set</DD>
  3612. <DT>data</DT>
  3613. <DD class="description">New data string</DD>
  3614. </DL>
  3615. <H4 class="returnvalue">Return Value</H4>
  3616. <P class="description">0 on success, -1 on failure</P>
  3617. <H4 class="discussion">Discussion</H4>
  3618. <P class="discussion">The node is not changed if it (or its first child)
  3619. is not a CDATA element node.</P>
  3620. <H3 class="function"><A NAME="8_2_57">
  3621. <!--span class=&quot;info&quot;-->
  3622. &nbsp;Mini-XML 2.1&nbsp;<A name="mxmlSetCustom">mxmlSetCustom</A></A></H3>
  3623. <P class="description">Set the data and destructor of a custom data
  3624. node.</P>
  3625. <P class="code"> int mxmlSetCustom (
  3626. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3627. <BR> &nbsp;&nbsp;&nbsp;&nbsp;void *data,
  3628. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_custom_destroy_cb_t">mxml_custom_destroy_cb_t</A>
  3629. destroy
  3630. <BR> );</P>
  3631. <H4 class="parameters">Parameters</H4>
  3632. <DL>
  3633. <DT>node</DT>
  3634. <DD class="description">Node to set</DD>
  3635. <DT>data</DT>
  3636. <DD class="description">New data pointer</DD>
  3637. <DT>destroy</DT>
  3638. <DD class="description">New destructor function</DD>
  3639. </DL>
  3640. <H4 class="returnvalue">Return Value</H4>
  3641. <P class="description">0 on success, -1 on failure</P>
  3642. <H4 class="discussion">Discussion</H4>
  3643. <P class="discussion">The node is not changed if it (or its first child)
  3644. is not a custom node.</P>
  3645. <H3 class="function"><A name="mxmlSetCustomHandlers">
  3646. mxmlSetCustomHandlers</A></H3>
  3647. <P class="description">Set the handling functions for custom data.</P>
  3648. <P class="code"> void mxmlSetCustomHandlers (
  3649. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_custom_load_cb_t">mxml_custom_load_cb_t</A>
  3650. load,
  3651. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_custom_save_cb_t">mxml_custom_save_cb_t</A> save
  3652. <BR> );</P>
  3653. <H4 class="parameters">Parameters</H4>
  3654. <DL>
  3655. <DT>load</DT>
  3656. <DD class="description">Load function</DD>
  3657. <DT>save</DT>
  3658. <DD class="description">Save function</DD>
  3659. </DL>
  3660. <H4 class="discussion">Discussion</H4>
  3661. <P class="discussion">The load function accepts a node pointer and a
  3662. data string and must return 0 on success and non-zero on error.
  3663. <BR>
  3664. <BR> The save function accepts a node pointer and must return a malloc'd
  3665. string on success and NULL on error.</P>
  3666. <H3 class="function"><A name="mxmlSetElement">mxmlSetElement</A></H3>
  3667. <P class="description">Set the name of an element node.</P>
  3668. <P class="code"> int mxmlSetElement (
  3669. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3670. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *name
  3671. <BR> );</P>
  3672. <H4 class="parameters">Parameters</H4>
  3673. <DL>
  3674. <DT>node</DT>
  3675. <DD class="description">Node to set</DD>
  3676. <DT>name</DT>
  3677. <DD class="description">New name string</DD>
  3678. </DL>
  3679. <H4 class="returnvalue">Return Value</H4>
  3680. <P class="description">0 on success, -1 on failure</P>
  3681. <H4 class="discussion">Discussion</H4>
  3682. <P class="discussion">The node is not changed if it is not an element
  3683. node.</P>
  3684. <H3 class="function"><A name="mxmlSetErrorCallback">mxmlSetErrorCallback</A>
  3685. </H3>
  3686. <P class="description">Set the error message callback.</P>
  3687. <P class="code"> void mxmlSetErrorCallback (
  3688. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_error_cb_t">mxml_error_cb_t</A> cb
  3689. <BR> );</P>
  3690. <H4 class="parameters">Parameters</H4>
  3691. <DL>
  3692. <DT>cb</DT>
  3693. <DD class="description">Error callback function</DD>
  3694. </DL>
  3695. <H3 class="function"><A name="mxmlSetInteger">mxmlSetInteger</A></H3>
  3696. <P class="description">Set the value of an integer node.</P>
  3697. <P class="code"> int mxmlSetInteger (
  3698. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3699. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int integer
  3700. <BR> );</P>
  3701. <H4 class="parameters">Parameters</H4>
  3702. <DL>
  3703. <DT>node</DT>
  3704. <DD class="description">Node to set</DD>
  3705. <DT>integer</DT>
  3706. <DD class="description">Integer value</DD>
  3707. </DL>
  3708. <H4 class="returnvalue">Return Value</H4>
  3709. <P class="description">0 on success, -1 on failure</P>
  3710. <H4 class="discussion">Discussion</H4>
  3711. <P class="discussion">The node is not changed if it (or its first child)
  3712. is not an integer node.</P>
  3713. <H3 class="function"><A name="mxmlSetOpaque">mxmlSetOpaque</A></H3>
  3714. <P class="description">Set the value of an opaque node.</P>
  3715. <P class="code"> int mxmlSetOpaque (
  3716. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3717. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *opaque
  3718. <BR> );</P>
  3719. <H4 class="parameters">Parameters</H4>
  3720. <DL>
  3721. <DT>node</DT>
  3722. <DD class="description">Node to set</DD>
  3723. <DT>opaque</DT>
  3724. <DD class="description">Opaque string</DD>
  3725. </DL>
  3726. <H4 class="returnvalue">Return Value</H4>
  3727. <P class="description">0 on success, -1 on failure</P>
  3728. <H4 class="discussion">Discussion</H4>
  3729. <P class="discussion">The node is not changed if it (or its first child)
  3730. is not an opaque node.</P>
  3731. <H3 class="function"><A name="mxmlSetReal">mxmlSetReal</A></H3>
  3732. <P class="description">Set the value of a real number node.</P>
  3733. <P class="code"> int mxmlSetReal (
  3734. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3735. <BR> &nbsp;&nbsp;&nbsp;&nbsp;double real
  3736. <BR> );</P>
  3737. <H4 class="parameters">Parameters</H4>
  3738. <DL>
  3739. <DT>node</DT>
  3740. <DD class="description">Node to set</DD>
  3741. <DT>real</DT>
  3742. <DD class="description">Real number value</DD>
  3743. </DL>
  3744. <H4 class="returnvalue">Return Value</H4>
  3745. <P class="description">0 on success, -1 on failure</P>
  3746. <H4 class="discussion">Discussion</H4>
  3747. <P class="discussion">The node is not changed if it (or its first child)
  3748. is not a real number node.</P>
  3749. <H3 class="function"><A name="mxmlSetText">mxmlSetText</A></H3>
  3750. <P class="description">Set the value of a text node.</P>
  3751. <P class="code"> int mxmlSetText (
  3752. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3753. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int whitespace,
  3754. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *string
  3755. <BR> );</P>
  3756. <H4 class="parameters">Parameters</H4>
  3757. <DL>
  3758. <DT>node</DT>
  3759. <DD class="description">Node to set</DD>
  3760. <DT>whitespace</DT>
  3761. <DD class="description">1 = leading whitespace, 0 = no whitespace</DD>
  3762. <DT>string</DT>
  3763. <DD class="description">String</DD>
  3764. </DL>
  3765. <H4 class="returnvalue">Return Value</H4>
  3766. <P class="description">0 on success, -1 on failure</P>
  3767. <H4 class="discussion">Discussion</H4>
  3768. <P class="discussion">The node is not changed if it (or its first child)
  3769. is not a text node.</P>
  3770. <H3 class="function"><A name="mxmlSetTextf">mxmlSetTextf</A></H3>
  3771. <P class="description">Set the value of a text node to a formatted
  3772. string.</P>
  3773. <P class="code"> int mxmlSetTextf (
  3774. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3775. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int whitespace,
  3776. <BR> &nbsp;&nbsp;&nbsp;&nbsp;const char *format,
  3777. <BR> &nbsp;&nbsp;&nbsp;&nbsp;...
  3778. <BR> );</P>
  3779. <H4 class="parameters">Parameters</H4>
  3780. <DL>
  3781. <DT>node</DT>
  3782. <DD class="description">Node to set</DD>
  3783. <DT>whitespace</DT>
  3784. <DD class="description">1 = leading whitespace, 0 = no whitespace</DD>
  3785. <DT>format</DT>
  3786. <DD class="description">Printf-style format string</DD>
  3787. <DT>...</DT>
  3788. <DD class="description">Additional arguments as needed</DD>
  3789. </DL>
  3790. <H4 class="returnvalue">Return Value</H4>
  3791. <P class="description">0 on success, -1 on failure</P>
  3792. <H4 class="discussion">Discussion</H4>
  3793. <P class="discussion">The node is not changed if it (or its first child)
  3794. is not a text node.</P>
  3795. <H3 class="function"><A NAME="8_2_66">
  3796. <!--span class=&quot;info&quot;-->
  3797. &nbsp;Mini-XML 2.7&nbsp;<A name="mxmlSetUserData">mxmlSetUserData</A></A></H3>
  3798. <P class="description">Set the user data pointer for a node.</P>
  3799. <P class="code"> int mxmlSetUserData (
  3800. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3801. <BR> &nbsp;&nbsp;&nbsp;&nbsp;void *data
  3802. <BR> );</P>
  3803. <H4 class="parameters">Parameters</H4>
  3804. <DL>
  3805. <DT>node</DT>
  3806. <DD class="description">Node to set</DD>
  3807. <DT>data</DT>
  3808. <DD class="description">User data pointer</DD>
  3809. </DL>
  3810. <H4 class="returnvalue">Return Value</H4>
  3811. <P class="description">0 on success, -1 on failure</P>
  3812. <H3 class="function"><A NAME="8_2_67">
  3813. <!--span class=&quot;info&quot;-->
  3814. &nbsp;Mini-XML 2.3&nbsp;<A name="mxmlSetWrapMargin">mxmlSetWrapMargin</A></A></H3>
  3815. <P class="description">Set the wrap margin when saving XML data.</P>
  3816. <P class="code"> void mxmlSetWrapMargin (
  3817. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int column
  3818. <BR> );</P>
  3819. <H4 class="parameters">Parameters</H4>
  3820. <DL>
  3821. <DT>column</DT>
  3822. <DD class="description">Column for wrapping, 0 to disable wrapping</DD>
  3823. </DL>
  3824. <H4 class="discussion">Discussion</H4>
  3825. <P class="discussion">Wrapping is disabled when &quot;column&quot; is 0.</P>
  3826. <H3 class="function"><A name="mxmlWalkNext">mxmlWalkNext</A></H3>
  3827. <P class="description">Walk to the next logical node in the tree.</P>
  3828. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlWalkNext (
  3829. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3830. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *top,
  3831. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int descend
  3832. <BR> );</P>
  3833. <H4 class="parameters">Parameters</H4>
  3834. <DL>
  3835. <DT>node</DT>
  3836. <DD class="description">Current node</DD>
  3837. <DT>top</DT>
  3838. <DD class="description">Top node</DD>
  3839. <DT>descend</DT>
  3840. <DD class="description">Descend into tree - MXML_DESCEND,
  3841. MXML_NO_DESCEND, or MXML_DESCEND_FIRST</DD>
  3842. </DL>
  3843. <H4 class="returnvalue">Return Value</H4>
  3844. <P class="description">Next node or NULL</P>
  3845. <H4 class="discussion">Discussion</H4>
  3846. <P class="discussion">The descend argument controls whether the first
  3847. child is considered to be the next node. The top node argument
  3848. constrains the walk to the node's children.</P>
  3849. <H3 class="function"><A name="mxmlWalkPrev">mxmlWalkPrev</A></H3>
  3850. <P class="description">Walk to the previous logical node in the tree.</P>
  3851. <P class="code"> <A href="#mxml_node_t">mxml_node_t</A> *mxmlWalkPrev (
  3852. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *node,
  3853. <BR> &nbsp;&nbsp;&nbsp;&nbsp;<A href="#mxml_node_t">mxml_node_t</A> *top,
  3854. <BR> &nbsp;&nbsp;&nbsp;&nbsp;int descend
  3855. <BR> );</P>
  3856. <H4 class="parameters">Parameters</H4>
  3857. <DL>
  3858. <DT>node</DT>
  3859. <DD class="description">Current node</DD>
  3860. <DT>top</DT>
  3861. <DD class="description">Top node</DD>
  3862. <DT>descend</DT>
  3863. <DD class="description">Descend into tree - MXML_DESCEND,
  3864. MXML_NO_DESCEND, or MXML_DESCEND_FIRST</DD>
  3865. </DL>
  3866. <H4 class="returnvalue">Return Value</H4>
  3867. <P class="description">Previous node or NULL</P>
  3868. <H4 class="discussion">Discussion</H4>
  3869. <P class="discussion">The descend argument controls whether the previous
  3870. node's last child is considered to be the previous node. The top node
  3871. argument constrains the walk to the node's children.</P>
  3872. <H2 class="title"><A name="TYPES">Data Types</A></H2>
  3873. <H3 class="typedef"><A name="mxml_custom_destroy_cb_t">
  3874. mxml_custom_destroy_cb_t</A></H3>
  3875. <P class="description">Custom data destructor</P>
  3876. <P class="code"> typedef void (*mxml_custom_destroy_cb_t)(void *);</P>
  3877. <H3 class="typedef"><A name="mxml_custom_load_cb_t">
  3878. mxml_custom_load_cb_t</A></H3>
  3879. <P class="description">Custom data load callback function</P>
  3880. <P class="code"> typedef int (*mxml_custom_load_cb_t)(<A href="#mxml_node_t">
  3881. mxml_node_t</A> *, const char *);</P>
  3882. <H3 class="typedef"><A name="mxml_custom_save_cb_t">
  3883. mxml_custom_save_cb_t</A></H3>
  3884. <P class="description">Custom data save callback function</P>
  3885. <P class="code"> typedef char *(*mxml_custom_save_cb_t)(<A href="#mxml_node_t">
  3886. mxml_node_t</A> *);</P>
  3887. <H3 class="typedef"><A name="mxml_entity_cb_t">mxml_entity_cb_t</A></H3>
  3888. <P class="description">Entity callback function</P>
  3889. <P class="code"> typedef int (*mxml_entity_cb_t)(const char *);</P>
  3890. <H3 class="typedef"><A name="mxml_error_cb_t">mxml_error_cb_t</A></H3>
  3891. <P class="description">Error callback function</P>
  3892. <P class="code"> typedef void (*mxml_error_cb_t)(const char *);</P>
  3893. <H3 class="typedef"><A name="mxml_index_t">mxml_index_t</A></H3>
  3894. <P class="description">An XML node index.</P>
  3895. <P class="code"> typedef struct <A href="#mxml_index_s">mxml_index_s</A>
  3896. mxml_index_t;</P>
  3897. <H3 class="typedef"><A name="mxml_load_cb_t">mxml_load_cb_t</A></H3>
  3898. <P class="description">Load callback function</P>
  3899. <P class="code"> typedef <A href="#mxml_type_t">mxml_type_t</A>
  3900. (*mxml_load_cb_t)(<A href="#mxml_node_t">mxml_node_t</A> *);</P>
  3901. <H3 class="typedef"><A name="mxml_node_t">mxml_node_t</A></H3>
  3902. <P class="description">An XML node.</P>
  3903. <P class="code"> typedef struct <A href="#mxml_node_s">mxml_node_s</A>
  3904. mxml_node_t;</P>
  3905. <H3 class="typedef"><A name="mxml_save_cb_t">mxml_save_cb_t</A></H3>
  3906. <P class="description">Save callback function</P>
  3907. <P class="code"> typedef const char *(*mxml_save_cb_t)(<A href="#mxml_node_t">
  3908. mxml_node_t</A> *, int);</P>
  3909. <H3 class="typedef"><A name="mxml_sax_cb_t">mxml_sax_cb_t</A></H3>
  3910. <P class="description">SAX callback function</P>
  3911. <P class="code"> typedef void (*mxml_sax_cb_t)(<A href="#mxml_node_t">
  3912. mxml_node_t</A> *, mxml_sax_event_t, void *);</P>
  3913. <H3 class="typedef"><A name="mxml_sax_event_t">mxml_sax_event_t</A></H3>
  3914. <P class="description">SAX event type.</P>
  3915. <P class="code"> typedef enum <A href="#mxml_sax_event_e">
  3916. mxml_sax_event_e</A> mxml_sax_event_t;</P>
  3917. <H3 class="typedef"><A name="mxml_type_t">mxml_type_t</A></H3>
  3918. <P class="description">The XML node type.</P>
  3919. <P class="code"> typedef enum <A href="#mxml_type_e">mxml_type_e</A>
  3920. mxml_type_t;</P>
  3921. <H2 class="title"><A name="ENUMERATIONS">Constants</A></H2>
  3922. <H3 class="enumeration"><A name="mxml_sax_event_e">mxml_sax_event_e</A></H3>
  3923. <P class="description">SAX event type.</P>
  3924. <H4 class="constants">Constants</H4>
  3925. <DL>
  3926. <DT>MXML_SAX_CDATA</DT>
  3927. <DD class="description">CDATA node</DD>
  3928. <DT>MXML_SAX_COMMENT</DT>
  3929. <DD class="description">Comment node</DD>
  3930. <DT>MXML_SAX_DATA</DT>
  3931. <DD class="description">Data node</DD>
  3932. <DT>MXML_SAX_DIRECTIVE</DT>
  3933. <DD class="description">Processing directive node</DD>
  3934. <DT>MXML_SAX_ELEMENT_CLOSE</DT>
  3935. <DD class="description">Element closed</DD>
  3936. <DT>MXML_SAX_ELEMENT_OPEN</DT>
  3937. <DD class="description">Element opened</DD>
  3938. </DL>
  3939. <H3 class="enumeration"><A name="mxml_type_e">mxml_type_e</A></H3>
  3940. <P class="description">The XML node type.</P>
  3941. <H4 class="constants">Constants</H4>
  3942. <DL>
  3943. <DT>MXML_CUSTOM
  3944. <!--span class=&quot;info&quot;-->
  3945. &nbsp;Mini-XML 2.1&nbsp;</DT>
  3946. <DD class="description">Custom data</DD>
  3947. <DT>MXML_ELEMENT</DT>
  3948. <DD class="description">XML element with attributes</DD>
  3949. <DT>MXML_IGNORE
  3950. <!--span class=&quot;info&quot;-->
  3951. &nbsp;Mini-XML 2.3&nbsp;</DT>
  3952. <DD class="description">Ignore/throw away node</DD>
  3953. <DT>MXML_INTEGER</DT>
  3954. <DD class="description">Integer value</DD>
  3955. <DT>MXML_OPAQUE</DT>
  3956. <DD class="description">Opaque string</DD>
  3957. <DT>MXML_REAL</DT>
  3958. <DD class="description">Real value</DD>
  3959. <DT>MXML_TEXT</DT>
  3960. <DD class="description">Text fragment</DD>
  3961. </DL>
  3962. </DIV><HR NOSHADE>
  3963. <H1 align="right"><A name="SCHEMA"><IMG align="right" alt="D" height="100"
  3964. hspace="10" src="D.gif" width="100"></A>XML Schema</H1>
  3965. <P>This appendix provides the XML schema that is used for the XML files
  3966. produced by <TT>mxmldoc</TT>. This schema is available on-line at:</P>
  3967. <PRE>
  3968. http://www.msweet.org/schema/mxmldoc.xsd
  3969. </PRE>
  3970. <H2><A NAME="9_1">mxmldoc.xsd</A></H2>
  3971. <PRE><SMALL>
  3972. &lt;?xml version=&quot;1.0&quot;?&gt;
  3973. &lt;xsd:schema xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;
  3974. &lt;xsd:annotation&gt;
  3975. &lt;xsd:documentation xml:lang=&quot;en&quot;&gt;
  3976. Mini-XML 2.9 documentation schema for mxmldoc output.
  3977. Copyright 2003-2014 by Michael Sweet.
  3978. &lt;/xsd:documentation&gt;
  3979. &lt;/xsd:annotation&gt;
  3980. &lt;!-- basic element definitions --&gt;
  3981. &lt;xsd:element name=&quot;argument&quot; type=&quot;argumentType&quot;/&gt;
  3982. &lt;xsd:element name=&quot;class&quot; type=&quot;classType&quot;/&gt;
  3983. &lt;xsd:element name=&quot;constant&quot; type=&quot;constantType&quot;/&gt;
  3984. &lt;xsd:element name=&quot;description&quot; type=&quot;xsd:string&quot;/&gt;
  3985. &lt;xsd:element name=&quot;enumeration&quot; type=&quot;enumerationType&quot;/&gt;
  3986. &lt;xsd:element name=&quot;function&quot; type=&quot;functionType&quot;/&gt;
  3987. &lt;xsd:element name=&quot;mxmldoc&quot; type=&quot;mxmldocType&quot;/&gt;
  3988. &lt;xsd:element name=&quot;namespace&quot; type=&quot;namespaceType&quot;/&gt;
  3989. &lt;xsd:element name=&quot;returnvalue&quot; type=&quot;returnvalueType&quot;/&gt;
  3990. &lt;xsd:element name=&quot;seealso&quot; type=&quot;identifierList&quot;/&gt;
  3991. &lt;xsd:element name=&quot;struct&quot; type=&quot;structType&quot;/&gt;
  3992. &lt;xsd:element name=&quot;typedef&quot; type=&quot;typedefType&quot;/&gt;
  3993. &lt;xsd:element name=&quot;type&quot; type=&quot;xsd:string&quot;/&gt;
  3994. &lt;xsd:element name=&quot;union&quot; type=&quot;unionType&quot;/&gt;
  3995. &lt;xsd:element name=&quot;variable&quot; type=&quot;variableType&quot;/&gt;
  3996. &lt;!-- descriptions of complex elements --&gt;
  3997. &lt;xsd:complexType name=&quot;argumentType&quot;&gt;
  3998. &lt;xsd:sequence&gt;
  3999. &lt;xsd:element ref=&quot;type&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot;/&gt;
  4000. &lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4001. &lt;/xsd:sequence&gt;
  4002. &lt;xsd:attribute name=&quot;default&quot; type=&quot;xsd:string&quot; use=&quot;optional&quot;/&gt;
  4003. &lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
  4004. &lt;xsd:attribute name=&quot;direction&quot; type=&quot;direction&quot; use=&quot;optional&quot;
  4005. default=&quot;I&quot;/&gt;
  4006. &lt;/xsd:complexType&gt;
  4007. &lt;xsd:complexType name=&quot;classType&quot;&gt;
  4008. &lt;xsd:sequence&gt;
  4009. &lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4010. &lt;xsd:choice minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;&gt;
  4011. &lt;xsd:element ref=&quot;class&quot;/&gt;
  4012. &lt;xsd:element ref=&quot;enumeration&quot;/&gt;
  4013. &lt;xsd:element ref=&quot;function&quot;/&gt;
  4014. &lt;xsd:element ref=&quot;struct&quot;/&gt;
  4015. &lt;xsd:element ref=&quot;typedef&quot;/&gt;
  4016. &lt;xsd:element ref=&quot;union&quot;/&gt;
  4017. &lt;xsd:element ref=&quot;variable&quot;/&gt;
  4018. &lt;/xsd:choice&gt;
  4019. &lt;/xsd:sequence&gt;
  4020. &lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
  4021. &lt;xsd:attribute name=&quot;parent&quot; type=&quot;xsd:string&quot; use=&quot;optional&quot;/&gt;
  4022. &lt;/xsd:complexType&gt;
  4023. &lt;xsd:complexType name=&quot;constantType&quot;&gt;
  4024. &lt;xsd:sequence&gt;
  4025. &lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4026. &lt;/xsd:sequence&gt;
  4027. &lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
  4028. &lt;/xsd:complexType&gt;
  4029. &lt;xsd:complexType name=&quot;enumerationType&quot;&gt;
  4030. &lt;xsd:sequence&gt;
  4031. &lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4032. &lt;xsd:element ref=&quot;constant&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;unbounded&quot;/&gt;
  4033. &lt;/xsd:sequence&gt;
  4034. &lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
  4035. &lt;/xsd:complexType&gt;
  4036. &lt;xsd:complexType name=&quot;functionType&quot;&gt;
  4037. &lt;xsd:sequence&gt;
  4038. &lt;xsd:element ref=&quot;returnvalue&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4039. &lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4040. &lt;xsd:element ref=&quot;argument&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;unbounded&quot;/&gt;
  4041. &lt;xsd:element ref=&quot;seealso&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4042. &lt;/xsd:sequence&gt;
  4043. &lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
  4044. &lt;xsd:attribute name=&quot;scope&quot; type=&quot;scope&quot; use=&quot;optional&quot;/&gt;
  4045. &lt;/xsd:complexType&gt;
  4046. &lt;xsd:complexType name=&quot;mxmldocType&quot;&gt;
  4047. &lt;xsd:choice minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;&gt;
  4048. &lt;xsd:element ref=&quot;class&quot;/&gt;
  4049. &lt;xsd:element ref=&quot;enumeration&quot;/&gt;
  4050. &lt;xsd:element ref=&quot;function&quot;/&gt;
  4051. &lt;xsd:element ref=&quot;namespace&quot;/&gt;
  4052. &lt;xsd:element ref=&quot;struct&quot;/&gt;
  4053. &lt;xsd:element ref=&quot;typedef&quot;/&gt;
  4054. &lt;xsd:element ref=&quot;union&quot;/&gt;
  4055. &lt;xsd:element ref=&quot;variable&quot;/&gt;
  4056. &lt;/xsd:choice&gt;
  4057. &lt;/xsd:complexType&gt;
  4058. &lt;xsd:complexType name=&quot;namespaceType&quot;&gt;
  4059. &lt;xsd:sequence&gt;
  4060. &lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4061. &lt;xsd:choice minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;&gt;
  4062. &lt;xsd:element ref=&quot;class&quot;/&gt;
  4063. &lt;xsd:element ref=&quot;enumeration&quot;/&gt;
  4064. &lt;xsd:element ref=&quot;function&quot;/&gt;
  4065. &lt;xsd:element ref=&quot;struct&quot;/&gt;
  4066. &lt;xsd:element ref=&quot;typedef&quot;/&gt;
  4067. &lt;xsd:element ref=&quot;union&quot;/&gt;
  4068. &lt;xsd:element ref=&quot;variable&quot;/&gt;
  4069. &lt;/xsd:choice&gt;
  4070. &lt;/xsd:sequence&gt;
  4071. &lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
  4072. &lt;/xsd:complexType&gt;
  4073. &lt;xsd:complexType name=&quot;returnvalueType&quot;&gt;
  4074. &lt;xsd:sequence&gt;
  4075. &lt;xsd:element ref=&quot;type&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot;/&gt;
  4076. &lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4077. &lt;/xsd:sequence&gt;
  4078. &lt;/xsd:complexType&gt;
  4079. &lt;xsd:complexType name=&quot;structType&quot;&gt;
  4080. &lt;xsd:sequence&gt;
  4081. &lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4082. &lt;xsd:choice minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;&gt;
  4083. &lt;xsd:element ref=&quot;variable&quot;/&gt;
  4084. &lt;xsd:element ref=&quot;function&quot;/&gt;
  4085. &lt;/xsd:choice&gt;
  4086. &lt;/xsd:sequence&gt;
  4087. &lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
  4088. &lt;/xsd:complexType&gt;
  4089. &lt;xsd:complexType name=&quot;typedefType&quot;&gt;
  4090. &lt;xsd:sequence&gt;
  4091. &lt;xsd:element ref=&quot;type&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot;/&gt;
  4092. &lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4093. &lt;/xsd:sequence&gt;
  4094. &lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
  4095. &lt;/xsd:complexType&gt;
  4096. &lt;xsd:complexType name=&quot;unionType&quot;&gt;
  4097. &lt;xsd:sequence&gt;
  4098. &lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4099. &lt;xsd:element ref=&quot;variable&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
  4100. &lt;/xsd:sequence&gt;
  4101. &lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
  4102. &lt;/xsd:complexType&gt;
  4103. &lt;xsd:complexType name=&quot;variableType&quot;&gt;
  4104. &lt;xsd:sequence&gt;
  4105. &lt;xsd:element ref=&quot;type&quot; minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot;/&gt;
  4106. &lt;xsd:element ref=&quot;description&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;
  4107. &lt;/xsd:sequence&gt;
  4108. &lt;xsd:attribute name=&quot;name&quot; type=&quot;identifier&quot; use=&quot;required&quot;/&gt;
  4109. &lt;/xsd:complexType&gt;
  4110. &lt;!-- data types --&gt;
  4111. &lt;xsd:simpleType name=&quot;direction&quot;&gt;
  4112. &lt;xsd:restriction base=&quot;xsd:string&quot;&gt;
  4113. &lt;xsd:enumeration value=&quot;I&quot;/&gt;
  4114. &lt;xsd:enumeration value=&quot;O&quot;/&gt;
  4115. &lt;xsd:enumeration value=&quot;IO&quot;/&gt;
  4116. &lt;/xsd:restriction&gt;
  4117. &lt;/xsd:simpleType&gt;
  4118. &lt;xsd:simpleType name=&quot;identifier&quot;&gt;
  4119. &lt;xsd:restriction base=&quot;xsd:string&quot;&gt;
  4120. &lt;xsd:pattern value=&quot;[a-zA-Z_(.]([a-zA-Z_(.,)* 0-9])*&quot;/&gt;
  4121. &lt;/xsd:restriction&gt;
  4122. &lt;/xsd:simpleType&gt;
  4123. &lt;xsd:simpleType name=&quot;identifierList&quot;&gt;
  4124. &lt;xsd:list itemType=&quot;identifier&quot;/&gt;
  4125. &lt;/xsd:simpleType&gt;
  4126. &lt;xsd:simpleType name=&quot;scope&quot;&gt;
  4127. &lt;xsd:restriction base=&quot;xsd:string&quot;&gt;
  4128. &lt;xsd:enumeration value=&quot;&quot;/&gt;
  4129. &lt;xsd:enumeration value=&quot;private&quot;/&gt;
  4130. &lt;xsd:enumeration value=&quot;protected&quot;/&gt;
  4131. &lt;xsd:enumeration value=&quot;public&quot;/&gt;
  4132. &lt;/xsd:restriction&gt;
  4133. &lt;/xsd:simpleType&gt;
  4134. &lt;/xsd:schema&gt;
  4135. </SMALL></PRE>
  4136. </BODY>
  4137. </HTML>