[sync] WBXML Encoder is done

Anthony Mills amills at gascard.net
Sat Dec 6 10:06:35 PST 2003


I finished the Encoder.  It will not automaticly create opaque data like 
  I wanted, but it will work if you do it your self.  Not a big deal, I 
just could not make it work correctly.  I might try some other day. 
Patch is included.  I just removed the 0x0a byte at the end of the wbxml 
file.  The extra new line was picked up from the http packet.  If I get 
some time today, I'll start on SyncML RPC stuff.

Thanks,

Anthony
-------------- next part --------------
? patch.txt
? docs/examples/test-syncml_client_packet_1.xml.wbxml
? docs/examples/test-syncml_server_packet_1.xml.wbxml
Index: WBXML.php
===================================================================
RCS file: /repository/framework/XML_WBXML/WBXML.php,v
retrieving revision 1.8
diff -u -r1.8 WBXML.php
--- WBXML.php	4 Dec 2003 14:31:55 -0000	1.8
+++ WBXML.php	6 Dec 2003 18:00:27 -0000
@@ -113,7 +113,7 @@
     /**
      * Encoding Multi-byte Integers from Section 5.1
      */
-    function intToMBUInt32($i, $out)
+    function intToMBUInt32($out, $i)
     {
         if ($i > 268435455) {
             $bytes0 = 0 | XML_WBXML::getBits(0, $i);
@@ -122,39 +122,39 @@
             $bytes3 = 128 | XML_WBXML::getBits(3, $i);
             $bytes4 = 128 | XML_WBXML::getBits(4, $i);
 
-            fwrite($out, $bytes4);
-            fwrite($out, $bytes3);
-            fwrite($out, $bytes2);
-            fwrite($out, $bytes1);
-            fwrite($out, $bytes0);
+            fwrite($out, chr($bytes4));
+            fwrite($out, chr($bytes3));
+            fwrite($out, chr($bytes2));
+            fwrite($out, chr($bytes1));
+            fwrite($out, chr($bytes0));
         } elseif ($i > 2097151) {
             $bytes0 = 0 | XML_WBXML::getBits(0, $i);
             $bytes1 = 128 | XML_WBXML::getBits(1, $i);
             $bytes2 = 128 | XML_WBXML::getBits(2, $i);
             $bytes3 = 128 | XML_WBXML::getBits(3, $i);
 
-            fwrite($out, $bytes3);
-            fwrite($out, $bytes2);
-            fwrite($out, $bytes1);
-            fwrite($out, $bytes0);
+            fwrite($out, chr($bytes3));
+            fwrite($out, chr($bytes2));
+            fwrite($out, chr($bytes1));
+            fwrite($out, chr($bytes0));
         } elseif ($i > 16383) {
             $bytes0 = 0 | XML_WBXML::getBits(0, $i);
             $bytes1 = 128 | XML_WBXML::getBits(1, $i);
             $bytes2 = 128 | XML_WBXML::getBits(2, $i);
 
-            fwrite($out, $bytes2);
-            fwrite($out, $bytes1);
-            fwrite($out, $bytes0);
+            fwrite($out, chr($bytes2));
+            fwrite($out, chr($bytes1));
+            fwrite($out, chr($bytes0));
         } elseif ($i > 127) {
             $bytes0 = 0 | XML_WBXML::getBits(0, $i);
             $bytes1 = 128 | XML_WBXML::getBits(1, $i);
 
-            fwrite($out, $bytes1);
-            fwrite($out, $bytes0);
+            fwrite($out, chr($bytes1));
+            fwrite($out, chr($bytes0));
         } else {
             $bytes0 = 0 | XML_WBXML::getBits(0, $i);
 
-            fwrite($out, $bytes0);
+            fwrite($out, chr($bytes0));
         }
     }
 
@@ -198,8 +198,10 @@
                            11 => DPI_DTD_PROV_1_0,
                            12 => DPI_DTD_WTA_WML_1_2,
                            13 => DPI_DTD_CHANNEL_1_2,
