Abstract:
A method, machine readable medium, and system are disclosed. In one embodiment the method comprises optimizing a web-based markup language document by removing all non-functional characters, compressing the document, storing the compressed and optimized document directly in a universal plug and play stack, and decompressing and transmitting the document in real-time in response to any given access request.

Description:
FIELD OF THE INVENTION  
       [0001]     The invention is related to the Internet. More specifically, the invention relates to compression and optimization of markup language documents in a Universal Plug and Play environment.  
       BACKGROUND OF THE INVENTION  
       [0002]     The advent of the Universal Plug and Play (UPnP) standard has led to new benefits of communication and interoperability between many devices connected to a network. UPnP enables the discovery and control of networked devices and services, such as mobile computers, servers, printers, and consumer electronic devices. A UPnP-enabled device can dynamically connect to a network, obtain an IP address, convey its capabilities, and learn about the presence and capabilities of other devices without any user intervention. As computing and network technology is incorporated within more and more devices and appliances the demand for small, fast, and efficient UPnP technology becomes greater.  
         [0003]     Unlike the desktop PCs of today, many potential UPNP devices do not have powerful CPUs or large storage capabilities. Many handheld devices such as personal digital assistants (PDAs), cell phones, and remote controls among others benefit from UPNP functionality. Additionally, electronic appliances such as dishwashers, TVs, and refrigerators can also take advantage of UPnP capabilities to create a truly network connected home or business. To accomplish this connectivity and communication among these wide range of devices UPnP provides support for communication between devices. The actual network, the TCP/IP protocol, and HTTP provide basic network connectivity and addressing. On top of these standard Internet-based protocols, UPnP defines a UPnP protocol stack to handle discovery, description, control, events, and presentation among the connected devices.  
         [0004]     The UPnP stack must be very small in order to run not only on PCs but also on all the small embedded devices such as digital cameras, audio players, remote controls, etc. A common UPnP stack is about 60-90 Kbytes, but about 20-25% of that size are static or mostly static Extensible Markup Language (XML) documents. XML documents, in regard to UPnP, are used for device and service descriptions, control messages, and eventing. All UPnP devices must be able to describe themselves upon request. The description of a UPnP device is encoded in a device description document and one or more service description documents.  
         [0005]     Therefore, what is needed is a method for effectively optimizing and compressing these XML documents for storage on a device as well as for efficiently decompressing the documents on the fly when a document located on a device is requested by another device or control point on the network.  
     
    
     BRIEF DESCRIPTION OF DRAWINGS  
       [0006]     The present invention is illustrated by way of example and is not limited by the figures of the accompanying drawings, in which like references indicate similar elements, and in which:  
         [0007]      FIG. 1  illustrates an overview of the functionality of one embodiment of the present invention.  
         [0008]      FIG. 2  illustrates a process of steps that detail one embodiment of the present invention.  
         [0009]      FIG. 3  illustrates a process of steps that detail the compression scheme in one embodiment of the present invention.  
         [0010]      FIG. 4  illustrates one example of the compression scheme working in one embodiment of the present invention.  
     
    
     DETAILED DESCRIPTION  
       [0011]     Embodiments of an efficient universal plug-and-play markup language document optimization and compression scheme are disclosed. In the following description, numerous specific details are set forth. However, it is understood that embodiments may be practiced without these specific details. In other instances, well-known circuits, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.  
         [0012]     Reference throughout this specification to “one embodiment” or “an embodiment” indicate that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, the appearances of the phrases “in one embodiment” or “in an embodiment” in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.  
         [0013]      FIG. 1  illustrates an overview of the functionality of one embodiment of the present invention. In one embodiment a given UPnP XML document  100  is added to the UPNP stack within a UPnP-enabled device. This document could be any one of a number of XML documents added to the UPNP stack for the device such as the device description document or a service description document among others. Next, the Device Builder  102  receives the document and makes a first pass by optimizing the document in the XML Optimizer  104 . The XML Optimizer  104  removes all excess characters from the XML document such as comments, line feeds, carriage returns, spaces and tabs. This pares the XML document down to its essential size, the only characters remaining are the data within the document and the functional scripting characters used in the XML language. The optimized XML page is sent to the XML Compressor  106 , which compresses the document down to a nearly optimal size.  
         [0014]     The document is then stored as compressed XML  110  directly in the UPnP stack, referred to as the Microstack  108  because of the smaller size with the optimized and compressed XML document. When the device fields a request from a second device for the document, such as a request for the device description, the Compressed XML document is decompressed on the fly as it is being transmitted to the second device. This decompression is completed by the Micro-extractor  112 . Upon completion of the decompression the document will have been extracted from the stack and transmitted to the second device. The resulting UPnP XML document is functionally and data equivalent to UPNP XML document  100 . UPNP devices can also act as an HTTP server for their presentation web pages. Thus, in another embodiment of the invention the document could be an HTML document, which can be decompressed and served on the fly similarly to an XML document. In yet another embodiment, the document can be any other web-based markup language that has similar qualities to XML or HTML.  
         [0015]      FIG. 2  illustrates a process of steps that detail one embodiment of the present invention. At the start  200  of the process a web-based markup language document is optimized by removing all non-functional characters in the document  202 . Next, the web-based markup language document is compressed  204 . One embodiment of the compression scheme used to compress the document is detailed in  FIGS. 3 and 4 . In another embodiment the compression scheme used could be any standard compression algorithm. Next, the compressed and optimized document is stored directly in a universal plug and play stack  206 . Finally, the document is decompressed and transmitted in real-time in response to any given access request  208  and the process is finished  210 .  
         [0016]      FIG. 3  illustrates a process of steps that detail the compression scheme in one embodiment of the present invention. At the start  300  of the process a web-based markup language document is parsed into a stream of individual characters  302 . Next, a first set of characters is input from the stream into a memory buffer  304 . Then, once the buffer has been loaded with the first set of characters, subsequent characters are appended to the buffer from the stream  306 . The next step is to check whether a consecutive sequence of the subsequent characters that have been added to the buffer matches any consecutive block of characters currently in the buffer  308 . This check is done as each character is added to the buffer. In one embodiment, the check is done for the entire set of characters in the memory buffer. In another embodiment the check is only done within a sliding window in the buffer. The window can be of varying size and have various requirements. A standard window size is on the order of 1-Kbyte but will change depending on the document type as well as the specific type of data within the document. In one embodiment, the window will slide and remain over the most recent characters input into the buffer. If there is no match then there is another check to determine whether the document has come to and end and, thus, there are no more characters arriving from the stream. If the file has come to an end the process is finished  312 , otherwise the process returns to  306  where more characters are appended to the buffer.  
         [0017]     On the other hand, if there is a match found the set of consecutive subsequent characters that do match a block of consecutive characters in the buffer is replaced with a look-back pointer value to the location in the buffer that points to the start of the consecutive block and a value that corresponds to the length of the block  310 . This allows the entire set of subsequent appended characters to be replaced by a two-byte value and the document decreases in size by the length of the block minus two bytes. Therefore, the minimum number of sequential characters that need to match in order for a decrease in size is three because otherwise there wouldn&#39;t be a size decrease. In one embodiment the minimum size required to justify a pointer/length value replacement would need to be more than three characters because of the overhead associated with the replacement. Finally, there is a check to see if the file has come to an end after the replacement. If this is the case then the process finishes  312 , otherwise the process returns to  306  where more characters are appended to the buffer.  
         [0018]     The size in bits of the pointer and length values in the two-byte replacement value can be distributed in various arrangements. Depending on the type of document, the size of the sliding window, and the speed of the device the pointer value can longer, shorter, or the same length in bits as the length value. For example, in one embodiment the pointer can be a 10-bit value (which would allow the pointer to point backwards into the buffer at up to 1-Kbyte) and the block length would therefore be a 6-bit value (which would allow matching blocks up to 64 bytes long). Alternatively, in another embodiment the pointer can be an 8-bit value (which would allow the pointer to point backwards into the buffer at up to 256 bytes) and the block length would therefore be also an 8-bit value (which would allow matching blocks up to 256 bytes long). Other differing bit length pairs of values can be used in other embodiments to utilize the compression scheme most efficiently. In another embodiment, the replacement value would not be two bytes but some other number of bits greater or less than two bytes.  
         [0019]      FIG. 4  illustrates one example of the compression scheme working in one embodiment of the present invention. In one embodiment a first set of characters from a web-based document is input into a memory buffer  400 . Additional characters from the web-based document are appended to the end of the memory buffer ( 402 - 410 ). A match is found between a consecutive set of characters that reside in the buffer  412  and a consecutive set of characters that have been input and appended to the end of the buffer  414 . Instead of just leaving the matching set  414  appended to the end of the memory buffer  400 , the matching set  414  is replaced with a pointer value  418  to the location in the memory buffer where the block begins (position 2 in the buffer) and a length value  420  to notify how many characters the block length is (length of 5). Once this replacement process is complete more characters  422  are appended to the newly modified memory buffer  416 .  
         [0020]     Upon completion of the compression algorithm a compressed web-based document such as the UPNP device description document or a UPnP service description document is stored directly in the UPnP stack on the device. This algorithm can be repeated for all compatible web-based documents that are to be stored on the UPNP stack located on the device. The document compression scheme should allow somewhere between a 6:1 to 9.5:1 compression ratio, which reduces the memory/storage space required to Depending on the amount and size of the web-based documents the entire UPnP stack footprint on the memory/storage located on the device can be reduced by 10% or greater. This is significant considering many of these devices are handheld and have limited storage capacity.  
         [0021]     Once the device with the UPNP stack is accessed by a second device or control point on the network, the compressed documents must be decompressed by the Micro-extractor prior to being transferred to the second device. The decompression algorithm can be implemented in as small as 10 lines of code. It specifically is just a reversed process of the compression algorithm described above and in  FIGS. 3 and 4 . In one embodiment, the compression algorithm can be modified to only compress sequences of data over a certain size to balance the storage capabilities of the device with the processing power of the device to allow decompression in real-time as the documents are being accessed.  
         [0022]     In another embodiment, outside the current space of UPNP, a compressed web-based document stored on a first device can be sent to a second requesting device as a compressed document and then decompressed on-the-fly on the second device. In yet another embodiment, the Micro-extractor can be embedded within the web-based document itself so the extraction capabilities are self-contained within the document such as in a Javascript routine. The document can be sent from one device to a second device compressed and the second device can use the compression algorithm embedded within the document to decompress the document. An embedded compression algorithm can be modified on a document by document basis to account for content, device speed, device storage capability, and transfer speed.  
         [0023]     Thus, an efficient UPnP markup language document optimization and compression scheme is disclosed. These embodiments have been described with reference to specific exemplary embodiments thereof. It will, however, be evident to persons having the benefit of this disclosure that various modifications and changes may be made to these embodiments without departing from the broader spirit and scope of the embodiments described herein. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.