pax_global_header 0000666 0000000 0000000 00000000064 12056370134 0014513 g ustar 00root root 0000000 0000000 52 comment=2069019dc64e7e7da9d5e2999f3625290dabd6a4
php-horde-xml-wbxml-2.0.1/ 0000775 0000000 0000000 00000000000 12056370134 0015326 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/ 0000775 0000000 0000000 00000000000 12056370134 0021014 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/ 0000775 0000000 0000000 00000000000 12056370134 0021561 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/ 0000775 0000000 0000000 00000000000 12056370134 0022622 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/ 0000775 0000000 0000000 00000000000 12056370134 0023362 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/ 0000775 0000000 0000000 00000000000 12056370134 0024453 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/COPYING 0000664 0000000 0000000 00000057646 12056370134 0025530 0 ustar 00root root 0000000 0000000 GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
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 this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser 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 Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples/ 0000775 0000000 0000000 00000000000 12056370134 0026271 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples/MotorolaA780.wbxml 0000664 0000000 0000000 00000002104 12056370134 0031475 0 ustar 00root root 0000000 0000000 ŸQj mlq1.0 rSyncML/1.0 e0307174547 [1 nWhttp://www.genos.es/horde/rpc.php gWIMEI:355884000217404 Vvjove Z L10000 NZ Ssyncml:auth-basic Gb64 OdmpvdmU6dmpvdmU= kFK1 O201 TnWcontacts gWcontacts Z EJ O1 FK2 O201 TnWcalendar gWcalendar Z EJ O1 FK3 O201 TnWtasks gWtasks Z EJ O1 _K4 Z Sapplication/vnd.syncml-devinf+wbxml Gwbxml TgW./devinf10 OÄLŸRj Je1.0 I355884000217404 Kphone G]contacts ZFtext/x-vcard d2.1 bFtext/x-vcard d2.1 _`1 `2 G]calendar ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 _`1 `2 G]tasks ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 _`1 `2 EFtext/x-vcard XBEGIN XN XFN XTEL WHOME WWORK WCELL WFAX WPAGER XADR XBDAY XEMAIL XTITLE XNOTE XORG XURL XEND Ftext/x-vcalendar XBEGIN XDESCRIPTION XDALARM XDTEND XEXDATE XLOCATION XRRULE XDTSTART XSUMMARY XSTATUS XDUE XPRIORITY XTZ XEND SK5 TnW./EstimatedUpdateCount/contacts php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples/devinf.wbxml 0000664 0000000 0000000 00000001375 12056370134 0030625 0 ustar 00root root 0000000 0000000 j-//SYNCML//DTD DevInf 1.0//ENJe1.0 QSynthesis AG USynthesis Sync Client 2.1.0.3 Palm PRO VSynthesis AG ^2.1.0.3 ISySync Client PalmOS PRO Kworkstation G]./events R64 ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 _`1 `2 `3 `4 `5 `6 G]./tasks R64 ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 _`1 `2 `3 `4 `5 `6 G]./notes R64 ZFtext/plain d1.0 bFtext/plain d1.0 _`1 `2 `3 `4 `5 `6 EFtext/x-vcalendar XBEGIN cVCALENDAR cVEVENT cVTODO XEND cVCALENDAR cVEVENT cVTODO XVERSION c1.0 XSUMMARY XCLASS XDESCRIPTION XDTSTART XDTEND XRRULE XEXDATE XAALARM XDALARM XSUMMARY XCLASS XDESCRIPTION XDUE XPRIORITY XSTATUS php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples/k500i_client_0.wbxml 0000664 0000000 0000000 00000000513 12056370134 0031750 0 ustar 00root root 0000000 0000000 j-//SYNCML//DTD SyncML 1.1//ENmlqÃ1.1rÃ
SyncML/1.1eÃ10[Ã1nWÃ#www.daimi.au.dk/~pede/horde/rpc.phpgWÃ354416005739727NZ GÃb64SÃsyncml:auth-basic OÃcGVkZTpoZW1tZWxpZw==Z LÃ2700 kFKÃ1NZ GÃb64SÃsyncml:auth-basic OÃcGVkZTpoZW1tZWxpZw==OÃ201TnWÃcontactsgWÃEriPBDBZ EJÃ0OÃ51 k700i_syncml_client_0.wbxml 0000664 0000000 0000000 00000000420 12056370134 0033255 0 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples j-//SYNCML//DTD SyncML 1.1//ENmlqÃ1.1rÃ
SyncML/1.1eÃ36[Ã1nWÃ!bardsey.demon.co.uk/horde/rpc.phpgWÃ354006002350535Z LÃ2700 kFKÃ1NZ GÃb64SÃsyncml:auth-basic OÃYW5keXdyaWdodDpvbWVnYTI1OÃ200TnWÃnotesgWÃ
EriNotesDBZ EJÃ0OÃ9 syncml_client_packet_1.xml 0000664 0000000 0000000 00000007564 12056370134 0033362 0 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples
1.1
SyncML/1.1
0
1
http://pyramid6.com:8080/sync
AA712857A16E02800
anthony
b64
syncml:auth-md5
amO5sygiWy+nqxA2r0++BA==
10000
4000000
1
application/vnd.syncml-devinf+xml
./devinf11
1.1
Synthesis AG
Synthesis Sync Client 1.1 PocketPC Std
Synthesis AG
2.0.1.9
SySync Client PocketPC Std
workstation
./contacts
64
text/x-vcard
2.1
text/x-vcard
2.1
1
2
3
4
5
6
text/x-vcard
BEGIN
VCARD
END
VCARD
VERSION
2.1
N
TITLE
ORG
BDAY
TEL
EMAIL
URL
NOTE
ADR
2
application/vnd.syncml-devinf+xml
./devinf11
3
201
contacts
./contacts
20030925T175524Z
syncml_client_packet_2.xml 0000664 0000000 0000000 00000003440 12056370134 0033350 0 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples
1.1
SyncML/1.1
0
1
http://pyramid6.com:8080/sync
AA712857A16E02800
anthony
b64
syncml:auth-md5
amO5sygiWy+nqxA2r0++BA==
10000
4000000
1
application/vnd.syncml-devinf+xml
./devinf11
2
application/vnd.syncml-devinf+xml
./devinf11
3
201
contacts
./contacts
20030925T175524Z
syncml_client_packet_3.wbxml 0000664 0000000 0000000 00000002416 12056370134 0033704 0 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples j-//SYNCML//DTD SyncML 1.1//ENmlq1.1 rSyncML/1.1 e35 [1 nWhttp://192.168.2.1/horde/rpc.php gW00V5A9932WX8 Vchuck Z L10000 U4000000 k_K1 Z Sapplication/vnd.syncml-devinf+wbxml TgW./devinf11 OÃ… j-//SYNCML//DTD DevInf 1.1//ENJe1.1 QSynthesis AG USynthesis Sync Client 2.1.0.3 Palm PRO VSynthesis AG ^2.1.0.3 ISySync Client PalmOS PRO Kworkstation )*G]./events R64 ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 _`1 `2 `3 `4 `5 `6 G]./tasks R64 ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 _`1 `2 `3 `4 `5 `6 G]./notes R64 ZFtext/plain d1.0 bFtext/plain d1.0 _`1 `2 `3 `4 `5 `6 EFtext/x-vcalendar XBEGIN cVCALENDAR cVEVENT cVTODO XEND cVCALENDAR cVEVENT cVTODO XVERSION c1.0 XSUMMARY XCLASS XDESCRIPTION XDTSTART XDTEND XRRULE XEXDATE XAALARM XDALARM XSUMMARY XCLASS XDESCRIPTION XDUE XPRIORITY XSTATUS SK2 Z Sapplication/vnd.syncml-devinf+wbxml TnW./devinf11 FK3 O201 TnWevents?/dr(-30,90) gW./events Z EO20040712T033105Z FK4 O201 TnWtasks gW./tasks Z EO20040712T033105Z FK5 O201 TnWnotes gW./notes Z EO20040712T033105Z syncml_client_packet_4.wbxml 0000664 0000000 0000000 00000002416 12056370134 0033705 0 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples j-//SYNCML//DTD SyncML 1.1//ENmlq1.1 rSyncML/1.1 e36 [1 nWhttp://192.168.2.1/horde/rpc.php gW00V5A9932WX8 Vchuck Z L10000 U4000000 k_K1 Z Sapplication/vnd.syncml-devinf+wbxml TgW./devinf11 OÃ… j-//SYNCML//DTD DevInf 1.1//ENJe1.1 QSynthesis AG USynthesis Sync Client 2.1.0.3 Palm PRO VSynthesis AG ^2.1.0.3 ISySync Client PalmOS PRO Kworkstation )*G]./events R64 ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 _`1 `2 `3 `4 `5 `6 G]./tasks R64 ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 _`1 `2 `3 `4 `5 `6 G]./notes R64 ZFtext/plain d1.0 bFtext/plain d1.0 _`1 `2 `3 `4 `5 `6 EFtext/x-vcalendar XBEGIN cVCALENDAR cVEVENT cVTODO XEND cVCALENDAR cVEVENT cVTODO XVERSION c1.0 XSUMMARY XCLASS XDESCRIPTION XDTSTART XDTEND XRRULE XEXDATE XAALARM XDALARM XSUMMARY XCLASS XDESCRIPTION XDUE XPRIORITY XSTATUS SK2 Z Sapplication/vnd.syncml-devinf+wbxml TnW./devinf11 FK3 O201 TnWevents?/dr(-30,90) gW./events Z EO20040712T033131Z FK4 O201 TnWtasks gW./tasks Z EO20040712T033131Z FK5 O201 TnWnotes gW./notes Z EO20040712T033131Z syncml_client_packet_5.wbxml 0000664 0000000 0000000 00000002401 12056370134 0033700 0 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples j-//SYNCML//DTD SyncML 1.0//ENmlq1.0 rSyncML/1.0 e37 [1 nWhttp://192.168.2.1/horde/rpc.php gW00V5A9932WX8 Vchuck Z L10000 k_K1 Z Sapplication/vnd.syncml-devinf+wbxml TgW./devinf10 OÃ…} j-//SYNCML//DTD DevInf 1.0//ENJe1.0 QSynthesis AG USynthesis Sync Client 2.1.0.3 Palm PRO VSynthesis AG ^2.1.0.3 ISySync Client PalmOS PRO Kworkstation G]./events R64 ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 _`1 `2 `3 `4 `5 `6 G]./tasks R64 ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 _`1 `2 `3 `4 `5 `6 G]./notes R64 ZFtext/plain d1.0 bFtext/plain d1.0 _`1 `2 `3 `4 `5 `6 EFtext/x-vcalendar XBEGIN cVCALENDAR cVEVENT cVTODO XEND cVCALENDAR cVEVENT cVTODO XVERSION c1.0 XSUMMARY XCLASS XDESCRIPTION XDTSTART XDTEND XRRULE XEXDATE XAALARM XDALARM XSUMMARY XCLASS XDESCRIPTION XDUE XPRIORITY XSTATUS SK2 Z Sapplication/vnd.syncml-devinf+wbxml TnW./devinf10 FK3 O201 TnWevents?/dr(-30,90) gW./events Z EO20040712T033132Z FK4 O201 TnWtasks gW./tasks Z EO20040712T033132Z FK5 O201 TnWnotes gW./notes Z EO20040712T033132Z syncml_server_packet_1.wbxml 0000664 0000000 0000000 00000000621 12056370134 0033726 0 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples j-//SYNCML//DTD SyncML 1.1//ENmlq1.1 rSyncML/1.1 e0 [1 nWAA712857A16E02800 Vanthony gWhttp://pyramid6.com:8080/sync Z L50000 U4000000 kiK1 \1 L0 JSyncHdr ohttp://pyramid6.com:8080/sync hAA712857A16E02800 IZ Gb64 Ssyncml:auth-md5 PO0JUQVAkISE= O401 iK2 \1 L1 JPut O401 iK3 \1 L2 JGet O401 iK4 \1 L3 JAlert O401 syncml_server_packet_1.xml 0000664 0000000 0000000 00000003411 12056370134 0033375 0 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples
1.1
SyncML/1.1
0
1
AA712857A16E02800
anthony
http://pyramid6.com:8080/sync
50000
4000000
1
1
0
SyncHdr
http://pyramid6.com:8080/sync
AA712857A16E02800
b64
syncml:auth-md5
O0JUQVAkISE=
401
2
1
1
Put
401
3
1
2
Get
401
4
1
3
Alert
401
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/doc/Horde/Xml/Wbxml/examples/z600_client_0.wbxml 0000664 0000000 0000000 00000002444 12056370134 0031624 0 ustar 00root root 0000000 0000000 j-//SYNCML//DTD SyncML 1.0//ENmlqÃ1.0rÃ
SyncML/1.0eÃ5[Ã1nWÃ!https://mail.lnk.lt/horde/rpc.phpgWÃ351932004600689Z LÃ2700 k_KÃ1Z SÃ#application/vnd.syncml-devinf+wbxml TgWÃ
./devinf10OÇS j-//SYNCML//DTD DevInf 1.0//ENJe1.0 QSonyEricsson ^R2B PR2A I351932004600689 Kphone GR40 ]EriPBDB ZFtext/x-vcard d2.1 bFtext/x-vcard d2.1 YFtext/vcard d3.0 MS510 _`1 `2 GR40 ]EriCalDB ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 MS300 _`1 `2 GR40 ]EriTodoDB ZFtext/x-vcalendar d1.0 bFtext/x-vcalendar d1.0 MS80 _`1 `2 EFtext/x-vcard XBEGIN cVCARD XVERSION c2.1 XN XFN XTITLE XORG XTEL WWORK WFAX WCELL WHOME XEMAIL WINTERNET XEND cVCARD Ftext/vcard XBEGIN cVCARD XVERSION c3.0 XN XFN XTITLE XORG XTEL WWORK WFAX WCELL WHOME XEMAIL WINTERNET XEND cVCARD Ftext/x-vcalendar XBEGIN cVCALENDAR cVEVENT cVTODO XVERSION c1.0 XSUMMARY XLOCATION XDESCRIPTION XDTSTART XDTEND XAALARM XCATEGORIES XCLASS cPUBLIC cPRIVATE XDUE XPRIORITY XSTATUS XEND cVCALENDAR cVEVENT cVTODO FKÃ2NZ GÃb64SÃsyncml:auth-basic OÃcm9vdDpNeUQwWkU=OÃ201TnWÃhordegWÃEriCalDBZ EJÃ0OÃ11 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/ 0000775 0000000 0000000 00000000000 12056370134 0021562 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/ 0000775 0000000 0000000 00000000000 12056370134 0022623 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/ 0000775 0000000 0000000 00000000000 12056370134 0023363 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml.php 0000664 0000000 0000000 00000022401 12056370134 0025164 0 ustar 00root root 0000000 0000000
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml
{
/* Constants are from Binary XML Content Format Specification Version 1.3,
* 25 July 2001 found at http://www.wapforum.org */
/* From 7.1 Global Tokens. */
const GLOBAL_TOKEN_SWITCH_PAGE = 0; // 0x00
const GLOBAL_TOKEN_END = 1; // 0x01
const GLOBAL_TOKEN_ENTITY = 2; // 0x02
const GLOBAL_TOKEN_STR_I = 3; // 0x03
const GLOBAL_TOKEN_LITERAL = 4; // 0x04
const GLOBAL_TOKEN_EXT_I_0 = 64; // 0x40
const GLOBAL_TOKEN_EXT_I_1 = 65; // 0x41
const GLOBAL_TOKEN_EXT_I_2 = 66; // 0x42
const GLOBAL_TOKEN_PI = 67; // 0x43
const GLOBAL_TOKEN_LITERAL_C = 68; // 0x44
const GLOBAL_TOKEN_EXT_T_0 = 128; // 0x80
const GLOBAL_TOKEN_EXT_T_1 = 129; // 0x81
const GLOBAL_TOKEN_EXT_T_2 = 130; // 0x82
const GLOBAL_TOKEN_STR_T = 131; // 0x83
const GLOBAL_TOKEN_LITERAL_A = 132; // 0x84
const GLOBAL_TOKEN_EXT_0 = 192; // 0xC0
const GLOBAL_TOKEN_EXT_1 = 193; // 0xC1
const GLOBAL_TOKEN_EXT_2 = 194; // 0xC2
const GLOBAL_TOKEN_OPAQUE = 195; // 0xC3
const GLOBAL_TOKEN_LITERAL_AC = 196; // 0xC4
/* Only default character encodings from J2SE are currently supported. */
const CHARSET_US_ASCII = 'US-ASCII';
const CHARSET_ISO_8859_1 = 'ISO-8859-1';
const CHARSET_UTF_8 = 'UTF-8';
const CHARSET_UTF_16BE = 'UTF-16BE';
const CHARSET_UTF_16LE = 'UTF-16LE';
const CHARSET_UTF_16 = 'UTF-16';
/**
* Decoding Multi-byte Integers from Section 5.1
*
* Use long because it is unsigned.
*/
static public function MBUInt32ToInt($in, &$pos)
{
$val = 0;
do {
$b = ord($in[$pos++]);
$val <<= 7; // Bitshift left 7 bits.
$val += ($b & 127);
} while (($b & 128) != 0);
return $val;
}
/**
* Encoding Multi-byte Integers from Section 5.1
*/
static public function intToMBUInt32(&$out, $i)
{
if ($i > 268435455) {
$bytes0 = 0 | Horde_Xml_Wbxml::getBits(0, $i);
$bytes1 = 128 | Horde_Xml_Wbxml::getBits(1, $i);
$bytes2 = 128 | Horde_Xml_Wbxml::getBits(2, $i);
$bytes3 = 128 | Horde_Xml_Wbxml::getBits(3, $i);
$bytes4 = 128 | Horde_Xml_Wbxml::getBits(4, $i);
$out .= chr($bytes4) . chr($bytes3) . chr($bytes2) . chr($bytes1) . chr($bytes0);
} elseif ($i > 2097151) {
$bytes0 = 0 | Horde_Xml_Wbxml::getBits(0, $i);
$bytes1 = 128 | Horde_Xml_Wbxml::getBits(1, $i);
$bytes2 = 128 | Horde_Xml_Wbxml::getBits(2, $i);
$bytes3 = 128 | Horde_Xml_Wbxml::getBits(3, $i);
$out .= chr($bytes3) . chr($bytes2) . chr($bytes1) . chr($bytes0);
} elseif ($i > 16383) {
$bytes0 = 0 | Horde_Xml_Wbxml::getBits(0, $i);
$bytes1 = 128 | Horde_Xml_Wbxml::getBits(1, $i);
$bytes2 = 128 | Horde_Xml_Wbxml::getBits(2, $i);
$out .= chr($bytes2) . chr($bytes1) . chr($bytes0);
} elseif ($i > 127) {
$bytes0 = 0 | Horde_Xml_Wbxml::getBits(0, $i);
$bytes1 = 128 | Horde_Xml_Wbxml::getBits(1, $i);
$out .= chr($bytes1) . chr($bytes0);
} else {
$bytes0 = 0 | Horde_Xml_Wbxml::getBits(0, $i);
$out .= chr($bytes0);
}
}
static public function getBits($num, $l)
{
switch ($num) {
case 0:
return $l & 127; // 0x7F
case 1:
return ($l >> 7) & 127; // 0x7F
case 2:
return ($l >> 14) & 127; // 0x7F
case 3:
return ($l >> 21) & 127; // 0x7F
case 4:
return ($l >> 28) & 127; // 0x7F
}
return 0;
}
static public function getDPIString($i)
{
/**
* ADD CHAPTER
*/
$DPIString = array(2 => Horde_Xml_Wbxml_Dtd::WML_1_0,
3 => Horde_Xml_Wbxml_Dtd::WTA_1_0,
4 => Horde_Xml_Wbxml_Dtd::WML_1_1,
5 => Horde_Xml_Wbxml_Dtd::SI_1_1,
6 => Horde_Xml_Wbxml_Dtd::SL_1_0,
7 => Horde_Xml_Wbxml_Dtd::CO_1_0,
8 => Horde_Xml_Wbxml_Dtd::CHANNEL_1_1,
9 => Horde_Xml_Wbxml_Dtd::WML_1_2,
10 => Horde_Xml_Wbxml_Dtd::WML_1_3,
11 => Horde_Xml_Wbxml_Dtd::PROV_1_0,
12 => Horde_Xml_Wbxml_Dtd::WTA_WML_1_2,
13 => Horde_Xml_Wbxml_Dtd::CHANNEL_1_2,
// Not all SyncML clients know this, so we
// should use the string table.
// 0xFD1 => Horde_Xml_Wbxml_Dtd::SYNCML_1_1,
// These codes are taken from libwbxml wbxml_tables.h:
4049 => Horde_Xml_Wbxml_Dtd::SYNCML_1_0, // 0x0fd1
4050 => Horde_Xml_Wbxml_Dtd::DEVINF_1_0, // 0x0fd2
4051 => Horde_Xml_Wbxml_Dtd::SYNCML_1_1, // 0x0fd3
4052 => Horde_Xml_Wbxml_Dtd::DEVINF_1_1, // 0x0fd4
4609 => Horde_Xml_Wbxml_Dtd::SYNCML_1_2, // 0x1201
//@todo: verify this:
4611 => Horde_Xml_Wbxml_Dtd::DEVINF_1_2 // 0x1203
// taken from libxml but might be wrong:
// 4610 => Horde_Xml_Wbxml_Dtd::DEVINF_1_2, // 0x1202
// 4611 => Horde_Xml_Wbxml_Dtd::METINF_1_2 // 0x1203
);
return isset($DPIString[$i]) ? $DPIString[$i] : null;
}
static public function getDPIInt($dpi)
{
/**
* ADD CHAPTER
*/
$DPIInt = array(Horde_Xml_Wbxml_Dtd::WML_1_0 => 2,
Horde_Xml_Wbxml_Dtd::WTA_1_0 => 3,
Horde_Xml_Wbxml_Dtd::WML_1_1 => 4,
Horde_Xml_Wbxml_Dtd::SI_1_1 => 5,
Horde_Xml_Wbxml_Dtd::SL_1_0 => 6,
Horde_Xml_Wbxml_Dtd::CO_1_0 => 7,
Horde_Xml_Wbxml_Dtd::CHANNEL_1_1 => 8,
Horde_Xml_Wbxml_Dtd::WML_1_2 => 9,
Horde_Xml_Wbxml_Dtd::WML_1_3 => 10,
Horde_Xml_Wbxml_Dtd::PROV_1_0 => 11,
Horde_Xml_Wbxml_Dtd::WTA_WML_1_2 => 12,
Horde_Xml_Wbxml_Dtd::CHANNEL_1_2 => 13,
// Not all SyncML clients know this, so maybe we
// should use the string table.
// These codes are taken from libwbxml wbxml_tables.h:
Horde_Xml_Wbxml_Dtd::SYNCML_1_0 => 4049,
Horde_Xml_Wbxml_Dtd::DEVINF_1_0 => 4050,
Horde_Xml_Wbxml_Dtd::SYNCML_1_1 => 4051,
Horde_Xml_Wbxml_Dtd::DEVINF_1_1 => 4052,
Horde_Xml_Wbxml_Dtd::SYNCML_1_2 => 4609, // 0x1201
// Horde_Xml_Wbxml_Dtd::DEVINF_1_2 => 4610, // 0x1202
// Horde_Xml_Wbxml_Dtd::METINF_1_2 => 4611 // 0x1203
//@todo: verify this
Horde_Xml_Wbxml_Dtd::DEVINF_1_2 => 4611 // 0x1203
// Horde_Xml_Wbxml_Dtd::SYNCML_1_1 => 0xFD1,
// Horde_Xml_Wbxml_Dtd::DEVINF_1_1 => 0xFD2,
);
return isset($DPIInt[$dpi]) ? $DPIInt[$dpi] : 0;
}
/**
* Returns the character encoding.
* only default character encodings from J2SE are supported
* from http://www.iana.org/assignments/character-sets
* and http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html
*/
static public function getCharsetString($cs)
{
/**
* From http://www.iana.org/assignments/character-sets
*/
$charsetString = array(3 => 'US-ASCII',
4 => 'ISO-8859-1',
106 => 'UTF-8',
1013 => 'UTF-16BE',
1014 => 'UTF-16LE',
1015 => 'UTF-16');
return isset($charsetString[$cs]) ? $charsetString[$cs] : null;
}
/**
* Returns the character encoding.
*
* Only default character encodings from J2SE are supported.
*
* From http://www.iana.org/assignments/character-sets and
* http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html
*/
static public function getCharsetInt($cs)
{
/**
* From http://www.iana.org/assignments/character-sets
*/
$charsetInt = array('US-ASCII' => 3,
'ISO-8859-1' => 4,
'UTF-8' => 106,
'UTF-16BE' => 1013,
'UTF-16LE' => 1014,
'UTF-16' => 1015);
return isset($charsetInt[$cs]) ? $charsetInt[$cs] : null;
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/ 0000775 0000000 0000000 00000000000 12056370134 0024454 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/ContentHandler.php 0000664 0000000 0000000 00000005034 12056370134 0030077 0 ustar 00root root 0000000 0000000
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml_ContentHandler
{
protected $_currentUri;
protected $_output = '';
protected $_opaqueHandler;
/**
* Charset.
*/
protected $_charset = 'UTF-8';
/**
* WBXML Version.
* 1, 2, or 3 supported
*/
protected $_wbxmlVersion = 2;
public function __construct()
{
$this->_currentUri = new Horde_Xml_Wbxml_LifoQueue();
}
public function getCharsetStr()
{
return $this->_charset;
}
public function setCharset($cs)
{
$this->_charset = $cs;
}
public function getVersion()
{
return $this->_wbxmlVersion;
}
public function setVersion($v)
{
$this->_wbxmlVersion = 2;
}
public function getOutput()
{
return $this->_output;
}
public function getOutputSize()
{
return strlen($this->_output);
}
public function startElement($uri, $element, $attrs = array())
{
$this->_output .= '<' . $element;
$currentUri = $this->_currentUri->top();
if (((!$currentUri) || ($currentUri != $uri)) && $uri) {
$this->_output .= ' xmlns="' . $uri . '"';
}
$this->_currentUri->push($uri);
foreach ($attrs as $attr) {
$this->_output .= ' ' . $attr['attribute'] . '="' . $attr['value'] . '"';
}
$this->_output .= '>';
}
public function endElement($uri, $element)
{
$this->_output .= '' . $element . '>';
$this->_currentUri->pop();
}
public function characters($str)
{
$this->_output .= htmlspecialchars($str);
}
public function opaque($o)
{
$this->_output .= $o;
}
public function setOpaqueHandler($opaqueHandler)
{
$this->_opaqueHandler = $opaqueHandler;
}
public function removeOpaqueHandler()
{
unset($this->_opaqueHandler);
}
public function createSubHandler()
{
$name = get_class($this); // clone current class
$sh = new $name();
$sh->setCharset($this->getCharsetStr());
$sh->setVersion($this->getVersion());
return $sh;
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/Decoder.php 0000664 0000000 0000000 00000051357 12056370134 0026545 0 ustar 00root root 0000000 0000000
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml_Decoder extends Horde_Xml_Wbxml_ContentHandler
{
/**
* Document Public Identifier type
* 1 mb_u_int32 well known type
* 2 string table
* from spec but converted into a string.
*
* Document Public Identifier
* Used with dpiType.
*/
protected $_dpi;
/**
* String table as defined in 5.7
*/
protected $_stringTable = array();
/**
* Content handler.
* Currently just outputs raw XML.
*/
protected $_ch;
protected $_tagDTD;
protected $_prevAttributeDTD;
protected $_attributeDTD;
/**
* State variables.
*/
protected $_tagStack = array();
protected $_isAttribute;
protected $_isData = false;
protected $_error = false;
/**
* The DTD Manager.
*
* @var Horde_Xml_Wbxml_DtdManager
*/
protected $_dtdManager;
/**
* The string position.
*
* @var integer
*/
protected $_strpos;
/**
* Constructor.
*/
public function __construct()
{
$this->_dtdManager = new Horde_Xml_Wbxml_DtdManager();
}
/**
* Sets the contentHandler that will receive the output of the
* decoding.
*
* @param Horde_Xml_Wbxml_ContentHandler $ch The contentHandler
*/
public function setContentHandler($ch)
{
$this->_ch = $ch;
}
/**
* Return one byte from the input stream.
*
* @param string $input The WBXML input string.
*/
public function getByte($input)
{
return ord($input{$this->_strpos++});
}
/**
* Takes a WBXML input document and returns decoded XML.
* However the preferred and more effecient method is to
* use decode() rather than decodeToString() and have an
* appropriate contentHandler deal with the decoded data.
*
* @param string $wbxml The WBXML document to decode.
*
* @return string The decoded XML document.
* @throws Horde_Xml_Wbxml_Exception
*/
public function decodeToString($wbxml)
{
$this->_ch = new Horde_Xml_Wbxml_ContentHandler();
$this->decode($wbxml);
return $this->_ch->getOutput();
}
/**
* Takes a WBXML input document and decodes it.
* Decoding result is directly passed to the contentHandler.
* A contenthandler must be set using setContentHandler
* prior to invocation of this method
*
* @param string $wbxml The WBXML document to decode.
*
* @throws Horde_Xml_Wbxml_Exception
*/
public function decode($wbxml)
{
$this->_error = false; // reset state
$this->_strpos = 0;
if (empty($this->_ch)) {
throw new Horde_Xml_Wbxml_Exception('No Contenthandler defined.');
}
// Get Version Number from Section 5.4
// version = u_int8
// currently 1, 2 or 3
$this->_wbxmlVersion = $this->getVersionNumber($wbxml);
// Get Document Public Idetifier from Section 5.5
// publicid = mb_u_int32 | (zero index)
// zero = u_int8
// Containing the value zero (0)
// The actual DPI is determined after the String Table is read.
$dpiStruct = $this->getDocumentPublicIdentifier($wbxml);
// Get Charset from 5.6
// charset = mb_u_int32
$this->_charset = $this->getCharset($wbxml);
// Get String Table from 5.7
// strb1 = length *byte
$this->retrieveStringTable($wbxml);
// Get Document Public Idetifier from Section 5.5.
$this->_dpi = $this->getDocumentPublicIdentifierImpl($dpiStruct['dpiType'],
$dpiStruct['dpiNumber'],
$this->_stringTable);
// Now the real fun begins.
// From Sections 5.2 and 5.8
// Default content handler.
$this->_dtdManager = new Horde_Xml_Wbxml_DtdManager();
// Get the starting DTD.
$this->_tagDTD = $this->_dtdManager->getInstance($this->_dpi);
if (!$this->_tagDTD) {
throw new Horde_Xml_Wbxml_Exception(
'No DTD found for ' . $this->_dpi . '/' . $dpiStruct['dpiNumber']);
}
$this->_attributeDTD = $this->_tagDTD;
while (empty($this->_error) && $this->_strpos < strlen($wbxml)) {
$this->_decode($wbxml);
}
if (!empty($this->_error)) {
throw $this->_error;
}
}
public function getVersionNumber($input)
{
return $this->getByte($input);
}
public function getDocumentPublicIdentifier($input)
{
$i = Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos);
if ($i == 0) {
return array('dpiType' => 2,
'dpiNumber' => $this->getByte($input));
} else {
return array('dpiType' => 1,
'dpiNumber' => $i);
}
}
public function getDocumentPublicIdentifierImpl($dpiType, $dpiNumber)
{
if ($dpiType == 1) {
return Horde_Xml_Wbxml::getDPIString($dpiNumber);
} else {
return $this->getStringTableEntry($dpiNumber);
}
}
/**
* Returns the character encoding. Only default character
* encodings from J2SE are supported. From
* http://www.iana.org/assignments/character-sets and
* http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html
*/
public function getCharset($input)
{
$cs = Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos);
return Horde_Xml_Wbxml::getCharsetString($cs);
}
/**
* Retrieves the string table.
* The string table consists of an mb_u_int32 length
* and then length bytes forming the table.
* References to the string table refer to the
* starting position of the (null terminated)
* string in this table.
*/
public function retrieveStringTable($input)
{
$size = Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos);
$this->_stringTable = substr($input, $this->_strpos, $size);
$this->_strpos += $size;
// print "stringtable($size):" . $this->_stringTable ."\n";
}
public function getStringTableEntry($index)
{
if ($index >= strlen($this->_stringTable)) {
$this->_error = new Horde_Xml_Wbxml_Exception(
'Invalid offset ' . $index
. ' value encountered around position ' . $this->_strpos
. '. Broken wbxml?');
return '';
}
// copy of method termstr but without modification of this->_strpos
$str = '#'; // must start with nonempty string to allow array access
$i = 0;
$ch = $this->_stringTable[$index++];
if (ord($ch) == 0) {
return ''; // don't return '#'
}
while (ord($ch) != 0) {
$str[$i++] = $ch;
if ($index >= strlen($this->_stringTable)) {
break;
}
$ch = $this->_stringTable[$index++];
}
// print "string table entry: $str\n";
return $str;
}
protected function _decode($input)
{
$token = $this->getByte($input);
$str = '';
// print "position: " . $this->_strpos . " token: " . $token . " str10: " . substr($input, $this->_strpos, 10) . "\n"; // @todo: remove debug output
switch ($token) {
case Horde_Xml_Wbxml::GLOBAL_TOKEN_STR_I:
// Section 5.8.4.1
$str = $this->termstr($input);
$this->_ch->characters($str);
// print "str:$str\n"; // @TODO Remove debug code
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_STR_T:
// Section 5.8.4.1
$x = Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos);
$str = $this->getStringTableEntry($x);
$this->_ch->characters($str);
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_I_0:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_I_1:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_I_2:
// Section 5.8.4.2
$str = $this->termstr($input);
$this->_ch->characters($str);
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_T_0:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_T_1:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_T_2:
// Section 5.8.4.2
$str = $this->getStringTableEnty(Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos));
$this->_ch->characters($str);
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_0:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_1:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_2:
// Section 5.8.4.2
$extension = $this->getByte($input);
$this->_ch->characters($extension);
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_ENTITY:
// Section 5.8.4.3
// UCS-4 chracter encoding?
$entity = $this->entity(Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos));
$this->_ch->characters('' . $entity . ';');
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_PI:
// Section 5.8.4.4
throw new Horde_Xml_Wbxml_Exception('WBXML global token processing instruction is unsupported');
case Horde_Xml_Wbxml::GLOBAL_TOKEN_LITERAL:
// Section 5.8.4.5
$str = $this->getStringTableEntry(Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos));
$this->parseTag($input, $str, false, false);
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_LITERAL_A:
// Section 5.8.4.5
$str = $this->getStringTableEntry(Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos));
$this->parseTag($input, $str, true, false);
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_LITERAL_AC:
// Section 5.8.4.5
$str = $this->getStringTableEntry(Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos));
$this->parseTag($input, $string, true, true);
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_LITERAL_C:
// Section 5.8.4.5
$str = $this->getStringTableEntry(Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos));
$this->parseTag($input, $str, false, true);
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_OPAQUE:
// Section 5.8.4.6
$size = Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos);
if ($size>0) {
$b = substr($input, $this->_strpos, $size);
// print "opaque of size $size: ($b)\n"; // @todo remove debug
$this->_strpos += $size;
// opaque data inside a element may or may not be
// a nested wbxml document (for example devinf data).
// We find out by checking the first byte of the data: if it's
// 1, 2 or 3 we expect it to be the version number of a wbxml
// document and thus start a new wbxml decoder instance on it.
if ($size > 0 && $this->_isData && ord($b) <= 10) {
$decoder = new Horde_Xml_Wbxml_Decoder();
$decoder->setContentHandler($this->_ch);
$decoder->decode($b);
// /* // @todo: FIXME currently we can't decode Nokia
// DevInf data. So ignore error for the time beeing.
// */
// $this->_ch->characters($s);
} else {
/* normal opaque behaviour: just copy the raw data: */
// print "opaque handled as string=$b\n"; // @todo remove debug
$this->_ch->characters($b);
}
}
// old approach to deal with opaque data inside ContentHandler:
// FIXME Opaque is used by SYNCML. Opaque data that depends on the context
// if (contentHandler instanceof OpaqueContentHandler) {
// ((OpaqueContentHandler)contentHandler).opaque(b);
// } else {
// String str = new String(b, 0, size, charset);
// char[] chars = str.toCharArray();
// contentHandler.characters(chars, 0, chars.length);
// }
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_END:
// Section 5.8.4.7.1
$str = $this->endTag();
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_SWITCH_PAGE:
// Section 5.8.4.7.2
$codePage = $this->getByte($input);
// print "switch to codepage $codePage\n"; // @todo: remove debug code
$this->switchElementCodePage($codePage);
break;
default:
// Section 5.8.2
// Section 5.8.3
$hasAttributes = (($token & 0x80) != 0);
$hasContent = (($token & 0x40) != 0);
$realToken = $token & 0x3F;
$str = $this->getTag($realToken);
// print "element:$str\n"; // @TODO Remove debug code
$this->parseTag($input, $str, $hasAttributes, $hasContent);
if ($realToken == 0x0f) {
// store if we're inside a Data tag. This may contain
// an additional enclosed wbxml document on which we have
// to run a seperate encoder
$this->_isData = true;
} else {
$this->_isData = false;
}
break;
}
}
public function parseTag($input, $tag, $hasAttributes, $hasContent)
{
$attrs = array();
if ($hasAttributes) {
$attrs = $this->getAttributes($input);
}
$this->_ch->startElement($this->getCurrentURI(), $tag, $attrs);
if ($hasContent) {
// FIXME I forgot what does this does. Not sure if this is
// right?
$this->_tagStack[] = $tag;
} else {
$this->_ch->endElement($this->getCurrentURI(), $tag);
}
}
public function endTag()
{
if (count($this->_tagStack)) {
$tag = array_pop($this->_tagStack);
} else {
$tag = 'Unknown';
}
$this->_ch->endElement($this->getCurrentURI(), $tag);
return $tag;
}
public function getAttributes($input)
{
$this->startGetAttributes();
$hasMoreAttributes = true;
$attrs = array();
$attr = null;
$value = null;
$token = null;
while ($hasMoreAttributes) {
$token = $this->getByte($input);
switch ($token) {
// Attribute specified.
case Horde_Xml_Wbxml::GLOBAL_TOKEN_LITERAL:
// Section 5.8.4.5
if (isset($attr)) {
$attrs[] = array('attribute' => $attr,
'value' => $value);
}
$attr = $this->getStringTableEntry(Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos));
break;
// Value specified.
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_I_0:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_I_1:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_I_2:
// Section 5.8.4.2
$value .= $this->termstr($input);
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_T_0:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_T_1:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_T_2:
// Section 5.8.4.2
$value .= $this->getStringTableEntry(Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos));
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_0:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_1:
case Horde_Xml_Wbxml::GLOBAL_TOKEN_EXT_2:
// Section 5.8.4.2
$value .= $input[$this->_strpos++];
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_ENTITY:
// Section 5.8.4.3
$value .= $this->entity(Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos));
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_STR_I:
// Section 5.8.4.1
$value .= $this->termstr($input);
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_STR_T:
// Section 5.8.4.1
$value .= $this->getStringTableEntry(Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos));
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_OPAQUE:
// Section 5.8.4.6
$size = Horde_Xml_Wbxml::MBUInt32ToInt($input, $this->_strpos);
$b = substr($input, $this->_strpos, $this->_strpos + $size);
$this->_strpos += $size;
$value .= $b;
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_END:
// Section 5.8.4.7.1
$hasMoreAttributes = false;
if (isset($attr)) {
$attrs[] = array('attribute' => $attr,
'value' => $value);
}
break;
case Horde_Xml_Wbxml::GLOBAL_TOKEN_SWITCH_PAGE:
// Section 5.8.4.7.2
$codePage = $this->getByte($input);
if (!$this->_prevAttributeDTD) {
$this->_prevAttributeDTD = $this->_attributeDTD;
}
$this->switchAttributeCodePage($codePage);
break;
default:
if ($token > 128) {
if (isset($attr)) {
$attrs[] = array('attribute' => $attr,
'value' => $value);
}
$attr = $this->_attributeDTD->toAttribute($token);
} else {
// Value.
$value .= $this->_attributeDTD->toAttribute($token);
}
break;
}
}
if (!$this->_prevAttributeDTD) {
$this->_attributeDTD = $this->_prevAttributeDTD;
$this->_prevAttributeDTD = false;
}
$this->stopGetAttributes();
}
public function startGetAttributes()
{
$this->_isAttribute = true;
}
public function stopGetAttributes()
{
$this->_isAttribute = false;
}
public function getCurrentURI()
{
$uri = $this->_isAttribute
? $this->_tagDTD->getURI()
: $this->_attributeDTD->getURI();
return str_replace(
array('syncml:metinf1.0',
'syncml:metinf1.1',
'syncml:metinf1.2',
'syncml:devinf1.0',
'syncml:devinf1.1',
'syncml:devinf1.2'),
array('syncml:metinf',
'syncml:metinf',
'syncml:metinf',
'syncml:devinf',
'syncml:devinf',
'syncml:devinf'),
$uri);
}
public function writeString($str)
{
$this->_ch->characters($str);
}
public function getTag($tag)
{
// Should know which state it is in.
return $this->_tagDTD->toTagStr($tag);
}
public function getAttribute($attribute)
{
// Should know which state it is in.
$this->_attributeDTD->toAttributeInt($attribute);
}
public function switchElementCodePage($codePage)
{
$this->_tagDTD = $this->_dtdManager->getInstance($this->_tagDTD->toCodePageStr($codePage));
$this->switchAttributeCodePage($codePage);
}
public function switchAttributeCodePage($codePage)
{
$this->_attributeDTD = $this->_dtdManager->getInstance($this->_attributeDTD->toCodePageStr($codePage));
}
/**
* Return the hex version of the base 10 $entity.
*/
public function entity($entity)
{
return dechex($entity);
}
/**
* Reads a null terminated string.
*/
public function termstr($input)
{
$str = '#'; // must start with nonempty string to allow array access
$i = 0;
$ch = $input[$this->_strpos++];
if (ord($ch) == 0) {
return ''; // don't return '#'
}
while (ord($ch) != 0) {
$str[$i++] = $ch;
$ch = $input[$this->_strpos++];
}
return $str;
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/Dtd.php 0000664 0000000 0000000 00000011330 12056370134 0025676 0 ustar 00root root 0000000 0000000
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml_Dtd
{
/* Constants are from Binary XML Content Format Specification Version 1.3,
* 25 July 2001 found at http://www.wapforum.org */
/* Not sure where defined. */
const WML_1_0 = '-//WAPFORUM//DTD WML 1.0//EN';
const WTA_1_0 = '-//WAPFORUM//DTD WTA 1.0//EN';
const WML_1_1 = '-//WAPFORUM//DTD WML 1.1//EN';
const SI_1_1 = '-//WAPFORUM//DTD SI 1.1//EN';
const SL_1_0 = '-//WAPFORUM//DTD SL 1.0//EN';
const CO_1_0 = '-//WAPFORUM//DTD CO 1.0//EN';
const CHANNEL_1_1 = '-//WAPFORUM//DTD CHANNEL 1.1//EN';
const WML_1_2 = '-//WAPFORUM//DTD WML 1.2//EN';
const WML_1_3 = '-//WAPFORUM//DTD WML 1.3//EN';
const PROV_1_0 = '-//WAPFORUM//DTD PROV 1.0//EN';
const WTA_WML_1_2 = '-//WAPFORUM//DTD WTA-WML 1.2//EN';
const CHANNEL_1_2 = '-//WAPFORUM//DTD CHANNEL 1.2//EN';
const SYNCML_1_0 = '-//SYNCML//DTD SyncML 1.0//EN';
const DEVINF_1_0 = '-//SYNCML//DTD DevInf 1.0//EN';
const METINF_1_0 = '-//SYNCML//DTD MetInf 1.0//EN';
const SYNCML_1_1 = '-//SYNCML//DTD SyncML 1.1//EN';
const DEVINF_1_1 = '-//SYNCML//DTD DevInf 1.1//EN';
const METINF_1_1 = '-//SYNCML//DTD MetInf 1.1//EN';
const SYNCML_1_2 = '-//SYNCML//DTD SyncML 1.2//EN';
const DEVINF_1_2 = '-//SYNCML//DTD DevInf 1.2//EN';
const METINF_1_2 = '-//SYNCML//DTD MetInf 1.2//EN';
public $version;
public $intTags;
public $intAttributes;
public $strTags;
public $strAttributes;
public $intCodePages;
public $strCodePages;
public $strCodePagesURI;
public $URI;
public $XMLNS;
public $DPI;
public function __construct($v)
{
$this->version = $v;
$this->init();
}
public function init()
{
}
public function setAttribute($intAttribute, $strAttribute)
{
$this->strAttributes[$strAttribute] = $intAttribute;
$this->intAttributes[$intAttribute] = $strAttribute;
}
public function setTag($intTag, $strTag)
{
$this->strTags[$strTag] = $intTag;
$this->intTags[$intTag] = $strTag;
}
public function setCodePage($intCodePage, $strCodePage, $strCodePageURI)
{
$this->strCodePagesURI[$strCodePageURI] = $intCodePage;
$this->strCodePages[$strCodePage] = $intCodePage;
$this->intCodePages[$intCodePage] = $strCodePage;
}
public function toTagStr($tag)
{
return isset($this->intTags[$tag]) ? $this->intTags[$tag] : false;
}
public function toAttributeStr($attribute)
{
return isset($this->intTags[$attribute]) ? $this->intTags[$attribute] : false;
}
public function toCodePageStr($codePage)
{
return isset($this->intCodePages[$codePage]) ? $this->intCodePages[$codePage] : false;
}
public function toTagInt($tag)
{
return isset($this->strTags[$tag]) ? $this->strTags[$tag] : false;
}
public function toAttributeInt($attribute)
{
return isset($this->strAttributes[$attribute]) ? $this->strAttributes[$attribute] : false;
}
public function toCodePageInt($codePage)
{
return isset($this->strCodePages[$codePage]) ? $this->strCodePages[$codePage] : false;
}
public function toCodePageURI($uri)
{
$uri = Horde_String::lower($uri);
return isset($this->strCodePagesURI[$uri])
? $this->strCodePagesURI[$uri]
: false;
}
/**
* Getter for property version.
* @return Value of property version.
*/
public function getVersion()
{
return $this->version;
}
/**
* Setter for property version.
* @param integer $v New value of property version.
*/
public function setVersion($v)
{
$this->version = $v;
}
/**
* Getter for property URI.
* @return Value of property URI.
*/
public function getURI()
{
return $this->URI;
}
/**
* Setter for property URI.
* @param string $u New value of property URI.
*/
public function setURI($u)
{
$this->URI = $u;
}
/**
* Getter for property DPI.
* @return Value of property DPI.
*/
public function getDPI()
{
return $this->DPI;
}
/**
* Setter for property DPI.
* @param DPI New value of property DPI.
*/
public function setDPI($d)
{
$this->DPI = $d;
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/Dtd/ 0000775 0000000 0000000 00000000000 12056370134 0025167 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/Dtd/SyncMl.php 0000664 0000000 0000000 00000010245 12056370134 0027107 0 ustar 00root root 0000000 0000000
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml_Dtd_SyncMl extends Horde_Xml_Wbxml_Dtd
{
public function init()
{
/* this code table has been extracted from libwbxml
* (see http://libwbxml.aymerick.com/) by using
*
* grep '\"[^\"]*\", *0x.., 0x.. },' wbxml_tables.c
* | sed -e 's#^.*\"\([^\"]*\)\", *\(0x..\), \(0x..\) },.*$# \$this->setTag\(\3, \"\1\"\); // \2#g'
*/
$this->setTag(0x05, "Add"); // 0x00
$this->setTag(0x06, "Alert"); // 0x00
$this->setTag(0x07, "Archive"); // 0x00
$this->setTag(0x08, "Atomic"); // 0x00
$this->setTag(0x09, "Chal"); // 0x00
$this->setTag(0x0a, "Cmd"); // 0x00
$this->setTag(0x0b, "CmdID"); // 0x00
$this->setTag(0x0c, "CmdRef"); // 0x00
$this->setTag(0x0d, "Copy"); // 0x00
$this->setTag(0x0e, "Cred"); // 0x00
$this->setTag(0x0f, "Data"); // 0x00
$this->setTag(0x10, "Delete"); // 0x00
$this->setTag(0x11, "Exec"); // 0x00
$this->setTag(0x12, "Final"); // 0x00
$this->setTag(0x13, "Get"); // 0x00
$this->setTag(0x14, "Item"); // 0x00
$this->setTag(0x15, "Lang"); // 0x00
$this->setTag(0x16, "LocName"); // 0x00
$this->setTag(0x17, "LocURI"); // 0x00
$this->setTag(0x18, "Map"); // 0x00
$this->setTag(0x19, "MapItem"); // 0x00
$this->setTag(0x1a, "Meta"); // 0x00
$this->setTag(0x1b, "MsgID"); // 0x00
$this->setTag(0x1c, "MsgRef"); // 0x00
$this->setTag(0x1d, "NoResp"); // 0x00
$this->setTag(0x1e, "NoResults"); // 0x00
$this->setTag(0x1f, "Put"); // 0x00
$this->setTag(0x20, "Replace"); // 0x00
$this->setTag(0x21, "RespURI"); // 0x00
$this->setTag(0x22, "Results"); // 0x00
$this->setTag(0x23, "Search"); // 0x00
$this->setTag(0x24, "Sequence"); // 0x00
$this->setTag(0x25, "SessionID"); // 0x00
$this->setTag(0x26, "SftDel"); // 0x00
$this->setTag(0x27, "Source"); // 0x00
$this->setTag(0x28, "SourceRef"); // 0x00
$this->setTag(0x29, "Status"); // 0x00
$this->setTag(0x2a, "Sync"); // 0x00
$this->setTag(0x2b, "SyncBody"); // 0x00
$this->setTag(0x2c, "SyncHdr"); // 0x00
$this->setTag(0x2d, "SyncML"); // 0x00
$this->setTag(0x2e, "Target"); // 0x00
$this->setTag(0x2f, "TargetRef"); // 0x00
$this->setTag(0x30, "Reserved for future use"); // 0x00
$this->setTag(0x31, "VerDTD"); // 0x00
$this->setTag(0x32, "VerProto"); // 0x00
$this->setTag(0x33, "NumberOfChanges"); // 0x00
$this->setTag(0x34, "MoreData"); // 0x00
$this->setTag(0x35, "Field"); // 0x00
$this->setTag(0x36, "Filter"); // 0x00
$this->setTag(0x37, "Record"); // 0x00
$this->setTag(0x38, "FilterType"); // 0x00
$this->setTag(0x39, "SourceParent"); // 0x00
$this->setTag(0x3a, "TargetParent"); // 0x00
$this->setTag(0x3b, "Move"); // 0x00
$this->setTag(0x3c, "Correlator"); // 0x00
if ($this->version == 1) {
$this->setCodePage(0, Horde_Xml_Wbxml_Dtd::SYNCML_1_1, 'syncml:syncml1.1');
$this->setCodePage(1, Horde_Xml_Wbxml_Dtd::METINF_1_1, 'syncml:metinf1.1');
$this->setURI('syncml:syncml1.1');
} elseif ($this->version == 2) {
$this->setCodePage(0, Horde_Xml_Wbxml_Dtd::SYNCML_1_2, 'syncml:syncml1.2');
$this->setCodePage(1, Horde_Xml_Wbxml_Dtd::METINF_1_2, 'syncml:metinf1.2');
$this->setURI('syncml:syncml1.2');
} else {
$this->setCodePage(0, Horde_Xml_Wbxml_Dtd::SYNCML_1_0, 'syncml:syncml1.0');
$this->setCodePage(1, Horde_Xml_Wbxml_Dtd::METINF_1_0, 'syncml:metinf1.0');
$this->setURI('syncml:syncml1.0');
}
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/Dtd/SyncMlDevInf.php 0000664 0000000 0000000 00000007027 12056370134 0030207 0 ustar 00root root 0000000 0000000
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml_Dtd_SyncMlDevInf extends Horde_Xml_Wbxml_Dtd
{
public function init()
{
/* this code table has been extracted from libwbxml
* (see http://libwbxml.aymerick.com/) by using
*
* grep '\"[^\"]*\", *0x.., 0x.. },' wbxml_tables.c
* | sed -e 's#^.*\"\([^\"]*\)\", *\(0x..\), \(0x..\) },.*$# \$this->setTag\(\3, \"\1\"\); // \2#g'
*/
$this->setTag(0x05, "CTCap"); // 0x00
$this->setTag(0x06, "CTType"); // 0x00
$this->setTag(0x07, "DataStore"); // 0x00
$this->setTag(0x08, "DataType"); // 0x00
$this->setTag(0x09, "DevID"); // 0x00
$this->setTag(0x0a, "DevInf"); // 0x00
$this->setTag(0x0b, "DevTyp"); // 0x00
$this->setTag(0x0c, "DisplayName"); // 0x00
$this->setTag(0x0d, "DSMem"); // 0x00
$this->setTag(0x0e, "Ext"); // 0x00
$this->setTag(0x0f, "FwV"); // 0x00
$this->setTag(0x10, "HwV"); // 0x00
$this->setTag(0x11, "Man"); // 0x00
$this->setTag(0x12, "MaxGUIDSize"); // 0x00
$this->setTag(0x13, "MaxID"); // 0x00
$this->setTag(0x14, "MaxMem"); // 0x00
$this->setTag(0x15, "Mod"); // 0x00
$this->setTag(0x16, "OEM"); // 0x00
$this->setTag(0x17, "ParamName"); // 0x00
$this->setTag(0x18, "PropName"); // 0x00
$this->setTag(0x19, "Rx"); // 0x00
$this->setTag(0x1a, "Rx-Pref"); // 0x00
$this->setTag(0x1b, "SharedMem"); // 0x00
$this->setTag(0x1c, "Size"); // 0x00
$this->setTag(0x1d, "SourceRef"); // 0x00
$this->setTag(0x1e, "SwV"); // 0x00
$this->setTag(0x1f, "SyncCap"); // 0x00
$this->setTag(0x20, "SyncType"); // 0x00
$this->setTag(0x21, "Tx"); // 0x00
$this->setTag(0x22, "Tx-Pref"); // 0x00
$this->setTag(0x23, "ValEnum"); // 0x00
$this->setTag(0x24, "VerCT"); // 0x00
$this->setTag(0x25, "VerDTD"); // 0x00
$this->setTag(0x26, "XNam"); // 0x00
$this->setTag(0x27, "XVal"); // 0x00
$this->setTag(0x28, "UTC"); // 0x00
$this->setTag(0x29, "SupportNumberOfChanges"); // 0x00
$this->setTag(0x2a, "SupportLargeObjs"); // 0x00
$this->setTag(0x2b, "Property"); // 0x00
$this->setTag(0x2c, "PropParam"); // 0x00
$this->setTag(0x2d, "MaxOccur"); // 0x00
$this->setTag(0x2e, "NoTruncate"); // 0x00
$this->setTag(0x30, "Filter-Rx"); // 0x00
$this->setTag(0x31, "FilterCap"); // 0x00
$this->setTag(0x32, "FilterKeyword"); // 0x00
$this->setTag(0x33, "FieldLevel"); // 0x00
$this->setTag(0x34, "SupportHierarchicalSync"); // 0x00
if ($this->version == 1) {
$this->setCodePage(0, Horde_Xml_Wbxml_Dtd::DEVINF_1_1, 'syncml:devinf1.1');
$this->setURI('syncml:devinf1.1');
} elseif ($this->version == 2) {
$this->setCodePage(0, Horde_Xml_Wbxml_Dtd::DEVINF_1_2, 'syncml:devinf1.2');
$this->setURI('syncml:devinf1.2');
} else {
$this->setCodePage(0, Horde_Xml_Wbxml_Dtd::DEVINF_1_0, 'syncml:devinf1.0');
$this->setURI('syncml:devinf1.0');
}
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/Dtd/SyncMlMetInf.php 0000664 0000000 0000000 00000004707 12056370134 0030220 0 ustar 00root root 0000000 0000000
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml_Dtd_SyncMlMetInf extends Horde_Xml_Wbxml_Dtd
{
public function init()
{
/* this code table has been extracted from libwbxml
* (see http://libwbxml.aymerick.com/) by using
*
* grep '\"[^\"]*\", *0x.., 0x.. },' wbxml_tables.c
* | sed -e 's#^.*\"\([^\"]*\)\", *\(0x..\), \(0x..\) },.*$# \$this->setTag\(\3, \"\1\"\); // \2#g'
*/
$this->setTag(0x05, "Anchor"); // 0x01
$this->setTag(0x06, "EMI"); // 0x01
$this->setTag(0x07, "Format"); // 0x01
$this->setTag(0x08, "FreeID"); // 0x01
$this->setTag(0x09, "FreeMem"); // 0x01
$this->setTag(0x0a, "Last"); // 0x01
$this->setTag(0x0b, "Mark"); // 0x01
$this->setTag(0x0c, "MaxMsgSize"); // 0x01
$this->setTag(0x15, "MaxObjSize"); // 0x01
$this->setTag(0x0d, "Mem"); // 0x01
$this->setTag(0x0e, "MetInf"); // 0x01
$this->setTag(0x0f, "Next"); // 0x01
$this->setTag(0x10, "NextNonce"); // 0x01
$this->setTag(0x11, "SharedMem"); // 0x01
$this->setTag(0x12, "Size"); // 0x01
$this->setTag(0x13, "Type"); // 0x01
$this->setTag(0x14, "Version"); // 0x01
$this->setTag(0x15, "MaxObjSize"); // 0x01
$this->setTag(0x16, "FieldLevel"); // 0x01
if ($this->version == 1) {
$this->setCodePage(0, Horde_Xml_Wbxml_Dtd::SYNCML_1_1, 'syncml:syncml1.1');
$this->setCodePage(1, Horde_Xml_Wbxml_Dtd::METINF_1_1, 'syncml:metinf1.1');
$this->setURI('syncml:metinf1.1');
} elseif ($this->version == 2) {
$this->setCodePage(0, Horde_Xml_Wbxml_Dtd::SYNCML_1_2, 'syncml:syncml1.2');
$this->setCodePage(1, Horde_Xml_Wbxml_Dtd::METINF_1_2, 'syncml:metinf1.2');
$this->setURI('syncml:metinf1.2');
} else {
$this->setCodePage(0, Horde_Xml_Wbxml_Dtd::SYNCML_1_0, 'syncml:syncml1.0');
$this->setCodePage(1, Horde_Xml_Wbxml_Dtd::METINF_1_0, 'syncml:metinf1.0');
$this->setURI('syncml:metinf1.0');
}
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/DtdManager.php 0000664 0000000 0000000 00000004730 12056370134 0027177 0 ustar 00root root 0000000 0000000
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml_DtdManager
{
/**
* @var array
*/
protected $_strDTD = array();
/**
* @var array
*/
protected $_strDTDURI = array();
/**
*/
public function __construct()
{
$this->registerDTD(Horde_Xml_Wbxml_Dtd::SYNCML_1_0, 'syncml:syncml1.0', new Horde_Xml_Wbxml_Dtd_SyncMl(0));
$this->registerDTD(Horde_Xml_Wbxml_Dtd::SYNCML_1_1, 'syncml:syncml1.1', new Horde_Xml_Wbxml_Dtd_SyncMl(1));
$this->registerDTD(Horde_Xml_Wbxml_Dtd::SYNCML_1_2, 'syncml:syncml1.2', new Horde_Xml_Wbxml_Dtd_SyncMl(2));
$this->registerDTD(Horde_Xml_Wbxml_Dtd::METINF_1_0, 'syncml:metinf1.0', new Horde_Xml_Wbxml_Dtd_SyncMlMetInf(0));
$this->registerDTD(Horde_Xml_Wbxml_Dtd::METINF_1_1, 'syncml:metinf1.1', new Horde_Xml_Wbxml_Dtd_SyncMlMetInf(1));
$this->registerDTD(Horde_Xml_Wbxml_Dtd::METINF_1_2, 'syncml:metinf1.2', new Horde_Xml_Wbxml_Dtd_SyncMlMetInf(2));
$this->registerDTD(Horde_Xml_Wbxml_Dtd::DEVINF_1_0, 'syncml:devinf1.0', new Horde_Xml_Wbxml_Dtd_SyncMlDevInf(0));
$this->registerDTD(Horde_Xml_Wbxml_Dtd::DEVINF_1_1, 'syncml:devinf1.1', new Horde_Xml_Wbxml_Dtd_SyncMlDevInf(1));
$this->registerDTD(Horde_Xml_Wbxml_Dtd::DEVINF_1_2, 'syncml:devinf1.2', new Horde_Xml_Wbxml_Dtd_SyncMlDevInf(2));
}
/**
*/
public function getInstance($publicIdentifier)
{
$publicIdentifier = Horde_String::lower($publicIdentifier);
if (isset($this->_strDTD[$publicIdentifier])) {
return $this->_strDTD[$publicIdentifier];
}
}
/**
*/
public function getInstanceURI($uri)
{
$uri = Horde_String::lower($uri);
if (isset($this->_strDTDURI[$uri])) {
return $this->_strDTDURI[$uri];
}
}
/**
*/
public function registerDTD($publicIdentifier, $uri, $dtd)
{
$dtd->setDPI($publicIdentifier);
$publicIdentifier = Horde_String::lower($publicIdentifier);
$this->_strDTD[$publicIdentifier] = $dtd;
$this->_strDTDURI[Horde_String::lower($uri)] = $dtd;
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/Encoder.php 0000664 0000000 0000000 00000032563 12056370134 0026555 0 ustar 00root root 0000000 0000000
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml_Encoder extends Horde_Xml_Wbxml_ContentHandler
{
protected $_strings = array();
protected $_stringTable;
protected $_hasWrittenHeader = false;
protected $_dtd;
protected $_output = '';
protected $_uris = array();
protected $_uriNums = array();
protected $_currentURI;
protected $_subParser = null;
protected $_subParserStack = 0;
/**
* The XML parser.
*
* @var resource
*/
protected $_parser;
/**
* The DTD Manager.
*
* @var Horde_Xml_Wbxml_DtdManager
*/
protected $_dtdManager;
/**
* Constructor.
*/
public function Horde_Xml_Wbxml_Encoder()
{
$this->_dtdManager = new Horde_Xml_Wbxml_DtdManager();
$this->_stringTable = new Horde_Xml_Wbxml_HashTable();
}
/**
* Take the input $xml and turn it into WBXML. This is _not_ the
* intended way of using this class. It is derived from
* Contenthandler and one should use it as a ContentHandler and
* produce the XML-structure with startElement(), endElement(),
* and characters().
*
* @throws Horde_Xml_Wbxml_Exception
*/
public function encode($xml)
{
// Create the XML parser and set method references.
$this->_parser = xml_parser_create_ns($this->_charset);
xml_set_object($this->_parser, $this);
xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false);
xml_set_element_handler($this->_parser, '_startElement', '_endElement');
xml_set_character_data_handler($this->_parser, '_characters');
xml_set_processing_instruction_handler($this->_parser, '');
xml_set_external_entity_ref_handler($this->_parser, '');
if (!xml_parse($this->_parser, $xml)) {
throw new Horde_Xml_Wbxml_Exception(
sprintf('XML error: %s at line %d',
xml_error_string(xml_get_error_code($this->_parser)),
xml_get_current_line_number($this->_parser)));
}
xml_parser_free($this->_parser);
return $this->_output;
}
/**
* This will write the correct headers.
*
* @throws Horde_Xml_Wbxml_Exception
*/
public function writeHeader($uri)
{
// @todo: this is a hack!
if ($this->_wbxmlVersion == 2 && !preg_match('/1\.2$/', $uri)) {
$uri .= '1.2';
}
if ($this->_wbxmlVersion == 1 && !preg_match('/1\.1$/', $uri)) {
$uri .= '1.1';
}
if ($this->_wbxmlVersion == 0 && !preg_match('/1\.0$/', $uri)) {
$uri .= '1.0';
}
$this->_dtd = $this->_dtdManager->getInstanceURI($uri);
if (!$this->_dtd) {
throw new Horde_Xml_Wbxml_Exception('Unable to find dtd for ' . $uri);
}
$dpiString = $this->_dtd->getDPI();
// Set Version Number from Section 5.4
// version = u_int8
// currently 1, 2 or 3
$this->writeVersionNumber($this->_wbxmlVersion);
// Set Document Public Idetifier from Section 5.5
// publicid = mb_u_int32 | ( zero index )
// zero = u_int8
// containing the value zero (0)
// The actual DPI is determined after the String Table is read.
$this->writeDocumentPublicIdentifier($dpiString, $this->_strings);
// Set Charset from 5.6
// charset = mb_u_int32
$this->writeCharset($this->_charset);
// Set String Table from 5.7
// strb1 = length *byte
$this->writeStringTable($this->_strings, $this->_charset, $this->_stringTable);
$this->_currentURI = $uri;
$this->_hasWrittenHeader = true;
}
public function writeVersionNumber($version)
{
$this->_output .= chr($version);
}
public function writeDocumentPublicIdentifier($dpiString, &$strings)
{
$i = 0;
// The OMA test suite doesn't like DPI as integer code.
// So don't try lookup and always send full DPI string.
// $i = Horde_Xml_Wbxml::getDPIInt($dpiString);
if ($i == 0) {
$strings[0] = $dpiString;
$this->_output .= chr(0);
$this->_output .= chr(0);
} else {
Horde_Xml_Wbxml::intToMBUInt32($this->_output, $i);
}
}
/**
* @throws Horde_Xml_Wbxml_Exception
*/
public function writeCharset($charset)
{
$cs = Horde_Xml_Wbxml::getCharsetInt($charset);
if ($cs == 0) {
throw new Horde_Xml_Wbxml_Exception('Unsupported Charset: ' . $charset);
} else {
Horde_Xml_Wbxml::intToMBUInt32($this->_output, $cs);
}
}
public function writeStringTable($strings, $charset, $stringTable)
{
$stringBytes = array();
$count = 0;
foreach ($strings as $str) {
$bytes = $this->_getBytes($str, $charset);
$stringBytes = array_merge($stringBytes, $bytes);
$nullLength = $this->_addNullByte($bytes);
$this->_stringTable->set($str, $count);
$count += count($bytes) + $nullLength;
}
Horde_Xml_Wbxml::intToMBUInt32($this->_output, count($stringBytes));
$this->_output .= implode('', $stringBytes);
}
public function writeString($str, $cs)
{
$bytes = $this->_getBytes($str, $cs);
$this->_output .= implode('', $bytes);
$this->writeNull($cs);
}
public function writeNull($charset)
{
$this->_output .= chr(0);
return 1;
}
protected function _addNullByte(&$bytes)
{
$bytes[] = chr(0);
return 1;
}
protected function _getBytes($string, $cs)
{
$nbytes = strlen($string);
$bytes = array();
for ($i = 0; $i < $nbytes; $i++) {
$bytes[] = $string{$i};
}
return $bytes;
}
protected function _splitURI($tag)
{
$parts = explode(':', $tag);
$name = array_pop($parts);
$uri = implode(':', $parts);
return array($uri, $name);
}
/**
* @throws Horde_Xml_Wbxml_Exception
*/
public function startElement($uri, $name, $attributes = array())
{
if ($this->_subParser == null) {
if (!$this->_hasWrittenHeader) {
$this->writeHeader($uri);
}
if ($this->_currentURI != $uri) {
$this->changecodepage($uri);
$this->_currentURI = $uri;
}
if ($this->_subParser == null) {
$this->writeTag($name, $attributes, true, $this->_charset);
} else {
$this->_subParser->startElement($uri, $name, $attributes);
}
} else {
$this->_subParserStack++;
$this->_subParser->startElement($uri, $name, $attributes);
}
}
protected function _startElement($parser, $tag, $attributes)
{
list($uri, $name) = $this->_splitURI($tag);
if (in_array(Horde_String::lower($uri), array('syncml:metinf', 'syncml:devinf'))) {
$uri .= '1.' . $this->getVersion();
}
$this->startElement($uri, $name, $attributes);
}
public function opaque($o)
{
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_OPAQUE);
Horde_Xml_Wbxml::intToMBUInt32($this->_output, strlen($o));
$this->_output .= $o;
}
public function characters($chars)
{
$chars = trim($chars);
if (strlen($chars)) {
/* We definitely don't want any whitespace. */
if ($this->_subParser == null) {
$i = $this->_stringTable->get($chars);
if ($i != null) {
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_STR_T);
Horde_Xml_Wbxml::intToMBUInt32($this->_output, $i);
} else {
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_STR_I);
$this->writeString($chars, $this->_charset);
}
} else {
$this->_subParser->characters($chars);
}
}
}
protected function _characters($parser, $chars)
{
$this->characters($chars);
}
/**
* @throws Horde_Xml_Wbxml_Exception
*/
public function writeTag($name, $attrs, $hasContent, $cs)
{
if ($attrs != null && !count($attrs)) {
$attrs = null;
}
$t = $this->_dtd->toTagInt($name);
if ($t == -1) {
$i = $this->_stringTable->get($name);
if ($i == null) {
throw new Horde_Xml_Wbxml_Exception($name . ' is not found in String Table or DTD');
} else {
if ($attrs == null && !$hasContent) {
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_LITERAL);
} elseif ($attrs == null && $hasContent) {
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_LITERAL_A);
} elseif ($attrs != null && $hasContent) {
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_LITERAL_C);
} elseif ($attrs != null && !$hasContent) {
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_LITERAL_AC);
}
Horde_Xml_Wbxml::intToMBUInt32($this->_output, $i);
}
} else {
if ($attrs == null && !$hasContent) {
$this->_output .= chr($t);
} elseif ($attrs == null && $hasContent) {
$this->_output .= chr($t | 64);
} elseif ($attrs != null && $hasContent) {
$this->_output .= chr($t | 128);
} elseif ($attrs != null && !$hasContent) {
$this->_output .= chr($t | 192);
}
}
if ($attrs != null && is_array($attrs) && count($attrs) > 0) {
$this->writeAttributes($attrs, $cs);
}
}
public function writeAttributes($attrs, $cs)
{
foreach ($attrs as $name => $value) {
$this->writeAttribute($name, $value, $cs);
}
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_END);
}
/**
* @throws Horde_Xml_Wbxml_Exception
*/
public function writeAttribute($name, $value, $cs)
{
$a = $this->_dtd->toAttribute($name);
if ($a == -1) {
$i = $this->_stringTable->get($name);
if ($i == null) {
throw new Horde_Xml_Wbxml_Exception($name . ' is not found in String Table or DTD');
} else {
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_LITERAL);
Horde_Xml_Wbxml::intToMBUInt32($this->_output, $i);
}
} else {
$this->_output .= $a;
}
$i = $this->_stringTable->get($name);
if ($i != null) {
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_STR_T);
Horde_Xml_Wbxml::intToMBUInt32($this->_output, $i);
} else {
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_STR_I);
$this->writeString($value, $cs);
}
}
public function endElement($uri, $name)
{
if ($this->_subParser == null) {
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_END);
} else {
$this->_subParser->endElement($uri, $name);
$this->_subParserStack--;
if ($this->_subParserStack == 0) {
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_OPAQUE);
Horde_Xml_Wbxml::intToMBUInt32($this->_output,
strlen($this->_subParser->getOutput()));
$this->_output .= $this->_subParser->getOutput();
$this->_subParser = null;
}
}
}
protected function _endElement($parser, $tag)
{
list($uri, $name) = $this->_splitURI($tag);
$this->endElement($uri, $name);
}
public function changecodepage($uri)
{
// @todo: this is a hack!
if ($this->_dtd->getVersion() == 2 && !preg_match('/1\.2$/', $uri)) {
$uri .= '1.2';
}
if ($this->_dtd->getVersion() == 1 && !preg_match('/1\.1$/', $uri)) {
$uri .= '1.1';
}
if ($this->_dtd->getVersion() == 0 && !preg_match('/1\.0$/', $uri)) {
$uri .= '1.0';
}
$cp = $this->_dtd->toCodePageURI($uri);
if (strlen($cp)) {
$this->_dtd = $this->_dtdManager->getInstanceURI($uri);
if (!$this->_dtd) {
throw new Horde_Xml_Wbxml_Exception('Unable to find dtd for ' . $uri);
}
$this->_output .= chr(Horde_Xml_Wbxml::GLOBAL_TOKEN_SWITCH_PAGE);
$this->_output .= chr($cp);
} else {
$this->_subParser = new Horde_Xml_Wbxml_Encoder(true);
$this->_subParserStack = 1;
}
}
/**
* Getter for property output.
*/
public function getOutput()
{
return $this->_output;
}
public function getOutputSize()
{
return strlen($this->_output);
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/Exception.php 0000664 0000000 0000000 00000000723 12056370134 0027125 0 ustar 00root root 0000000 0000000
* @category Horde
* @license http://www.horde.org/licenses/gpl GPL
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml_Exception extends Horde_Exception_Wrapped
{
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/HashTable.php 0000664 0000000 0000000 00000001010 12056370134 0027010 0 ustar 00root root 0000000 0000000
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml_HashTable
{
protected $_h;
public function set($k, $v)
{
$this->_h[$k] = $v;
}
public function get($k)
{
return isset($this->_h[$k]) ? $this->_h[$k] : null;
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/lib/Horde/Xml/Wbxml/LifoQueue.php 0000664 0000000 0000000 00000001607 12056370134 0027067 0 ustar 00root root 0000000 0000000
* @package Xml_Wbxml
*/
class Horde_Xml_Wbxml_LifoQueue
{
protected $_queue = array();
public function push($obj)
{
$this->_queue[] = $obj;
}
public function pop()
{
if (count($this->_queue)) {
return array_pop($this->_queue);
} else {
return null;
}
}
public function top()
{
if ($count = count($this->_queue)) {
return $this->_queue[$count - 1];
} else {
return null;
}
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/test/ 0000775 0000000 0000000 00000000000 12056370134 0021773 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/test/Horde/ 0000775 0000000 0000000 00000000000 12056370134 0023034 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/test/Horde/Xml/ 0000775 0000000 0000000 00000000000 12056370134 0023574 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/test/Horde/Xml/Wbxml/ 0000775 0000000 0000000 00000000000 12056370134 0024665 5 ustar 00root root 0000000 0000000 php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/test/Horde/Xml/Wbxml/AllTests.php 0000664 0000000 0000000 00000000132 12056370134 0027125 0 ustar 00root root 0000000 0000000 run();
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/test/Horde/Xml/Wbxml/DecodeTest.php 0000664 0000000 0000000 00000003166 12056370134 0027427 0 ustar 00root root 0000000 0000000
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @category Horde
* @package Xml_Wbxml
* @subpackage UnitTests
*/
class Horde_Xml_Wbxml_DecodeTest extends PHPUnit_Framework_TestCase
{
public function testDecode()
{
if (!is_executable('/usr/bin/wbxml2xml')) {
$this->markTestSkipped('/usr/bin/wbxml2xml is required for comparison tests.');
}
$decoder = new Horde_Xml_Wbxml_Decoder();
foreach (glob(__DIR__ . '/../../../../doc/Horde/Xml/Wbxml/examples/*.wbxml') as $file) {
$xml_ref = shell_exec('/usr/bin/wbxml2xml' . ' -m 0 -o - "' . $file . '" 2>/dev/null');
$xml_ref = preg_replace(
array(
// Ignore ]*>/',
// Normalize empty tags.
'|<([^>]+)/>|'),
array('', '<$1>$1>'),
$xml_ref);
$xml = $decoder->decodeToString(file_get_contents($file));
if (is_string($xml)) {
// Ignore ]*>/', '', $xml);
// Handle different mimetypes.
$xml = str_replace('application/vnd.syncml-devinf+wbxml',
'application/vnd.syncml-devinf+xml',
$xml);
}
$this->assertEquals(Horde_String::lower($xml_ref), Horde_String::lower($xml));
}
}
}
php-horde-xml-wbxml-2.0.1/Horde_Xml_Wbxml-2.0.1/test/Horde/Xml/Wbxml/bootstrap.php 0000664 0000000 0000000 00000000143 12056370134 0027411 0 ustar 00root root 0000000 0000000
php-horde-xml-wbxml-2.0.1/package.xml 0000664 0000000 0000000 00000031002 12056370134 0017437 0 ustar 00root root 0000000 0000000
Horde_Xml_Wbxmlpear.horde.orgXML_WBXMLHorde_Xml_Wbxml provides an API for encoding and decoding WBXML documents used in SyncML and other wireless applicationsEncoding and decoding of WBXML (Wireless Binary XML) documents. WBXML is used in SyncML for transferring smaller amounts of data with wireless devices.Chuck Hagenbuchchuckchuck@horde.orgyesJan Schneiderjanjan@horde.orgyes2012-11-192.0.11.0.0stablestableLGPL-2.1
* [mms] Use new Horde_Test layout.
5.3.01.7.0Horde_Utilpear.horde.org2.0.03.0.0alpha13.0.0alpha1Horde_Testpear.horde.org2.1.03.0.0alpha13.0.0alpha11.0.0beta11.0.0betabeta2011-03-16LGPL-2.1
* First beta release for Horde 4.
1.0.0RC11.0.0betabeta2011-03-22LGPL-2.1
* First release candidate for Horde 4.
1.0.0RC21.0.0betabeta2011-03-29LGPL-2.1
* Second release candidate for Horde 4.
1.0.01.0.0stablestable2011-04-06LGPL-2.1
* First stable release for Horde 4.
1.0.11.0.0stablestable2011-05-18LGPL-2.1
* [jan] Don't set codepage multiple times (Bug #9964).
1.0.21.0.0stablestable2011-09-20LGPL-2.1
* [jan] Fix incorrect syncml:metinf and syncml:devinf URNs (Bug #10229).
* [jan] Mark Xml_Wbxml:: methods as static.
1.0.31.0.0stablestable2011-10-11LGPL-2.1
* [jan] Complete fix for incorrect syncml:metinf and syncml:devinf URNs (Bug #10229).
2.0.0alpha11.0.0alphastable2012-07-06LGPL-2.1
* First alpha release for Horde 5.
2.0.0beta11.0.0betastable2012-07-19LGPL-2.1
* First beta release for Horde 5.
2.0.01.0.0stablestable2012-10-30LGPL-2.1
* First stable release for Horde 5.
2.0.11.0.0stablestable2012-11-19LGPL-2.1
* [mms] Use new Horde_Test layout.