-                           0xFD1 => DPI_DTD_SYNCML_1_1,
-                           0xFD2 => DPI_DTD_DEVINF_1_1);
+                           //not all SyncML clients know this, so we should use the string table
+                           //0xFD1 => DPI_DTD_SYNCML_1_1,
+                           //0xFD2 => DPI_DTD_DEVINF_1_1,
+                           );
 
         return isset($DPIString[$i]) ? $DPIString[$i] : null;
     }
@@ -222,10 +224,12 @@
                         DPI_DTD_PROV_1_0 => 11,
                         DPI_DTD_WTA_WML_1_2 => 12,
                         DPI_DTD_CHANNEL_1_2 => 13,
-                        DPI_DTD_SYNCML_1_1 => 0xFD1,
-                        DPI_DTD_DEVINF_1_1 => 0xFD2);
+                        //not all SyncML clients know this, so we should use the string table
+                        //DPI_DTD_SYNCML_1_1 => 0xFD1,
+                        //DPI_DTD_DEVINF_1_1 => 0xFD2,
+                        );
 
-        return isset($DPIInt[$dpi]) ? $DPIInt[$dpi] : null;
+        return isset($DPIInt[$dpi]) ? $DPIInt[$dpi] : 0;
     }
 
     /**
Index: WBXML/DTD.php
===================================================================
RCS file: /repository/framework/XML_WBXML/WBXML/DTD.php,v
retrieving revision 1.4
diff -u -r1.4 DTD.php
--- WBXML/DTD.php	4 Dec 2003 14:28:42 -0000	1.4
+++ WBXML/DTD.php	6 Dec 2003 18:00:27 -0000
@@ -50,6 +50,7 @@
 
     function setCodePage($intCodePage, $strCodePage, $strCodePageURI)
     {
+        //print('StrCodePagesURI ' . $strCodePageURI . ' intCodePage ' . $intCodePage . "\n");
         $this->strCodePagesURI[$strCodePageURI] = $intCodePage;
         $this->strCodePages[$strCodePage] = $intCodePage;
         $this->intCodePages[$intCodePage] = $strCodePage;
@@ -87,7 +88,10 @@
 
     function toCodePageURI($uri)
     {
-        return isset($this->strCodePagesURI[$uri]) ? $this->strCodePagesURI[$uri] : false;
+        $uri = strtolower($uri);        
+        $ret = isset($this->strCodePagesURI[$uri]) ? $this->strCodePagesURI[$uri] : false;
+
+        return $ret;
     }
 
     /**
Index: WBXML/Decoder.php
===================================================================
RCS file: /repository/framework/XML_WBXML/WBXML/Decoder.php,v
retrieving revision 1.8
diff -u -r1.8 Decoder.php
--- WBXML/Decoder.php	5 Dec 2003 18:58:42 -0000	1.8
+++ WBXML/Decoder.php	6 Dec 2003 18:00:27 -0000
@@ -91,7 +91,8 @@
         // version = u_int8
         // currently 1, 2 or 3
         $this->_wbxmlVersion = $this->getVersionNumber($input);
-
+        //debug
+        
         // Get Document Public Idetifier from Section 5.5
         // publicid = mb_u_int32 | (zero index)
         // zero = u_int8
@@ -102,6 +103,7 @@
         // Get Charset from 5.6
         // charset = mb_u_int32
         $this->_charset = $this->getCharset($input);
+        //debug
 
         // Get String Table from 5.7
         // strb1 = length *byte
@@ -111,7 +113,6 @@
         $this->_dpi = $this->getDocumentPublicIdentifierImpl($dpiStruct['dpiType'],
                                                              $dpiStruct['dpiNumber'],
                                                              $this->_stringTable);
-
         // Now the real fun begins.
         // from Sections 5.2 and 5.8
 
@@ -121,9 +122,6 @@
         // Default content handler.
         $this->_dtdManager = &new XML_WBXML_DTDManager();
 
-        $this->_tagDTD = $this->_dtdManager->getInstance('-//SYNCML//DTD SyncML 1.1//EN');
-        $this->_attributeDTD= $this->_tagDTD;
-
         // Get the starting DTD.
         $this->_tagDTD = $this->_dtdManager->getInstance($this->_dpi);
         $this->_attributeDTD= $this->_tagDTD;
@@ -573,3 +571,5 @@
     }
 
 }
+
+?>
Index: WBXML/Encoder.php
===================================================================
RCS file: /repository/framework/XML_WBXML/WBXML/Encoder.php,v
retrieving revision 1.12
diff -u -r1.12 Encoder.php
--- WBXML/Encoder.php	4 Dec 2003 04:17:10 -0000	1.12
+++ WBXML/Encoder.php	6 Dec 2003 18:00:27 -0000
@@ -1,6 +1,7 @@
 <?php
 
 include_once 'XML/WBXML.php';
+include_once 'XML/WBXML/ContentHandler.php';
 include_once 'XML/WBXML/DTDManager.php';
 include_once 'Horde/String.php';
 
@@ -17,10 +18,11 @@
  *
  * @package XML_WBXML
  */
