Logo Search packages:      
Sourcecode: pcalendar version File versions  Download package

int net::sf::linuxorg::pcal::engine::Engine::getDocumentType ( Document  doc ) [inline, private]

Helper method for the loadFromFile

Parameters:
doc- the XML document to be analyzed
Returns:
FILE_TYPE_PLAIN if the document is proper plain not encrypted one, FILE_TYPE_ENCRYPTED if the document is proper encrypted one, FILE_TYPE_UNKNOWN if the document is improper or have wrong version

Definition at line 786 of file Engine.java.

Referenced by loadFromFile().

                                                 {

            int fileType = FILE_TYPE_UNKNOWN;

            NodeList nl = doc.getElementsByTagName("EncryptedData"); //$NON-NLS-1$
            if(nl.getLength() == 1) {
                  fileType = FILE_TYPE_ENCRYPTED;
            } else {
                  // check for the root tag first
                  Node n = doc.getFirstChild();
                  if(n.getNodeName().equals("pcalendar")) { //$NON-NLS-1$
                        nl = doc.getElementsByTagName("version"); //$NON-NLS-1$
                        if(nl.getLength() == 1) {
                              String file_version = nl.item(0).getTextContent();
                              if(file_version != null) {
                                    if(file_version.equals(FILE_VERSION)) {
                                          fileType = FILE_TYPE_PLAIN;
                                    }                       
                              }
                        }
                  }
            }

            return fileType;
      }

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index