com.funambol.syncml.spds
Class SyncMLParser

java.lang.Object
  extended by com.funambol.syncml.spds.SyncMLParser

public class SyncMLParser
extends java.lang.Object

This class is meant to provide a SyncML parser. Such a parser reads a SyncML message and builds a representation of this message based on the objects provided by the com.funambol.syncml.protocol objects. The implementation is based on KXml and relies on its XmlPull interface. As such it is capable of parsing both XML and WBXML. At the moment the implementation is restricted to some components of the SyncML message. In particular the DevInf section. This parser performs a relaxed parsing, allowing unknown tokens to be parsed. These tokens are simply skipped and they are not reflected into the SyncML representation.


Constructor Summary
SyncMLParser()
           
 
Method Summary
 DevInf parsePut(java.lang.String put)
          Parse a put command of a SyncML message.
 DevInf parseResults(java.lang.String results)
          Parse the results section of the server response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncMLParser

public SyncMLParser()
Method Detail

parseResults

public DevInf parseResults(java.lang.String results)
                    throws SyncMLParserException
Parse the results section of the server response. At the moment this method assumes this section contains only the server device info. This is not true in general, but this is currently a limitation. In the future it will be made more general.

Parameters:
results - is the results section of the server response. This value shall not contain the <Results> tag
Returns:
a DevInf object representing the DeviceInfo
Throws:
SyncMLParserException - if the text cannot be parser properly. Note that if the text contains unknown tags, they are simply skipped, but if it has malformed xml, an exception is thrown.

parsePut

public DevInf parsePut(java.lang.String put)
                throws SyncMLParserException
Parse a put command of a SyncML message. At the moment this method assumes this section contains only the server device info. This is not true in general, but this is currently a limitation. In the future it will be made more general.

Parameters:
put - is the put command of the server response. This value shall not contain the <Results> tag
Returns:
a DevInf object representing the DeviceInfo
Throws:
SyncMLParserException - if the text cannot be parser properly. Note that if the text contains unknown tags, they are simply skipped, but if it has malformed xml, an exception is thrown.


Copyright © 2001-2009 Funambol.