-class XML_WBXML_Encoder {
+class XML_WBXML_Encoder extends XML_WBXML_ContentHandler {
 
     var $wbxmlVersion = 2;
-    var $charset = 'utf-8';
+    //need to be upper case
+    var $charset = 'UTF-8';
     var $strings = array();
 
     var $stringTable;
@@ -34,14 +36,17 @@
     var $uris = array();
 
     var $uriNums = array();
+    
+    var $currentURI;
 
-    var $indent = 0;
+    //var $indent = 0;
 
     var $subParser;
     var $subParserStack;
 
     // These will store the startElement params to see if we should
     // call startElementImp or startEndElementImp.
+    var $storeURI;
     var $storeName;
     var $storeAttributes;
 
@@ -68,6 +73,10 @@
 
         $this->stringTable = &new XML_WBXML_HashTable();
         $this->dtdManager = &new XML_WBXML_DTDManager();
+        $this->hasWrittenHeader = false;
+        
+        $this->subParser = null;
+        $this->subParserStack = 0;
     }
 
     function raiseError($error)
@@ -86,8 +95,8 @@
         $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_element_handler($this->_parser, '_startElement', '_endElement');
+        xml_set_character_data_handler($this->_parser, '_characters');
         xml_set_default_handler($this->_parser, 'defaultHandler');
         xml_set_processing_instruction_handler($this->_parser, '');
         xml_set_external_entity_ref_handler($this->_parser, '');
@@ -120,7 +129,7 @@
         // zero = u_int8
         // containing the value zero (0)
         // The actual DPI is determined after the String Table is read.
-        $this->writeDocumentPublicIdentifier($this->outputStream, $dpiString, $this->strings);
+        $this->writeDocumentPublicIdentifier($out, $dpiString, $this->strings);
 
         // Set Charset from 5.6
         // charset = mb_u_int32
@@ -129,35 +138,40 @@
         // Set String Table from 5.7
         // strb1 = length *byte
         $this->writeStringTable($out, $this->strings, $this->charset, $this->stringTable);
+        
+        $this->currentURI = $uri;
 
         $this->hasWrittenHeader = true;
     }
 
     function writeVersionNumber($out, $version)
     {
-        fwrite($out, $version);
+        //debug
+        fwrite($out, chr($version));
     }
 
     function writeDocumentPublicIdentifier($out, $dpiString, &$strings)
     {
         $i = XML_WBXML::getDPIInt($dpiString);
-
+        
+        //debug
         if ($i == 0) {
             array_unshift($strings, $dpiString);
             fwrite($out, chr(0));
             fwrite($out, chr(0));
         } else {
-            XML_WBXML::intToMBUInt32($i, $out);
+            XML_WBXML::intToMBUInt32($out, $i);
         }
     }
 
     function writeCharset($out, $charset)
     {
         $cs = XML_WBXML::getCharsetInt($charset);
+        
         if ($cs == 0) {
             return $this->raiseError('Unsupported Charset: ' . $charset);
         } else {
-            frwite($out, $cs);
+            XML_WBXML::intToMBUInt32($out, $cs);
         }
     }
 
