xmlpull

Simple XML parsing for Plan 9 and Linux.
git clone git://r-36.net/xmlpull
Log | Files | Refs | LICENSE

commit 53bc6429c1301eec1b676f7f60582a3f094e7f97
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sat,  3 Mar 2018 15:37:07 +0100

Initial commit.

Diffstat:
LICENSE | 676+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Makefile | 19+++++++++++++++++++
mkfile | 17+++++++++++++++++
mkfile.plan9port | 18++++++++++++++++++
mkfile.read | 15+++++++++++++++
mkfile.write | 15+++++++++++++++
test.html | 674+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
test.xml | 3+++
test_read.c | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
test_read.xml | 20++++++++++++++++++++
test_write.c | 156+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
test_write.xml | 8++++++++
xmlpull.c | 462+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
xmlpull.h | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
xmlpull.man | 98+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
15 files changed, 2305 insertions(+), 0 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -0,0 +1,676 @@ +© 2004-2018 Christoph Lohmann <20h at r-36 dot net> + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/Makefile b/Makefile @@ -0,0 +1,19 @@ +all: libxmlpull.a + +libxmlpull.a: + gcc -shared -g -c xmlpull.c -o libxmlpull.so + +read: + gcc -L. test_read.c -lxmlpull -o read_xmlpull + +write: + gcc -L. test_write.c -lxmlpull -o write_xmlpull + +install: + +clean: + if [ -f libxmlpull.* ]; then rm libxmlpull.*; fi + if [ -f xmlpull.o ]; then rm xmlpull.o; fi + if [ -f read_xmlpull* ]; then rm read_xmlpull*; fi + if [ -f write_xmlpull* ]; then rm write_xmlpull*; fi + diff --git a/mkfile b/mkfile @@ -0,0 +1,17 @@ +</$objtype/mkfile + +LIB=$home/lib/$objtype/libxmlpull.a +CFLAGS=-DPLAN9 +OFILES=\ + xmlpull.$O\ + +HFILES=\ + xmlpull.h\ + +UPDATE=\ + mkfile\ + $HFILES\ + ${OFILES:%.$O=%.c}\ + ${LIB:/$objtype/%=/386%}\ + +</sys/src/cmd/mklib diff --git a/mkfile.plan9port b/mkfile.plan9port @@ -0,0 +1,17 @@ +<$PLAN9/src/mkhdr + +LIB=$PLAN9/lib/libxmlpull.a +CFLAGS=-DPLAN9 +OFILES=\ + xmlpull.$O\ + +HFILES=\ + xmlpull.h\ + +UPDATE=\ + mkfile\ + $HFILES\ + ${OFILES:%.$O=%.c}\ + ${TARG:%=$PLAN9/bin/%}\ + +<$PLAN9/src/mklib+ \ No newline at end of file diff --git a/mkfile.read b/mkfile.read @@ -0,0 +1,15 @@ +</$objtype/mkfile +BIN=. + +TARG=read_xmlpull +CFLAGS=-DPLAN9 +OFILES=\ + test_read.$O\ + +UPDATE=\ + mkfile\ + $HFILES\ + ${OFILES:%.$O=%.c}\ + ${TARG:%=.}\ + +</sys/src/cmd/mkone diff --git a/mkfile.write b/mkfile.write @@ -0,0 +1,15 @@ +</$objtype/mkfile +BIN=. + +TARG=write_xmlpull +CFLAGS=-DPLAN9 +OFILES=\ + test_write.$O\ + +UPDATE=\ + mkfile\ + $HFILES\ + ${OFILES:%.$O=%.c}\ + ${TARG:%=.}\ + +</sys/src/cmd/mkone diff --git a/test.html b/test.html @@ -0,0 +1,674 @@ + + + + + + +<html> +<head> + +<!-- Site Navigation Bar --> + +<link rel="copyright" title="Heise Zeitschriften Verlag" href="/kontakt/impressum.shtml"> +<link rel="start" title="Start" href="/"> +<link rel="author" title="Kontakt" href="mailto:kontakt%40heise.de?subject=heise%20online"> +<link rel="home" title="home:heise online" href="/"> + +<link rel="alternate" type="application/rss+xml" title="RDF-Datei" href="http://www.heise.de/newsticker/heise.rdf"> + +<link rel="section" title="7-Tage-News" href="/newsticker/"> +<link rel="section" title="News-Archiv" href="/newsticker/archiv/"> +<link rel="section" title="News mobil" href="/newsticker/pda/"> +<link rel="section" title="Newsletter" href="/newsletter/"> +<link rel="section" title="News einbinden" href="/news-extern/"> + +<link rel="section" title="Abo &amp; Heft" href="/abo/"> +<link rel="section" title="Kontakt" href="/kontakt/"> + +<link rel="section" title="Telefontarife" href="/ttarif/"> +<link rel="section" title="Internettarife" href="/itarif/"> +<link rel="section" title="Internetst&ouml;rungen" href="/imonitor/"> + +<link rel="section" title="Leserforum" href="/foren/"> +<link rel="section" title="Chat-Events" href="/chat/"> + +<link rel="section" title="Datenschutzhinweis" href="/privacy/"> + + + +<link rel="bookmark" type="text/html" title="heise online" href="http://www.heise.de"> +<link rel="bookmark" type="text/html" title="c't" href="http://www.ctmagazin.de"> +<link rel="bookmark" type="text/html" title="iX" href="http://www.ix.de"> +<link rel="bookmark" type="text/html" title="Technology Review" href="http://www.technology-review.de"> +<link rel="bookmark" type="text/html" title="Telepolis" href="http://www.telepolis.de"> +<link rel="bookmark" type="text/html" title="heise mobil" href="http://www.heisemobil.de"> +<link rel="bookmark" type="text/html" title="heise Security" href="http://www.heisec.de"> +<link rel="bookmark" type="text/html" title="c't-TV" href="http://www.ctmagazin.tv"> +<link rel="bookmark" type="text/html" title="heise jobs" href="http://www.heisejobs.de"> +<link rel="bookmark" type="text/html" title="heise IT-Markt" href="http://www.heise.de/itmarkt/"> +<link rel="bookmark" type="text/html" title="heise Kiosk" href="http://www.heise.de/kiosk/"> +<link rel="bookmark" type="text/html" title="Heise Medien Gruppe" href="http://www.heise-medien.de"> + + + + + +<!-- Allgemeines Standard-Stylesheet --> +<link href="/stil/standard.css" rel="stylesheet" type="text/css" media="screen, projection"> + +<!-- heise online Standard-Stylesheet --> +<link href="/stil/ho/standard.css" rel="stylesheet" type="text/css" media="screen, projection"> + +<!-- heise online weitere Stylesheets --> + +<link href="/stil/ho/news.css" rel="stylesheet" type="text/css" media="screen, projection"> + + +<!-- Allgemeines Druck-Stylesheet --> +<link href="/stil/drucken.css" rel="stylesheet" type="text/css" media="print"> + +<!-- heise online Druck-Stylesheet --> +<link href="/stil/ho/drucken.css" rel="stylesheet" type="text/css" media="print"> + + +<!-- Seitenname --> +<title>heise online</title> +<script type="text/javascript" language="javascript" src="/support/js3.js?1"> </script> + +<!-- Keywords, Description --> +<!-- Zeichensatz --> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + +<!-- Keywords --> + +<meta name="keywords" content=" heise online, c't, iX, Technology Review, Telepolis, heise mobil, heise Security, heise jobs, heise Kiosk, Newsticker"> + + +<!-- Description --> + +<meta name="description" content="heise online - News"> + + + + +<!-- Copyright --> +<meta NAME="copyright" CONTENT="Heise Zeitschriften Verlag"> + + +<!-- Staendige Aktualisierung --> + +<meta http-equiv="expires" content="900"> + + +<!-- Favicon--> +<link href="/favicon.ico" rel="shortcut icon"> + +<!-- nicht in Frames--> +<base target="_top"> +</head> + +<!-- Body --> +<body bgcolor="#FFFFFF" text="#000000" link="#003399" vlink="#666666" alink="#3366cc" +leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> + + +<!-- allgemeine obere Navigation --> +<table border="0" cellspacing="0" cellpadding="0" width="100%" class="druck"> + <tr> + <td align="center" bgcolor="#eeeeee"> + <table cellpadding="2" cellspacing="2" border="0"> + <tr> + <td><a href="/" title="heise online" class="navi_oben_ho">heise&nbsp;online</a></td> + <td><b class="trenner">&middot;</b></td> + <td><a href="/ct/" title="c't" class="navi_oben_ct">c't</a></td> + <td><b class="trenner">&middot;</b></td> + <td><a href="/ix/" title="iX" class="navi_oben_ix">iX</a></td> + <td><b class="trenner">&middot;</b></td> + <td><a href="/tr/" title="Technology Review" class="navi_oben_tr">Technology&nbsp;Review</a></td> + <td><b class="trenner">&middot;</b></td> + <td><a href="/tp/" title="Telepolis" class="navi_oben_tp">Telepolis</a></td> + <td><b class="trenner">&middot;</b></td> + <td><a href="/mobil/" title="heise mobil" class="navi_oben_mob">mobil</a></td> + <td><b class="trenner">&middot;</b></td> + <td><a href="/security/" title="heise security" class="navi_oben_sec">Security</a></td> + <td><b class="trenner">&middot;</b></td> + <td><a href="/ct/tv/" title="ctmagazin.tv" class="navi_oben_tv">c't-TV</a></td> + <td><b class="trenner">&middot;</b></td> + <td><a href="/heisejobs/" title="heise jobs" class="navi_oben_job">Jobs</a></td> + <td><b class="trenner">&middot;</b></td> + <td><a href="/itmarkt/" title="heise IT-Markt" class="navi_oben_itm">IT-Markt</a></td> + <td><b class="trenner">&middot;</b></td> + <td><a href="/kiosk/" title="Zeitschriften-Archiv" class="navi_oben_kio">Kiosk</a></td> + </tr> + </table> + </td> + </tr> + + <tr> + <td bgcolor="#999999"><img src="/icons/ho/1pix.gif" width="1" height="1" hspace="375" alt=""></td> + </tr> + +</table> + + + +<div class="leaderboard"> + <leaderboard><table border="0"> + <tr align="center"> + + <td><!--OAS AD="Top"--> +<!-- www.heise.de/Homepage@Top --></td> + </tr> +</table> +</leaderboard> +</div> + +<table border="0" cellspacing="0" cellpadding="0" width="100%"> + <tr> + <!-- 1. Spalte --> + <td valign="top" width="141" class="druck"> + <!-- Logo, Navigation links --> + <table border="0" cellspacing="0" cellpadding="0" width="100%"> + <tr> + + <td><a href="/"><img src="/icons/ho/heise.gif" alt="heise online" width="137" height="60" border="0" vspace="5" hspace="4"></a></td> + + </tr> + <tr> + <td class="rand_links" bgcolor="#cccccc" valign="top"> + + <!-- Suchen nach--> +<form name="myform" action="/bin/callurl" class="suchen_nach"> + <select name="2" onchange="self.location=this.options[this.selectedIndex].value; return true;"> + <option value="" selected>Suche ...</option> + <option value="/newsticker/search.shtml">News</option> + <option value="/ct/inhverz/search.shtml">c't-Artikel</option> + <option value="/ix/iXInhalt/search.shtml">iX-Artikel</option> + <option value="/tp/deutsch/html/such.html">Telepolis-Art.</option> + <option value="/software/">Software</option> + <option value="/ct/softlink_erlaeuterung.shtml">c't-Soft-Link</option> + <option value="/ct/treiber/">Treiber</option> + <option value="/ct/adressen/">Firmenkontakt</option> + <option value="/heisejobs/">Jobs</option> + <option value="/bin/callurl?2=http://de.vivisimo.com/">... im Internet</option> + </select> + <noscript> + <input type="submit" name="test" value=" Go "> + </noscript> +</form> + + + + <p class="navi_links_news"> + <a href="/newsticker/" class="navi_links">7-Tage-News</a><br> + <a href="/newsticker/archiv/" class="navi_links">News-Archiv</a><br> + <a href="/newsticker/pda/" class="navi_links">News mobil</a><br> + <a href="/newsletter/" class="navi_links">Newsletter</a><br> + <a href="/news-extern/" class="navi_links">News einbinden</a><br> +</p> + + + <p class="navi_links_dienste"> + <a href="/ttarif/" class="navi_links">Telefontarife</a><br> + <a href="/itarif/" class="navi_links">Internettarife</a><br> + <a href="/imonitor/" class="navi_links">Internetst&ouml;rungen</a><br> +</p> + <p class="navi_links_user"> + <a href="/foren/" class="navi_links">Leserforum</a><br> + <a href="/chat/" class="navi_links">Chat-Events</a><br> + <a href="/english/" class="navi_links">English Pages</a><br> +</p> + <p class="navi_links_kontakt"> + <a href="/abo/" class="navi_links">Abo &amp; Heft</a><br> + <a href="/kontakt/" class="navi_links">Kontakt</a><br> + <a href="/mediadaten/" class="navi_links">Mediadaten</a><br> +</p> + + + <div align="center" class="contentbanner"> + <contentbanner><table border="0"> + <tr align="center"> + + <td><!--OAS AD="Left"--> +<a href="http://www.heise.de/RealMedia/ads/click_lx.ads/www.heise.de/Homepage/1396401850/Left/137-eigen-he-promo/137-eigen-he-promo_3/63306138316532363432323633633930" target="_blank"><img src="http://www.heise.de/RealMedia/ads/adstream_lx.ads/www.heise.de/Homepage/1396401850/Left/137-eigen-he-promo/137-eigen-he-promo_3/63306138316532363432323633633930" WIDTH=137 HEIGHT=60 alt="" border="0" ></A></td> + </tr> +</table> +</contentbanner> + </div> + + <!-- ONLINE-MARKT --> + <h4 class="kasten_markt_titel">ONLINE-MARKT</h4> + +<table border="0" cellspacing="0" cellpadding="5" width="100%" class="kasten_markt"> + <tr> + <td> + <!-- Hinweis --> + <div class="werbung" align="right">Werbung</div> + + <!-- Preisvergleich --> + <p class="kasten_markt"> + <b><a href="/preisvergleich/" style="color: #990000;">Preisvergleich</a></b><br> + <span class="size80">Recherchieren und vergleichen in &uuml;ber 100.000 Produkten</span> + </p> + + <!-- eMedia Teaser --> + <p class="kasten_markt"> + <b><a href="http://www.emedia.de/" target="_blank">eMedia.de</a></b><br> + <span class="size80">Fachb&uuml;cher, Edutainment, <br> + c't- und iX-Archiv-CDs</span><br> + + + <a href="http://www.emedia.de/cd-shop" target="_blank"><img src="/emedia/bilder/2004/ctdvd_8389.gif" alt="" width="110" height="120" border="0"></a><br> +<b class="size80"><a href="http://www.emedia.de/cd-shop" target="_blank">c't-Archiv auf DVD<br> 1983 bis 1989</a></b> + + + + + </p> + + + <!-- aktuellste oben --> + <!-- c't special --> + <p class="kasten_markt"> + <a href="/ct/special/05/01/"><img src="/icons/ho/ct/special0105.gif" + alt="" border="0" vspace="5" width="85"></a><br> + <span class="size80">c't special 1/2005</span><br> + <b><a href="/ct/special/05/01/">Digital-Video</a></b><br> +</p> + + + + <p class="kasten_markt"> + <a href="/tp/r4/buch/default_1.html"><img src="/icons/ho/tp/special0105.gif" + alt="" border="0" vspace="5" width="85"></a><br> + <span class="size80">Telepolis special</span><br> + <b><a href="/tp/r4/buch/default_1.html">Aliens</a></b><br> +</p> + + + + + + <!-- Text-Anzeige --> + + + <MARKT> + + </MARKT> + + + </td> + </tr> +</table> + + + + + + + <div align="center" class="sales"> + <sales><table border="0"> + <tr align="center"> + + <td><!--OAS AD="Left2"--> +<a href="http://www.heise.de/RealMedia/ads/click_lx.ads/www.heise.de/Homepage/681555605/Left2/137-eigen-he-promo-200/137-eigen-he-promo-200_4/63306138316532363432323633633930" target="_blank"><img src="http://www.heise.de/RealMedia/ads/adstream_lx.ads/www.heise.de/Homepage/681555605/Left2/137-eigen-he-promo-200/137-eigen-he-promo-200_4/63306138316532363432323633633930" alt="" border="0" Width="137" Height="200"></A></td> + </tr> +</table> +</sales> + </div> + + + </td> + </tr> +</table> + + + </td> + + <!-- 2. Spalte --> + <td valign="top"> + <!-- oberer Banner --> + + <div class="heiseadvert"> + <heiseadvert> <table border="0"> + <tr> + <td valign="middle" align="left" nowrap> + <table cellpadding="2" cellspacing="0" border="0"> + <tr> + + <td><!--OAS AD="TopLeft"--> +<!-- www.heise.de/Homepage@TopLeft --></td> + <td><!--OAS AD="Top1"--> +<a href="http://www.heise.de/RealMedia/ads/click_lx.ads/www.heise.de/Homepage/636253534/Top1/468-eigen-he-bei-he/607246/63306138316532363432323633633930" target="_blank"><img src="http://www.heise.de/RealMedia/ads/adstream_lx.ads/www.heise.de/Homepage/636253534/Top1/468-eigen-he-bei-he/607246/63306138316532363432323633633930" WIDTH=468 HEIGHT=60 alt="" border="0" ></A></td> + <td><!--OAS AD="TopRight"--> +<!-- www.heise.de/Homepage@TopRight --></td> + <td><!--OAS AD="Middle"--> +<a href="http://www.heise.de/RealMedia/ads/click_lx.ads/www.heise.de/Homepage/528579572/Middle/1x1-bei-he-zaehler-hp/zaehler.gif/63306138316532363432323633633930" target="_blank"><img src="http://www.heise.de/RealMedia/ads/Creatives/1x1-bei-he-zaehler-hp/zaehler.gif" WIDTH=1 HEIGHT=1 alt="" border="0"></A><img src="http://www.heise.de/RealMedia/ads/adstream_lx.ads/www.heise.de/Homepage/528579572/Middle/1x1-bei-he-zaehler-hp/zaehler.gif/63306138316532363432323633633930?_RM_EMPTY_" width="1" height="1"></td> + </tr> + </table> + </td> + </tr> + </table> +</heiseadvert> + </div> + <!-- Mittelteil --> + <table border="0" cellspacing="0" cellpadding="0" width="100%"> + <tr class="druck"> + <td width="13" class="rand_oben"><img src="/icons/ho/1pix.gif" width="1" height="1" hspace="6" alt=""></td> + <td width="100%" class="rand_oben"><img src="/icons/ho/1pix.gif" width="1" height="1" hspace="200" alt=""></td> + <td width="7" class="rand_oben"><img src="/icons/ho/1pix.gif" width="1" height="1" hspace="3" alt=""></td> + <td class="rand_oben2"><img src="/icons/ho/1pix.gif" width="1" height="1" hspace="70" alt=""></td> + <td width="7" class="rund"><img src="/icons/ho/1pix.gif" width="1" height="1" hspace="3" alt="" vspace="5"></td> + <td width="1" valign="top" rowspan="2"> + + <div class="skyscraper"> + <skyscraper><table border="0"> + <tr align="center"> + + <td><!--OAS AD="Left1"--> +<!-- www.heise.de/Homepage@Left1 --></td> + </tr> +</table> +</skyscraper> + </div> + </td> + </tr> + <tr> + <td class="druck"></td> + <td width="100%" valign="top"> + + <HEISETEXT> + + + + +<!-- Logo --> +<table border="0" cellspacing="0" cellpadding="0" width="100%"> + <tr> + <td width="120"><a href="/newsticker/"><img src="/icons/ho/news_logo.gif" alt="news" width="120" height="30" border="0"></a></td> + +<!-- *** tmpl *** --> + <td width="100%" nowrap valign="bottom"><b class="size120">Meldungen des Tages</b></td> + <td align="right" valign="bottom">02.03.2005</td> + + </tr> +</table> + + +<!-- Liste der Meldungen --> +<h3 class="anriss"><span class="cebit">CeBIT</span><span class="unsichtbar">:</span> <a href="/newsticker/meldung/57004">TU Chemnitz zeigt Fernsteuerung via Handy und Bluetooth</a></h3> +<p>Messebesucher sollen am mitteldeutschen Gemeinschaftsstand ohne Modifikationen mit ihrem eigenen bluetooth-fähigen Handy ein Modellauto fernsteuern können. <a href="/newsticker/meldung/57004">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/57003">Gartner: Wachstum des Handy-Marktes verlangsamt sich deutlich</a></h3> +<p>Die Marktforscher rechnen 2005 mit einem Wachstum von 8,3 Prozent für den weltweiten Handy-Markt nach einem Plus von 30 Prozent im vorigen Jahr. <a href="/newsticker/meldung/57003">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/57002">DeNIC sieht ENUM als marktreif an</a></h3> +<p>Nach einer mehr als zwei Jahre dauernden Testphase will die Domainregistrierungsstelle Telefonnummern-Domains nun möglichst schnell auf den Markt bringen. <a href="/newsticker/meldung/57002">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/57001">Microsoft sieht Erfolge bei der E-Mail-Authentifizierung</a></h3> +<p>Der Einsatz des Sender ID Framework zur Verifizierung von E-Mail-Absendern hat sich nach Angaben der Redmonder in den vergangenen zwei Monaten bewährt. <a href="/newsticker/meldung/57001">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/57000">Kopiergeschützte Videoausgänge für Desktop-PCs und Notebooks</a></h3> +<p>Silicon Image hat die nach eigenen Angaben ersten Transmitter angekündigt, die die Ausstattung kommender Grafikkarten und Mainboards mit dem High-Definition Multimedia Interface (HDMI) ermöglichen. <a href="/newsticker/meldung/57000">mehr...</a></p> +<h3 class="anriss"><span class="cebit">CeBIT</span><span class="unsichtbar">:</span> <a href="/newsticker/meldung/56994">Jamba startet Musik-Downloadportal</a></h3> +<p>Jeder Song aus dem Portal des bislang vor allem für Klingelton- und Handyspiele-Abos bekannten Anbieters soll ein bis zwei Euro kosten. <a href="/newsticker/meldung/56994">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56992">Philips kündigt rollbares 5&quot;-Display an.</a></h3> +<p>Philips Polymer Vison kündigt das einrollbare 5&quot;-Display PV-QML5 auf Grundlage der E-Ink-Technik für E-Books oder elektronische Landkarten an. <a href="/newsticker/meldung/56992">mehr...</a></p> +<h3 class="anriss"><span class="cebit">CeBIT</span><span class="unsichtbar">:</span> <a href="/newsticker/meldung/56993">600-Watt-ATX-Netzteil für PCs mit zwei SLI-Grafikkarten</a></h3> +<p>Das ST65ZF aus der Zeus-Baureihe soll sekundärseitig 650 Watt und kurzzeitig bis zu 710 Watt liefern. <a href="/newsticker/meldung/56993">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56990">Intershop-Aktionäre verlieren Geld</a></h3> +<p>Der Vorstand will auf einer Aktionärsversammlung die Zusammenlegung von drei zu einer Inhaberstammaktie beschließen lassen. <a href="/newsticker/meldung/56990">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56989">Studie: Media Markt und Saturn schufen die meisten Jobs</a></h3> +<p>Die Elektronikmärkte des Handelskonzerns Metro waren laut einer Umfrage im vergangenen Jahr für 2585 neue Stellen in Deutschland verantwortlich. <a href="/newsticker/meldung/56989">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56988">Pro Sieben sendet Kinofilme in HDTV</a></h3> +<p>Der Münchener Privatsender will im März und April gleich vier Kino-Blockbuster und eine BBC-Dokumentation über ASTRA 1F in High Definition ausstrahlen. <a href="/newsticker/meldung/56988">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56986">Zweite Beta von Opera 8 für Linux erhältlich</a></h3> +<p>Einige Tage nach der Windows-Version hat der norwegische Browser-Hersteller Opera Software ASA nun auch die zweite Beta des Webbrowsers Opera 8 für Linux und Solaris vorgestellt. <a href="/newsticker/meldung/56986">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56982">Streit um Kontrolle der polnischen Telco PTC eskaliert</a></h3> +<p>Während die französische Vivendi der Deutschen Telekom und der Elektrim Rechtsbruch vorwirft, hindern Bodyguards die neuen Vorstände am Betreten ihres Warschauer Arbeitsplatzes. + <a href="/newsticker/meldung/56982">mehr...</a></p> +<h3 class="anriss"><span class="cebit">CeBIT</span><span class="unsichtbar">:</span> <a href="/newsticker/meldung/56979">Erstes Heise-Forum Sicherheit und IT-Recht</a></h3> +<p>Der Heise Zeitschriften Verlag bietet eine eigene Veranstaltungsreihe mit täglichen Informationsveranstaltungen auf dem Heise-Messestand. <a href="/newsticker/meldung/56979">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56981">Bill Gates zum Ritter geschlagen</a></h3> +<p>Königin Elisabeth II. hat den Microsoft-Gründer heute zum Knight Commander of the Most Excellent Order of the British Empire ernannt. <a href="/newsticker/meldung/56981">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56980">Versatel Deutschland verdoppelt Gewinn und führt neue DSL-Flatrate ein</a></h3> +<p>Die Telefongesellschaft Versatel hat Umsatz und Gewinn in Deutschland im vergangenen Jahr kräftig gesteigert. Mit einer neuen sechs Megabit schnellen DSL-Flatrate möchte der Konzern seine Marktposition weiter ausbauen. <a href="/newsticker/meldung/56980">mehr...</a></p> +<h3 class="anriss"><span class="cebit">CeBIT</span><span class="unsichtbar">:</span> <a href="/newsticker/meldung/56974">Gateway-Linux geschenkt</a></h3> +<p>Auf der Messe stellt die Freiburger Firma Pyramid eine neue Version der Betriebssoftware ihrer Ben Hur genannten Gateway- und Server-Geräte vor -- und verschenkt sie an Privatanwender. <a href="/newsticker/meldung/56974">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56976">Gericht bestätigt Störerhaftung des Admin-C</a></h3> +<p>In einem Berufungsurteil bestätigte das Landgericht Bonn die grundsätzliche Haftung des bei einer de-Domain eigetragenen &quot;Admin-C&quot; für die unter der Domain abrufbaren Inhalte. <a href="/newsticker/meldung/56976">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56977">Juchhu!, Yahoo!: 10</a></h3> +<p>Am 2. März 1995 wurde aus dem 1994 gestarteten Studentenprojekt &quot;Jerry Yang's Guide to the WWW&quot; eine richtige Firma, eingetragen als Aktiengesellschaft. <a href="/newsticker/meldung/56977">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56973">Altnet schlägt Filesharing-Finanzierungsmodell vor</a></h3> +<p>Der Anbieter von Bezahlinhalten in Tauschbörsen regt an, dass auf Filesharing-Plattformen erzielte Werbeeinnahmen mit Musiklabels geteilt werden. <a href="/newsticker/meldung/56973">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56970">IDF: Bessere Fernwartung und schnellere I/O Kommunikation</a></h3> +<p>Embedded IT für gesündere Computer und niedrigere Kosten: Neue Funktionen sollen in Intels Chips eingebaut werden und so eine effektivere Steuerung und Überwachung des Rechner auch aus der Ferne ermöglichen. <a href="/newsticker/meldung/56970">mehr...</a></p> +<h3 class="anriss"><span class="cebit">CeBIT</span><span class="unsichtbar">:</span> <a href="/newsticker/meldung/56972">Microsoft und CA starten Sicherheitscheck zur CeBIT</a></h3> +<p>Anwender können im Rahmen der Sicherheits-Tour kostenlos die Sicherheit ihres Laptops oder Desktops prüfen lassen. Erstmalig finden die Tests parallel zur CeBIT vom 12. bis 16.3. in Hannover statt. <a href="/newsticker/meldung/56972">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56969">IT-Verbände unterstützen Online-Tauschbörsen</a></h3> +<p>Die Computer & Communications Industry Association und andere Organisationen sehen in der Klage der Unterhaltungsindustrie gegen Grokster und Streamcast den Versuch, die Entwicklung technologischer Innovationen zu bremsen. <a href="/newsticker/meldung/56969">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56968">T-Online setzt auf Voice-Over-IP</a></h3> +<p>Im laufenden Jahr erwartet T-Online aufgrund von Investitionen in neue Techniken wieder einen niedrigeren Gewinn; erstmals steht mit einem Nettogewinn in Höhe von 300,4 Millionen Euro für 2004 unter dem Strich eine schwarze Zahl. <a href="/newsticker/meldung/56968">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56966">Neue Patentklagen gegen Infineon</a></h3> +<p>Das auf IC-Gehäuse spezialisierte Unternehmen Tessera meint, die DRAM-Chip-Hersteller Infineon und Micron hätten Patente für Chip-Packages verletzt. <a href="/newsticker/meldung/56966">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56964">Carly Fiorina als künftige Weltbank-Chefin gehandelt</a></h3> +<p>Die ehemalige HP-Top-Managerin habe gute Chancen, die Nachfolge von James Wolfensohn anzutreten, heißt es in amerikanischen Regierungskreisen. <a href="/newsticker/meldung/56964">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56954">Buffer Overflows im RealPlayer</a></h3> +<p>Es wurden mehrere Pufferüberläufe in fast allen aktuellen Versionen des RealPlayers gemeldet, mit denen Angreifer Schadprogramme auf ein System schleusen können. <a href="/newsticker/meldung/56954">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56967">Kritik an IT-Projekt Herkules der Bundeswehr nach Ausstieg von T-Systems</a></h3> +<p>Herkules soll die Bundeswehr-IT nicht nur modernisieren, sondern deren Management auch in private Hände legen. <a href="/newsticker/meldung/56967">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56965">Internetzugang bei Hansenet in Hamburg gestört</a></h3> +<p>Hansenet kämpft seit gestern abend offenbar mit massiven Zugangsstörungen wegen Problemen bei der Authentifizierung in Hamburg und Umgebung; mittlerweile sei das Problem behoben, die Situation sollte sich absehbar wieder entspannen. <a href="/newsticker/meldung/56965">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56962">Hitachi-Festplattentools mit neuen Features</a></h3> +<p>Hitachi bietet neue Versionen seiner Festplattendiagnose- und Laufwerkskonfigurationstools zum Download an. <a href="/newsticker/meldung/56962">mehr...</a></p> +<h3 class="anriss"><span class="cebit">CeBIT</span><span class="unsichtbar">:</span> <a href="/newsticker/meldung/56961">T-Mobile führt HSDPA unter Live-Bedingungen vor</a></h3> +<p>Diese Woche präsentierte der Netzbetreiber den UMTS-Turbo: Beim Empfang aus einem fahrenden Auto wurden Bandbreiten von über 1 MBit/s erreicht. <a href="/newsticker/meldung/56961">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56963">Siemens vor Teillösung für SBS, aber kein Durchbruch bei Handysparte</a></h3> +<p>Der Siemens-Konzern kommt bei seinen Problem-Bereichen nur in kleinen Schritten voran. <a href="/newsticker/meldung/56963">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56957">Externer DivX-Videorecorder mit USB 2.0 für den Mac</a></h3> +<p>Miglia Technology hat einen externen TV-Empfänger mit USB 2.0 für Macs angekündigt, der hardwareunterstützt in MPEG-1, MPEG-2 und MPEG-4 (DivX) aufzeichnet. <a href="/newsticker/meldung/56957">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56959">Elektronische Rechnungen nur mit digitaler Signatur</a></h3> +<p>Elektronisch übermittelte Rechnungen sind nur mit einer qualifizierten digitalen +Signatur rechtlich und steuerlich gültig, berichtet iX in der aktuellen Ausgabe. <a href="/newsticker/meldung/56959">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56960">Erneuter leichter Rückgang der Preise für Telekommunikation</a></h3> +<p>Einen Rückgang der Preise für Telekommunikationsdienstleistungen von 0,7 Prozent verzeichnete das Statistische Bundesamt im Februar gegenüber dem Vorjahr. <a href="/newsticker/meldung/56960">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56956">Mailüfterl-Konstrukteur Zemanek in Wien geehrt</a></h3> +<p>Am gestrigen Dienstag wurde in Wien ein Festakt zu Ehren des 85. Geburtstags vom Konstrukteur des ersten vollständig transistorisierten, binärdezimalen Computers auf dem europäischen Festland begangen. <a href="/newsticker/meldung/56956">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56955">Weitere Details zu gestopften Sicherheitslöchern in Firefox und Mozilla</a></h3> +<p>Mit der Veröffentlichung von Firefox 1.0.1 haben die Entwickler auch eine Übersicht der beseitigten Sicherheitslücken herausgegeben. Einige davon finden sich auch in der aktuellen Mozilla-Version. <a href="/newsticker/meldung/56955">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56952">Patentstreit: Neue Schlappe für Rambus beim zweiten Versuch gegen Infineon</a></h3> +<p>Eine neue Runde des im Jahre 2000 in Virginia begonnenen Rechtsstreits zwischen Rambus und Infineon endete vorerst mit einer Rambus-Niederlage. <a href="/newsticker/meldung/56952">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56948">Linux-Kernel 2.6.11 veröffentlicht</a></h3> +<p>Die neue stabile Linux-Kernel-Version 2.6.11 des Linux-Kernels stopft in letzter Zeit bekannt gewordene Sicherheitslücken, unterstützt neue Hardware-Techniken und führt einige Erweiterungen ein. <a href="/newsticker/meldung/56948">mehr...</a></p> +<h3 class="anriss"><span class="cebit">CeBIT</span><span class="unsichtbar">:</span> <a href="/newsticker/meldung/56953">Sun zeigt 3D-Desktop Looking Glass</a></h3> +<p>Sun will auf der CeBIT neben StarOffice, Solaris 10 und einigen Systemen mit AMD Opteron auch das Java Desktop System mit der experimentellen 3D-Oberfläche Looking Glass präsentieren. <a href="/newsticker/meldung/56953">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56949">IDF: Pentium D und viele, viele andere Mehrkern-CPUs</a></h3> +<p>Solch ein Feuerwerk neuer Prozessoren, Plattformen, Chipsätze und Namen wie in diesem Frühjahr gab es auf Intels Entwicklerkonferenz IDF wohl noch nie. Und IDF-Erfinder Pat Gelsinger gab das Motto &quot;Move to 64 Bit, now!&quot; aus. <a href="/newsticker/meldung/56949">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56951">Symbian will Allianz gegen Microsoft schmieden</a></h3> +<p>CEO Levin selbst wird sich in diese Allianz indes nicht mehr stark einbringen: Er wird den Konzern im April verlassen. <a href="/newsticker/meldung/56951">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56950">Kompetenzen-Umverteilung bei SAP stellt Frage nach Kagermanns Zukunft</a></h3> +<p>Der neue starke Mann bei dem Weltmarktführer für Unternehmenssoftware könnte bald Vorstandsmitglied Shai Agassi werden. Der 36-Jährige übernimmt von SAP-Chef Henning Kagermann die Produktentwicklung bei SAP. <a href="/newsticker/meldung/56950">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56946">IDF: Frisierte Autos und sparsame Gesten</a></h3> +<p>In seiner Keynote-Präsentation auf dem IDF führte Intel-Chef Craig Barrett einige ungewöhnliche Anwendungsbeispiele für PCs vor. <a href="/newsticker/meldung/56946">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56947">Berufsverbot für Anwalt von Internet-Autoren in China angedroht</a></h3> +<p>Chinesische Behörden haben einem Anwalt, der Internet-Autoren und Journalisten vor Gericht verteidigt, mit einem einjährigen Berufsverbot gedroht. <a href="/newsticker/meldung/56947">mehr...</a></p> +<h3 class="anriss"> <a href="/newsticker/meldung/56945">Craig Barrett zum Abschied: Langweilt Eure Kinder nicht!</a></h3> +<p>Die Keynote zum Auftakt des IDF hat der bisherige Intel-Chef Craig Barrett auch als Abschiedsrede an die Entwickler genutzt. Er hofft, dass der Konzern weiter auf den bewährten Technologiepfaden der Halbleiterphysik wandeln werde. <a href="/newsticker/meldung/56945">mehr...</a></p> + + +<!-- &Uuml;berblick --> +<h4 align="right"> +Weitere Meldungen im News-<a href="/newsticker/" class="weitere">&Uuml;berblick</a> +</h4> + + +<!-- Newstipps --> +<p align="right" class="size80"> +Fehlt eine wichtige Nachricht? Geben Sie uns <a href="mailto:newstips@heise.de" class="weitere">Bescheid</a>! +</p> + + +<img src="/icons/ho/00on.gif" border="0" width="1" height="1" alt=""> +<noscript> +<img src="/icons/ho/00off.gif" border="0" width="1" height="1" alt=""> +</noscript> + + + </HEISETEXT> + + <div class="adbottom"> + <bottom><table align="center" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td><!--OAS AD="Bottom"--> +<!-- www.heise.de/Homepage@Bottom --></td> + </tr> +</table> +</bottom> + </div> + </td> + <td class="druck"></td> + <td valign="top" colspan="2" class="druck"> + <!-- Kaesten --> + + <table border="0" cellspacing="0" cellpadding="0" width="100%" class="rand_rechts"> + <tr> + <td> + + <!-- START+7TAGE --> + + <div class="teaser"><p><b><span class="teaser_cebit">CeBIT</span>&nbsp;special</b><br><span class="size80">Evolution statt Revolution</span><br><b><a href="/cebit/highlights/allgemein/2005/ausblick05/">Ausblick auf die CeBIT 2005</a></b><br></p></div> + + + + + + + + + + + <!-- ALLE ANDEREN --> + + <div class="teaser"> + + + +<!-- Reihenfolge fuer Mittwoch --> + + <p> <a href="/ix/artikel/2005/04/140/"><img src="/ix/artikel/2005/04/140/aufmacher_ho.jpg" alt="" border="0" vspace="8" width="119" height="90"></a><br> <b class="size80">iX&nbsp;4/2005:</b><br> <a href="/ix/artikel/2005/04/140/"><b>IPv6-Tutorial</b></a><br> <span class="size80">Services, Dual Stacks und das „Internet6“</span></p> + + + + + <p> + <a href="/tr/labor/"><img src="/bilder/56595/102/0" alt="" border="0" vspace="8"></a><br> + <b class="size80">Technology Review</b><br> + <a href="/tr/labor/"><b>Krebs früher erkennen</b></a><br> + <span class="size80">Winzige Drähte sollen Tumore entlarven</span> + </p> + + + + + <p> + <a href="/mobil/artikel/56596"><img src="/bilder/56596/102/0" alt="" border="0" vspace="8"></a><br> + <b class="size80">heise mobil</b><br> + <a href="/mobil/artikel/56596"><b>Kabel kappen</b></a><br> + <span class="size80">Neue Funktechniken auf dem Vormarsch +</span> + </p> + + + +<p> +<a href="/ct/#1"><img src="/ct/05/05/156/aufmacher_ho.jpg" alt="c't-Aufmacher" border="0" vspace="8" width="69" height="100"></a><br> +<b class="size80">c't 5/2005:</b><br> +<a href="/ct/#1"><b>Download statt Un-CDs</b></a><br> +<span class="size80">Hier ist kopieren noch erlaubt</span></p> +<p> +<a href="/tp/default.html"><img src="/tp/r4/icons/heise/magazin.gif" border="0" vspace="8"></a><br> +<a href="/tp/r4/artikel/19/19557/1.html"><b>Der neudeutsche Pop-Messias</b></a><br> +<span class="size80">Adam Green albert durch ausverkaufte Konzerthallen</span> +</p> + + + + </div> + + + + <!-- NEWSBEREICH, NICHT MELDUNG --> + +<h4 class="kasten_news_titel">Top-Meldungen</h4> + + + + + <p class="kasten_news"> + <a href="/newsticker/meldung/56923">Knoppix 3.8 kommt zur CeBIT</a> + </p> + + <p class="kasten_news"> + <a href="/newsticker/meldung/56936">Softwarepatente: Das riskante Spiel der EU-Kommission</a> + </p> + + <p class="kasten_news"> + <a href="/newsticker/meldung/56858">FOSDEM: Open Source und die Rückkehr zum Einfachen</a> + </p> + + <p class="kasten_news"> + <a href="/newsticker/meldung/56856">Free Software Foundation Europe startet Fellowship-Programm</a> + </p> + + + + + </td> + </tr> +</table> + + + </td> + </tr> + </table> + </td> + </tr> +</table> + +<!-- IVW-Pixel --> + +<img src="/ivw-bin/ivw/CP/" width="1" height="1"> +<img src="http://heise.ivwbox.de/cgi-bin/ivw/CP/homepage;/?r=" width="1" height="1"> + + +<br> +<table border="0" cellspacing="0" cellpadding="0" width="100%"> + <tr> + <td bgcolor="#999999"><img src="/icons/ho/1pix.gif" width="1" height="1" hspace="375" alt=""></td> + </tr> + + <tr> + <td bgcolor="#eeeeee"> + + <table cellpadding="2" cellspacing="2" border="0" width="100%"> + + <tr> + <td><span class="navi_unten">Copyright&nbsp;&copy;&nbsp;2005&nbsp;</span><a href="http://www.heise-medien.de/zeitschriften/" target="_blank" class="navi_unten">Heise&nbsp;Zeitschriften&nbsp;Verlag</a></td> + <td align="right" nowrap> + <div class="druck"> + + <a href="/privacy/" class="navi_unten">Datenschutzhinweis</a>&nbsp;&nbsp; + <a href="/kontakt/impressum.shtml" class="navi_unten">Impressum</a>&nbsp;&nbsp; + <a href="/kontakt/" class="navi_unten">Kontakt</a>&nbsp;&nbsp;&nbsp;&nbsp; + + <span class="navi_unten">Hosted by </span><a href="http://www.plusline.de" class="navi_unten" target="_blank">Plus.line</a> + </div> + </td> + </tr> + + </table> + + </td> + </tr> + +</table> + +</body> +</html> + diff --git a/test.xml b/test.xml @@ -0,0 +1,3 @@ +<a> + <b>test :</b> +</a> diff --git a/test_read.c b/test_read.c @@ -0,0 +1,73 @@ +/* + * Copy me if you can. + * by 20h + */ + +#ifndef PLAN9 +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> +#endif +#ifdef PLAN9 +#include <u.h> +#include <libc.h> +#endif +#include "xmlpull.h" + +void +main(int argc, char *argv[]) +{ + xmlpull *ret, *b; + int fd; + + if(argc < 2){ + print("usage: filename\n"); + exits(0); + } + + fd = open(argv[1], +#ifndef PLAN9 + O_RDONLY); +#endif +#ifdef PLAN9 + OREAD); +#endif + if(fd < 0){ + perror("open"); + exits(0); + } + + ret = openxmlpull(fd); + while((b = nextxmlpull(ret)) != nil){ + switch(b->ev){ + case START_DOCUMENT: + print("Document started.\n"); + break; + case START_TAG: + print("Tag starts: %s\n", b->na); + break; + case START_END_TAG: + print("Startend tag: %s\n", b->na); + break; + case TEXT: + print("Text: %s\n", b->na); + break; + case ATTR: + print("Attr: %s=%s\n", b->na, (b->va == nil) ? "none" : b->va); + break; + case END_TAG: + print("Tag ends: %s\n", b->na); + break; + case END_DOCUMENT: + print("Document ends.\n"); + break; + default: + print("Undocumented: %x\n", b->ev); + break; + } + } + + freexmlpull(ret); + exits(0); +} + diff --git a/test_read.xml b/test_read.xml @@ -0,0 +1,19 @@ +<?xml wdnwodnw="wndownd"?> +<root a="wd wd" b='wdm>'> + <inner_1> + <inner_2> + wdnwodnw + </inner_2> + wdnwodnw + <![CDATA[ ]]> + <inner_3/> + ndoendiebfiebf + <!-- wdnwdnw --> + <inner_4 /> + <inner_5 awdnwdn="qwdnown"/> + </inner_1> +</root> +<root2> + <testing> + </testing> +</root2>+ \ No newline at end of file diff --git a/test_write.c b/test_write.c @@ -0,0 +1,156 @@ +/* + * Copy me if you can. + * by 20h + */ + +#ifndef PLAN9 +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> +#endif +#ifdef PLAN9 +#include <u.h> +#include <libc.h> +#endif +#include "xmlpull.h" + +int +main(int argc, char *argv[]) +{ + xmlpull *ret; + int fd; + + if(argc < 2){ + print("usage: filename\n"); + exits(0); + } + + fd = open(argv[1], +#ifndef PLAN9 + O_WRONLY); +#endif +#ifdef PLAN9 + OWRITE); +#endif + if(fd < 0){ + perror("open"); + exits(0); + } + + ret = openxmlpull(fd); + + ret->nev = START_DOCUMENT; + if(writexmlpull(ret) == nil) + goto end_main; + + ret->nev = START_TAG; + ret->na = "message"; + ret->ln = 7; + if(writexmlpull(ret) == nil) + goto end_main; + + ret->nev = ATTR; + ret->na = "to"; + ret->ln = 2; + ret->va = "user"; + ret->lv = 4; + if(writexmlpull(ret) == nil) + goto end_main; + + ret->nev = ATTR; + ret->na = "from"; + ret->ln = 4; + ret->va = "programmer"; + ret->lv = 10; + if(writexmlpull(ret) == nil) + goto end_main; + + ret->nev = END_TAG_N; + if(writexmlpull(ret) == nil) + goto end_main; + + if(write(ret->fd, "\n", 1) < 0) + goto end_main; + + ret->nev = START_TAG; + ret->na = "value"; + ret->ln = 5; + if(writexmlpull(ret) == nil) + goto end_main; + + if(write(ret->fd, "\n", 1) < 0) + goto end_main; + + ret->nev = END_TAG_N; + if(writexmlpull(ret) == nil) + goto end_main; + + ret->nev = START_TAG; + ret->na = "!--"; + ret->ln = 3; + if(writexmlpull(ret) == nil) + goto end_main; + + ret->nev = TEXT_C; + ret->na = "Here comes the message."; + ret->ln = 23; + if(writexmlpull(ret) == nil) + goto end_main; + + if(write(ret->fd, "\n", 1) < 0) + goto end_main; + + ret->nev = TEXT; + ret->na = "Thank you for using Libxmlpull.\n"; + ret->ln = 32; + if(writexmlpull(ret) == nil) + goto end_main; + + ret->nev = END_TAG; + ret->na = "value"; + ret->ln = 5; + if(writexmlpull(ret) == nil) + goto end_main; + + if(write(ret->fd, "\n", 1) < 0) + goto end_main; + + ret->nev = START_TAG; + ret->na = "attachments"; + ret->ln = 11; + if(writexmlpull(ret) == nil) + goto end_main; + + ret->nev = ATTR; + ret->na = "num"; + ret->ln = 3; + ret->va = "0"; + ret->lv = 1; + if(writexmlpull(ret) == nil) + goto end_main; + + ret->nev = END_TAG_S; + if(writexmlpull(ret) == nil) + goto end_main; + + if(write(ret->fd, "\n", 1) < 0) + goto end_main; + + ret->nev = END_TAG; + ret->na = "message"; + ret->ln = 7; + if(writexmlpull(ret) == nil) + goto end_main; + + if(write(ret->fd, "\n", 1) < 0) + goto end_main; + + ret->nev = END_DOCUMENT; + if(writexmlpull(ret) == nil) + goto end_main; + +end_main: + free(ret); + exits(0); +} + diff --git a/test_write.xml b/test_write.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<message to="user" from="programmer" > +<value +><!-- Here comes the message. --> +Thank you for using Libxmlpull. +</value> +<attachments num="0" /> +</message> diff --git a/xmlpull.c b/xmlpull.c @@ -0,0 +1,462 @@ +/* + * Copy me if you can. + * by 20h + */ + +#ifndef PLAN9 +#include <stdio.h> +#include <stdlib.h> +#include <fcntl.h> +#include <string.h> +#endif +#ifdef PLAN9 +#include <u.h> +#include <libc.h> +#endif +#include "xmlpull.h" + +void * +reallocp(void *p, int s, short d) +{ + + p = realloc(p, s); + if(p == nil) { + perror("realloc"); + exits("realloc"); + } + + if(d != 0) + memset(p, 0, s); + + return (void *)p; +} + +void +freexmlpull(xmlpull *x) +{ + if(x != nil){ + if(x->na != nil) + free(x->na); + if(x->va != nil) + free(x->va); + free(x); + } + + return; +} + +xmlpull * +openxmlpull(int fd) +{ + xmlpull *ret; + + ret = reallocp(nil, sizeof(xmlpull), 2); + ret->na = nil; + ret->va = nil; + ret->lm = nil; + ret->ln = 0; + ret->lv = 0; + ret->la = 0; + ret->ev = START_DOCUMENT; + ret->nev = START_DOCUMENT; + ret->fd = fd; + + return ret; +} + +char +getchara(xmlpull *x) +{ + char g; + + if(read(x->fd, &g, 1) <= 0){ + x->ev = END_DOCUMENT; + return (char)0; + } + + return g; +} + +char * +addchara(char *b, int *l, char c) +{ + b = reallocp(b, ++(*l) + 1, 0); + b[(*l) - 1] = c; + b[*l] = '\0'; + + return b; +} + +char * +readuntilstr(xmlpull *x, char *str) +{ + char g, *u; + int p; + + u = reallocp(nil, strlen(str) + 1, 2); + p = 0; + + while((g = getchara(x)) != 0) { + u[p++] = g; + if(p < strlen(str)) + continue; + if(!strncmp(u, str, strlen(str))) { + free(u); + return x->na; + } + p--; + + x->na = addchara(x->na, &x->ln, u[0]); + memmove(u, u + 1, strlen(str) - 1); + } + free(u); + + return nil; +} + +char * +readuntil(xmlpull *x, char *b, int *l, char w, char t) +{ + char g; + + while((g = getchara(x)) != 0) { + //print("||%c>%c||", g, w); + if(g == w){ + b = addchara(b, l, '\0'); + return b; + } + + switch(g) { + case '/': + case '>': + if(t != 0) { + addchara(b, l, g); + return nil; + } + case '\t': + case '\r': + case '\n': + case ' ': + if(t != 0) + return b; + b = addchara(b, l, g); + break; + case '\\': + g = getchara(x); + //print("%c", g); + if(g == 0) + return nil; + b = addchara(b, l, g); + break; + default: + b = addchara(b, l, g); + break; + } + } + + return nil; +} + +char * +parseattrib(xmlpull *x) +{ + char g, *b; + + while((g = getchara(x)) != 0) { + //print("%c", g); + switch(g){ + case '\t': + case '\r': + case '\n': + case ' ': + continue; + case '/': + case '>': + x->na = addchara(x->na, &x->ln, g); + return nil; + default: + x->na = addchara(x->na, &x->ln, g); + g = (char)0; + } + if(g == (char)0) + break; + } + + if((b = readuntil(x, x->na, &x->ln, '=', 2)) == nil) + return nil; + x->na = b; + + if((g = getchara(x)) == 0) + return nil; + + //print("magic char: %c\n", g); + switch(g) { + case '"': + case '\'': + if((b = readuntil(x, x->va, &x->lv, g, 0)) == nil) + return nil; + x->va = b; + return x->va; + default: + if((b = readuntil(x, x->va, &x->lv, '>', 2)) == nil) + return nil; + x->va = b; + return x->na; + } + + return x->na; +} + +char * +readname(xmlpull *x) +{ + char g; + + while((g = getchara(x)) != 0){ + //print("%c", g); + switch(g){ + case '\n': + case '\t': + case '\r': + case ' ': + case '>': + case '/': + x->na = addchara(x->na, &x->ln, g); + return x->na; + default: + x->na = addchara(x->na, &x->ln, g); + } + } + + return nil; +} + +xmlpull * +nextxmlpull(xmlpull *x) +{ + char g; + + if(x->va != nil) + free(x->va); + + if(x->ev == START_TAG){ + if(x->lm != nil) + free(x->lm); + x->lm = x->na; + x->la = x->ln; + } else + if(x->na != nil) + free(x->na); + + x->na = nil; + x->va = nil; + x->ln = 0; + x->lv = 0; + g = '\0'; + + switch(x->nev){ + case START_DOCUMENT: + if((x->na = readuntil(x, x->na, &x->ln, '<', 0)) == nil) + x->nev = END_DOCUMENT; + else + x->nev = START_TAG; + x->ev = START_DOCUMENT; + break; + case START_TAG: + g = getchara(x); + //print("%c", g); + if(g == '/') + x->ev = END_TAG; + else { + x->na = addchara(x->na, &x->ln, g); + x->ev = START_TAG; + } + + if(readname(x) == nil) + x->nev = END_DOCUMENT; + else { + if(!strncmp(x->na, "![CDATA[", 8)) { + memmove(x->na, x->na + 8, strlen(x->na) - 8); + x->ln -= 8; + x->na = readuntilstr(x, "]]>"); + x->ev = TEXT; + x->nev = TEXT; + return x; + } + if(!strncmp(x->na, "!--", 3)) { + x->na[x->ln - 1] = '\0'; + x->nev = TEXT_C; + return x; + } + if(x->ev == END_TAG){ + x->na[x->ln - 1] = '\0'; + x->nev = TEXT; + } else { + switch(x->na[x->ln - 1]){ + case '/': + getchara(x); + x->ev = START_END_TAG; + x->nev = TEXT; + x->na[x->ln - 1] = '\0'; + break; + case '>': + x->nev = TEXT; + x->na[x->ln - 1] = '\0'; + break; + default: + x->na[x->ln - 1] = '\0'; + x->nev = ATTR; + } + } + } + break; + case TEXT_C: + g = '>'; + case TEXT: + if(g != '>') + g = '<'; + + if((x->na = readuntil(x, x->na, &x->ln, g, 0)) == nil){ + x->ev = END_DOCUMENT; + x->nev = END_DOCUMENT + 1; + } else { + if(x->nev == TEXT_C) + x->nev = TEXT; + else + x->nev = START_TAG; + x->ev = TEXT; + } + break; + case ATTR: + if(parseattrib(x) == nil){ + //print("%c\n", x->na[x->ln - 1]); + switch(x->na[x->ln - 1]){ + case '/': + free(x->na); + x->na = x->lm; + x->ln = x->la; + x->lm = nil; + x->la = 0; + + getchara(x); + x->ev = END_TAG; + x->nev = TEXT; + return x; + case '>': + default: + x->na[x->ln - 1] = '\0'; + } + x->ev = ATTR; + x->nev = TEXT; + return nextxmlpull(x); + } else + x->nev = ATTR; + x->ev = ATTR; + break; + case END_DOCUMENT: + x->ev = END_DOCUMENT; + x->nev = END_DOCUMENT + 1; + break; + default: + return nil; + } + + return x; +} + +xmlpull * +writexmlpull(xmlpull *x) +{ + char *b; + + b = nil; + + switch(x->nev){ + case START_DOCUMENT: + if(write(x->fd, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", 39) < 0) + return nil; + return x; + case START_TAG: + if(x->na == nil) + return nil; + + b = reallocp(b, x->ln + 3, 2); + snprint(b, x->ln + 3, "<%s ", x->na); + if(write(x->fd, b, strlen(b)) < 0){ + free(b); + return nil; + } + free(b); + return x; + case START_END_TAG: + if(x->na == nil) + return nil; + + b = reallocp(b, x->ln + 4, 2); + snprint(b, x->ln + 4, "<%s/>", x->na); + if(write(x->fd, b, strlen(b)) < 0){ + free(b); + return nil; + } + free(b); + return x; + case TEXT: + if(x->na == nil) + return nil; + if(write(x->fd, x->na, x->ln) < 0) + return nil; + return x; + case TEXT_C: + if(x->na == nil) + return nil; + + b = reallocp(b, x->ln + 5, 2); + snprint(b, x->ln + 5, "%s -->", x->na); + if(write(x->fd, b, strlen(b)) < 0){ + free(b); + return nil; + } + free(b); + return x; + case ATTR: + if(x->na == nil) + return nil; + + b = reallocp(b, x->ln + x->lv + 5, 2); + snprint(b, x->ln + x->lv + 5, "%s=\"%s\" ", x->na, (x->va == nil) ? "" : x->va); + if(write(x->fd, b, strlen(b)) < 0){ + free(b); + return nil; + } + free(b); + return x; + case END_TAG: + if(x->na == nil) + return nil; + + b = reallocp(b, x->ln + 4, 2); + snprint(b, x->ln + 4, "</%s>", x->na); + if(write(x->fd, b, strlen(b)) < 0){ + free(b); + return nil; + } + free(b); + return x; + case END_TAG_S: + if(write(x->fd, "/>", 2) < 0) + return nil; + return x; + case END_TAG_N: + if(write(x->fd, ">", 1) < 0) + return nil; + return x; + case END_DOCUMENT: + close(x->fd); + return nil; + default: + break; + } + + return nil; +} + diff --git a/xmlpull.h b/xmlpull.h @@ -0,0 +1,51 @@ +/* + * Copy me if you can. + * by 20h + */ + +#ifdef nil +#pragma lib "libxmlpull.a" +#endif + +#ifndef XMLPULL_H +#define XMLPULL_H + +#ifndef nil +#define nil NULL +#define print printf +#define snprint snprintf +#define exits return +#endif + +enum { + START_DOCUMENT = 0x0, + START_TAG, + START_END_TAG, + TEXT, + TEXT_C, + ATTR, + END_TAG, + END_TAG_S, + END_TAG_N, + END_DOCUMENT, +}; + +typedef struct xmlpull xmlpull; +struct xmlpull { + int fd; + char ev; + char nev; + char *lm; + char *na; + char *va; + int la; + int lv; + int ln; +}; + +void freexmlpull(xmlpull *x); +xmlpull *openxmlpull(int fd); +xmlpull *nextxmlpull(xmlpull *x); +xmlpull *writexmlpull(xmlpull *x); + +#endif diff --git a/xmlpull.man b/xmlpull.man @@ -0,0 +1,98 @@ +.TH XMLPULL 2 +.SH NAME +open_xmlpull, +next_xmlpull, +free_xmlpull \- XML-Pull parser functions +.SH SYNOPSIS +.PP +.EX +.ta 4n +4n +4n +4n +#include <u.h> +#include <xmlpull.h> +.sp +enum { + START_DOCUMENT = 0x0, + START_TAG, + START_END_TAG, + TEXT, + TEXT_C, + ATTR, + END_TAG, + END_TAG_S, + END_TAG_N, + END_DOCUMENT, +}; +.sp +.ta \w' 'u +\w'xmlpull 'u +typedef struct xmlpull xmlpull; +struct xmlpull { + int fd; + char ev; + char nev; + char *lm; + char *na; + char *va; + int la; + int lv; + int ln; +}; +.fi +.de XX +.ift .sp 0.5 +.ifn .sp +.. +.PP +.nf +.ft L +.ta \w'\fLxmlpull* 'u +4n +4n +4n +4n +void freexmlpull(xmlpull *x); +xmlpull *openxmlpull(int fd); +xmlpull *nextxmlpull(xmlpull *x); +xmlpull *writexmlpull(xmlpull *x); +.EE +.SH DESCRIPTION +.PP +Libxmlpull is a library for parsing and writing XML-files. The parsing is +done in the way described on http://www.xmlpull.org, in a more simple way. +On the other side the writing does do XML-pull in the oder direction. +.PP +A parsing session is started by calling +.IR openxmlpull +, with a filedescriptor from which is read until it is manually closed. +It returns the structure xmlpull, holding the state of the actual +session. +.PP +Next the function +.IR nextxmlpull +is constantly called and gives back the +next event found in the read data. +.IR nextxmlpull +returns the changed xmlpull structure with the actual +read event. +.PP +The actual event is saved in xmlpull->ev, the name of the element or +attribute in xmlpull->na and its length in xmlpull->ln. When the event +has the value ATTR, xmlpull->va holds the data of the value of the +attribute and xmlpull->lv its length. The events START_DOCUMENT and +END_DOCUMENT do not have any values. END_TAG_S and END_TAG_N are only +used by +.IR write_elem . +.PP +Writing is done by opening a session with +.IR openxmlpull +and then doing a +.IR writexmlpull +in the other direction like +.IR nextxmlpull . +.PP +When the session is finished, all allocated memory can be freed by calling +.IR freexmlpull . +.PP +.SH FILES +.PP +.B test_read.c (mkfile.read) +example for reading an XML-file.. +.B test_write.c (mkfile.write) +example for writing an XML-file. +.SH SOURCE +.B http://www.r-36.net/xmlpull.tgz