@@ -173,7 +187,7 @@
             $count += count($bytes) + $nullLength;
         }
 
-        XML_WBXML::intToMBUInt32(count($stringBytes), $out);
+        XML_WBXML::intToMBUInt32($out, count($stringBytes));
         fwrite($out, implode('', $stringBytes));
     }
 
@@ -220,92 +234,108 @@
     /**
      * Has no content, 64.
      */
-    function startEndElementImp($name, $attributes)
+    function startEndElementImp($uri, $name, $attributes)
     {
-        list($uri, $tag) = $this->_splitURI($name);
-
         if (!$this->hasWrittenHeader) {
             $this->writeHeader($this->outputStream, $uri);
         }
 
-        $this->switchCodePage($this->outputStream, $uri);
+        //$this->switchCodePage($this->outputStream, $uri);
 
-        $this->writeTag($this->outputStream, $tag, $attributes, false, $this->charset);
+        $this->writeTag($this->outputStream, $name, $attributes, false, $this->charset);
     }
 
-    function startElementImp($name, $attributes)
+    function startElementImp($uri, $name, $attributes)
     {
-        list($uri, $tag) = $this->_splitURI($name);
-
         if (!$this->hasWrittenHeader) {
             $this->writeHeader($this->outputStream, $uri);
         }
 
-        $this->switchCodePage($this->outputStream, $uri);
-
-        $this->writeTag($this->outputStream, $tag, $attributes, true, $this->charset);
-
         $this->pushCurrentURI($uri);
-        $this->indent++;
+        
+        $this->writeTag($this->outputStream, $name, $attributes, true, $this->charset);
+
+        //$this->indent++;
     }
 
     function writeStartElement($isEnd)
     {
         if ($this->storeName != null) {
             if ($isEnd) {
-                $this->startEndElementImp($this->storeName, $this->storeAttributes);
+                $this->startEndElementImp($this->storeURI, $this->storeName, $this->storeAttributes);
             } else {
-                $this->startElementImp($this->storeName, $this->storeAttributes);
+                $this->startElementImp($this->storeURI, $this->storeName, $this->storeAttributes);
             }
 
+            $this->storeURI = null;
             $this->storeName = null;
             $this->storeAttributes = null;
         }
     }
 
-    function startElement($parser, $name, $attributes)
+    function startElement($uri, $name, $attributes)
     {
+        //$this->_padspaces();
+        //print('<' . $name . ' sub="' . $this->subParser . '" xmlns="' . $uri . "\" $this->subParserStack>\n");
+        
         if ($this->subParser == null) {
             $this->writeStartElement(false);
+            $this->storeURI = $uri;
             $this->storeName = $name;
             $this->storeAttributes = $attributes;
-        } else {
-            $this->subParser->startElement($parser, $name, $attributes);
+        } else {            
+            $this->_padspaces();
+            //$this->subParser->startElement($uri, $name, $attributes);
             $this->subParserStack++;
         }
     }
+    
+    function _startElement($parser, $tag, $attributes)
+    {
+        list($uri, $name) = $this->_splitURI($tag);
+
+        $this->startElement($uri, $name, $attributes);
+    }
 
     function opaque($bytes)
     {
         if ($this->subParser == null) {
             $this->writeStartElement(false);
 
-            fwrite($this->outputStream, XML_WBXML_GLOBAL_TOKEN_OPAQUE);
-            XML_WBXML::intToMBUInt32(count($bytes), $this->outputStream);
+            fwrite($this->outputStream, chr(XML_WBXML_GLOBAL_TOKEN_OPAQUE));
+            XML_WBXML::intToMBUInt32($this->outputStream, count($bytes));
             fwrite($this->outputStream, $bytes);
         }
     }
 
-    function characters($parser, $chars)
+    function characters($chars)
     {
-        /* We definitely don't want any whitespace. */
         $chars = trim($chars);
-
-        if ($this->subParser == null) {
-            $this->writeStartElement(false);
-
-            $i = $this->stringTable->get($chars);
-            if ($i != null) {
-                fwrite($this->outputStream, XML_WBXML_GLOBAL_TOKEN_STR_T);
-                XML_WBXML::intToMBUInt32($i, $this->outputStream);
-            } else {
-                fwrite($this->outputStream, XML_WBXML_GLOBAL_TOKEN_STR_I);
-                $this->writeString($this->outputStream, $chars, $this->charset);
+        
+        if (strlen($chars)) {
+            /* We definitely don't want any whitespace. */
+
+            if ($this->subParser == null) {
+                $this->writeStartElement(false);
+
+                $i = $this->stringTable->get($chars);
+                if ($i != null) {
+                    fwrite($this->outputStream, chr(XML_WBXML_GLOBAL_TOKEN_STR_T));
+                    XML_WBXML::intToMBUInt32($this->outputStream, $i);
+                } else {
+                    fwrite($this->outputStream, chr(XML_WBXML_GLOBAL_TOKEN_STR_I));
+                    $this->writeString($this->outputStream, $chars, $this->charset);
+                }
+            //} else {
+                //$this->subParser->characters($chars);
             }
-        } else {
-            $this->subParser->characters($chars);
         }
     }
+    
+    function _characters($parser, $chars)
+    {        
+        $this->characters($chars);
+    }
 
     function defaultHandler($parser, $data)
     {
@@ -324,26 +354,26 @@
                 return $this->raiseError($name . ' is not found in String Table or DTD');
             } else {
                 if ($attrs == null && !$hasContent) {
-                    fwrite($out, XML_WBXML_GLOBAL_TOKEN_LITERAL);
+                    fwrite($out, chr(XML_WBXML_GLOBAL_TOKEN_LITERAL));
                 } elseif ($attrs == null && $hasContent) {
-                    fwrite($out, XML_WBXML_GLOBAL_TOKEN_LITERAL_A);
+                    fwrite($out, chr(XML_WBXML_GLOBAL_TOKEN_LITERAL_A));
                 } elseif ($attrs != null && $hasContent) {
-                    fwrite($out, XML_WBXML_GLOBAL_TOKEN_LITERAL_C);
+                    fwrite($out, chr(XML_WBXML_GLOBAL_TOKEN_LITERAL_C));
                 } elseif ($attrs != null && !$hasContent) {
-                    fwrite($out, XML_WBXML_GLOBAL_TOKEN_LITERAL_AC);
+                    fwrite($out, chr(XML_WBXML_GLOBAL_TOKEN_LITERAL_AC));
                 }
 
-                XML_WBXML::intToMBUInt32($i, $out);
+                XML_WBXML::intToMBUInt32($out, $i);
             }
         } else {
             if ($attrs == null && !$hasContent) {
-                fwrite($out, $t);
+                fwrite($out, chr($t));
             } elseif ($attrs == null && $hasContent) {
-                fwrite($out, $t | 64);
+                fwrite($out, chr($t | 64));
             } elseif ($attrs != null && $hasContent) {
-                fwrite($out, $t | 128);
+                fwrite($out, chr($t | 128));
             } elseif ($attrs != null && !$hasContent) {
-                fwrite($out, $t | 192);
+                fwrite($out, chr($t | 192));
             }
         }
 
@@ -358,7 +388,7 @@
             $this->writeAttribute($out, $name, $value, $cs);
         }
 
-        fwrite($out, XML_WBXML_GLOBAL_TOKEN_END);
+        fwrite($out, chr(XML_WBXML_GLOBAL_TOKEN_END));
     }
 
     function writeAttribute($out, $name, $value, $cs)
@@ -369,8 +399,8 @@
             if ($i == null) {
                 return $this->raiseError($name . ' is not found in String Table or DTD');
             } else {
-                fwrite($out, XML_WBXML_GLOBAL_TOKEN_LITERAL);
-                XML_WBXML::intToMBUInt32($i, $out);
+                fwrite($out, chr(XML_WBXML_GLOBAL_TOKEN_LITERAL));
+                XML_WBXML::intToMBUInt32($out, $i);
             }
         } else {
             fwrite($out, $a);
@@ -378,101 +408,108 @@
 
         $i = $this->stringTable->get($name);
         if ($i != null) {
-            fwrite($out, XML_WBXML_GLOBAL_TOKEN_STR_T);
-            XML_WBXML::intToMBUInt32($i, $out);
+            fwrite($out, chr(XML_WBXML_GLOBAL_TOKEN_STR_T));
+            XML_WBXML::intToMBUInt32($out, $i);
         } else {
-            fwrite($out, XML_WBXML_GLOBAL_TOKEN_STR_I);
+            fwrite($out, chr(XML_WBXML_GLOBAL_TOKEN_STR_I));
             $this->writeString($out, $value, $cs);
         }
     }
 
+    /*
     function switchCodePage($out, $uri)
     {
-        if (!$this->isCurrentURI($uri)) {
-            $cp = $this->dtd->toCodePageURI($uri);
-
-            if ($cp != -1) {
-                $this->dtd = &$this->dtdManager->getInstanceURI($uri);
-
-                fwrite($out, chr(0));
-                fwrite($out, $cp);
-            } else {
-                fwrite($out, XML_WBXML_GLOBAL_TOKEN_OPAQUE);
-
-                $this->subParser = &new XML_WBXML_Encoder($this->outputStream);
-                $this->subParser->startElement($this->storeName,
-                                               $this->storeAttributes);
-
-                $this->storeName = null;
-                $this->storeAttributes = null;
-            }
-        }
     }
+    */
 
-    function endElement($parser, $name)
+    function endElement($uri, $name)
     {
+        //$this->_padspaces();
         if ($this->subParser == null) {
             $this->writeStartElement(false);
             $this->popCurrentURI();
-            $this->indent--;
-
-            fwrite($this->outputStream, XML_WBXML_GLOBAL_TOKEN_END);
+            fwrite($this->outputStream, chr(XML_WBXML_GLOBAL_TOKEN_END));
         } else {
-            $this->subParser->endElement($parser, $name);
+            //$this->subParser->endElement($parser, $name);
 
             $this->subParserStack--;
             if ($this->subParserStack == 0) {
                 unset($this->subParser);
             }
+            
         }
+        
     }
-
-    function pushCurrentURI($uri)
+    
+    function _endElement($parser, $tag)
     {
-        if (count($this->uris) && $uri == $this->uris[count($this->uris) - 1]) {
-            $this->uriNums[count($this->uris) - 1]++;
-        } else {
-            $this->uris[] = $uri;
-            $this->uriNums[] = 1;
-        }
+        list($uri, $name) = $this->_splitURI($tag);
+        
+        $this->endElement($uri, $name);
     }
-
-    function popCurrentURI()
+    
+    function _padspaces()
     {
-        $num = $this->uriNums[count($this->uriNums) - 1];
-        if ($num <= 1) {
-            array_pop($this->uris);
-            array_pop($this->uriNums);
-
-            if (count($this->uris)) {
-                $uri = $this->uris[count($this->uris) - 1];
-                $this->dtd = &$this->dtdManager->getInstanceURI($uri);
-                fwrite($this->outputStream, chr(0));
-                fwrite($this->outputStream, $this->dtd->toCodePageURI($uri));
-            }
-        } else {
-            $this->uriNums[count($this->uriNums) - 1]--;
+        if ($this->_indent > 0) {
+            print(str_repeat(' ', $this->_indent));
         }
     }
+    
+    var $_indent = 0;
+    
+    function pushCurrentURI($uri)
+    {        
+        if ($this->currentURI != $uri) {
+            $this->changecodepage($uri);
+        }
+        
+        $this->uris[] = $uri;
+
+        $this->currentURI = $uri;
+                
+        $this->_indent++;
+    }
+    
 
-    function isCurrentURI($uri)
+    function popCurrentURI()
     {
+        $this->_indent--;
+                
         if (count($this->uris)) {
-            return ($uri == $this->uris[count($this->uris) - 1]);
-        } else {
-            return false;
+            $uri = array_pop($this->uris);
+        }
+        
+        if ($uri != $this->currentURI) {
+            $this->changecodepage($uri);
+        }
+        
+        $this->currentURI = $uri;
+    }
+    
+    function changecodepage($uri) {
+    
+        $cp = $this->dtd->toCodePageURI($uri);
+        
+        if (strlen($cp)) {
+            $this->dtd = &$this->dtdManager->getInstanceURI($uri);
+            
+            fwrite($this->outputStream, chr(XML_WBXML_GLOBAL_TOKEN_SWITCH_CODE_PAGE));
+            fwrite($this->outputStream, chr($cp));
+            
+        } else {            
+            fwrite($this->outputStream, chr(XML_WBXML_GLOBAL_TOKEN_OPAQUE));
+            
+            $this->subParser = &new XML_WBXML_Encoder($this->outputStream);
+            $this->startElement($this->storeURI, $this->storeName, $this->storeAttributes);
+
+            $this->subParserStack = 2;
+            
+            $this->storeURI = null;
+            $this->storeName = null;
+            $this->storeAttributes = null;
         }
     }
-
-    /**
-     * Getter for property outputStream.
-     * @return Value of property outputStream.
-     */
-    function getOutputStream()
-    {
-        return $this->outputStream;
-    }
-
+    
     /**
      * Setter for property outputStream.
      * @param outputStream New value of property outputStream.
Index: docs/examples/decode.php
===================================================================
RCS file: /repository/framework/XML_WBXML/docs/examples/decode.php,v
retrieving revision 1.4
diff -u -r1.4 decode.php
--- docs/examples/decode.php	5 Dec 2003 18:58:43 -0000	1.4
+++ docs/examples/decode.php	6 Dec 2003 18:00:27 -0000
@@ -8,7 +8,7 @@
 
 $decoder = &new XML_WBXML_Decoder();
 
-$input = fopen('syncml_server_packet_1.wbxml', 'rb');
+$input = fopen('syncml_client_packet_1.wbxml', 'rb');
 
 $decoder->decode($input);
 
Index: docs/examples/encode.php
===================================================================
RCS file: /repository/framework/XML_WBXML/docs/examples/encode.php,v
retrieving revision 1.5
diff -u -r1.5 encode.php
--- docs/examples/encode.php	4 Dec 2003 14:57:45 -0000	1.5
+++ docs/examples/encode.php	6 Dec 2003 18:00:27 -0000
@@ -5,6 +5,7 @@
  */
 
 include_once 'XML/WBXML/Encoder.php';
+include_once 'XML/WBXML/Decoder.php';
 
 $test_file = 'syncml_client_packet_1.xml';
 
@@ -15,3 +16,14 @@
 
 $xml = file_get_contents($test_file);
 $encoder->encode($xml);
+
+fclose($fp);
+
+$decoder = &new XML_WBXML_Decoder();
+
+$input = fopen('test-' . $test_file . '.wbxml', 'rb');
+
+$decoder->decode($input);
+
+fclose($input);
+
Index: docs/examples/syncml_client_packet_1.wbxml
===================================================================
RCS file: /repository/framework/XML_WBXML/docs/examples/syncml_client_packet_1.wbxml,v
retrieving revision 1.1
diff -u -r1.1 syncml_client_packet_1.wbxml
Binary files /tmp/cvs4Nj4EM and syncml_client_packet_1.wbxml differ
Index: docs/examples/syncml_server_packet_1.wbxml
===================================================================
RCS file: /repository/framework/XML_WBXML/docs/examples/syncml_server_packet_1.wbxml,v
retrieving revision 1.1
diff -u -r1.1 syncml_server_packet_1.wbxml
Binary files /tmp/cvsv6QBCF and syncml_server_packet_1.wbxml differ


More information about the sync mailing list