internal void Load(XElement xDocumentInfo)
        {
            if (xDocumentInfo == null)
            {
                throw new ArgumentNullException("xDocumentInfo");
            }


            // Load document authors 
            _documentAuthors.Clear();
            IEnumerable<XElement> xAuthors = xDocumentInfo.Elements(_fileNameSpace + AuthorType.AuthorElementName);
            if ( xAuthors != null )
            {
                foreach ( XElement xAuthor in xAuthors)
                {
                    AuthorItem author = new AuthorItem{ Namespace = _fileNameSpace };
                    try
                    {
                        author.Load(xAuthor);
                        _documentAuthors.Add(author);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(string.Format("Error reading document authors : {0}",ex.Message));
                        continue;
                    }
                }
            }

            // load Program used to create
            ProgramUsed2Create = null;
            XElement xProgramUsed = xDocumentInfo.Element(_fileNameSpace + ProgramUsedElementName);
            if (xProgramUsed != null) 
            {
                ProgramUsed2Create = new TextFieldType();
                try
                {
                    ProgramUsed2Create.Load(xProgramUsed);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(string.Format("Error reading program used to create : {0}", ex.Message));
                }
            }

            // Load creation date 
            DocumentDate = null;
            XElement xDate = xDocumentInfo.Element(_fileNameSpace + DateItem.Fb2DateElementName);
            if (xDate != null)
            {
                DocumentDate = new DateItem();
                try
                {
                    DocumentDate.Load(xDate);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(string.Format("Error reading document date : {0}", ex.Message));
                }
            }

            // Load Source URLs
            _sourceUrLs.Clear();
            IEnumerable<XElement> xSrcURLs = xDocumentInfo.Elements(_fileNameSpace + SourceURLElementName);
            if ( xSrcURLs != null )
            {
                foreach ( XElement xSrcURL in xSrcURLs )
                {
                    if ( (xSrcURL != null) && (xSrcURL.Value != null) )
                    {
                        string srcURL = xSrcURL.Value;
                        _sourceUrLs.Add(srcURL);
                    }
                }
            }

            // Load SourceOCR
            SourceOCR = null;
            XElement xSrcOcr = xDocumentInfo.Element(_fileNameSpace + SourceOCRElementName);
            if  (xSrcOcr != null)
            {
                SourceOCR = new TextFieldType();
                try
                {
                    SourceOCR.Load(xSrcOcr);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(string.Format("Error reading source OCR : {0}", ex.Message));
                }
            }

            // load document's ID
            ID = null;
            XElement xID = xDocumentInfo.Element(_fileNameSpace + IdElementName);
            if ( (xID != null) && (xID.Value != null) )
            {
                ID = xID.Value;
            }

            // load document's version
            DocumentVersion = null;
            XElement xVersion = xDocumentInfo.Element(_fileNameSpace + VersionElementName);
            if ( (xVersion != null) && (xVersion.Value != null))
            {
                string version = xVersion.Value;
                try
                {
                    var cult = new CultureInfo("");

                    DocumentVersion = float.Parse(version, cult.NumberFormat);
                }
                catch(FormatException ex)
                {
                    Debug.WriteLine(string.Format("Error reading document version : {0}", ex.Message));
                }
            }

            // Load change history 
            History = null;
            XElement xHistory = xDocumentInfo.Element(_fileNameSpace + HistoryElementName);
            if (xHistory != null) 
            {
                History = new AnnotationType() { ElementName = HistoryElementName };
                try
                {
                    History.Load(xHistory);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(string.Format("Error reading document history : {0}", ex.Message));
                }
            }

            // Load copyright owners
            _documentPublishers.Clear();
            IEnumerable<XElement> xPublishers = xDocumentInfo.Elements(_fileNameSpace + AuthorType.PublisherElementName);
            if ( xPublishers != null )
            {
                foreach (XElement xPublisher in xPublishers )
                {
                    PublisherItem publisher = new PublisherItem { Namespace = _fileNameSpace };
                    try
                    {
                        publisher.Load(xPublisher);
                        _documentPublishers.Add(publisher);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(string.Format("Error reading document publishers : {0}", ex.Message));
                        continue;
                    }
                }
            }
        }
        internal void Load(XElement xPublishInfo)
        {
            if (xPublishInfo == null)
            {
                throw new ArgumentNullException("xPublishInfo");
            }

            // Load book name
            BookTitle = null;
            XElement xBookName = xPublishInfo.Element(FileNameSpace + BookNameElementName);
            if ( xBookName != null)  
            {
                BookTitle = new TextFieldType();
                try
                {
                    BookTitle.Load(xBookName);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading publisher book name : {0}", ex.Message));
                }
            }

            // Load publisher
            Publisher = null;
            XElement xPublisher = xPublishInfo.Element(FileNameSpace + PublisherElementName);
            if (xPublisher != null)
            {
                Publisher = new TextFieldType();
                try
                {
                    Publisher.Load(xPublisher);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading publishers : {0}", ex.Message));
                }
            }

            // Load city 
            City = null;
            XElement xCity = xPublishInfo.Element(FileNameSpace + CityElementName);
            if (xCity != null)
            {
                City = new TextFieldType();
                try
                {
                    City.Load(xCity);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading publishers' City: {0}", ex.Message));
                }
            }

            // Load year 
            Year = null;
            XElement xYear = xPublishInfo.Element(FileNameSpace + YearElementName);
            if ( (xYear != null))
            {
                int year;
                if ( int.TryParse( xYear.Value,out year) )
                {
                    Year = year;
                }

            }

            // Load ISBN
            ISBN = null;
            XElement xISBN = xPublishInfo.Element(FileNameSpace + ISBNElementName);
            if (xISBN != null) 
            {
                ISBN = new TextFieldType();
                try
                {
                    ISBN.Load(xISBN);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading publishers' ISBN: {0}", ex.Message));
                }
            }

            // Load sequence here
            ItemSequences.Clear();
            IEnumerable<XElement> xSequences = xPublishInfo.Elements(FileNameSpace + SequenceType.SequenceElementName);
            foreach (var xSequence in xSequences)
            {
                var sec = new SequenceType();
                try
                {
                    sec.Load(xSequence);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading publisher sequence data: {0}", ex.Message));
                    continue;
                }
            }

        }
        public override string ToString()
        {
            string firstName = "";
            if ( FirstName != null )
            {
                firstName = FirstName.Text;
            }

            string midName = "";
            if ( MiddleName != null )
            {
                midName = MiddleName.Text;
            }

            string lastName = "";
            if ( LastName != null )
            {
                lastName = LastName.Text;
            }

            string nickName = "no nick";
            if ( NickName != null )
            {
                nickName = NickName.Text;
            }

            string uid = "unknown-uid";
            if ( UID != null )
            {
                uid = UID.Text;
            }

            return string.Format("{0} {1} {2} ({3}): {4}",lastName,firstName,midName,nickName,uid);
        }
        /// <summary>
        /// Loads Author's data from XML "author" node
        /// </summary>
        /// <param name="xElement">"author" XML node</param>
        /// <returns>true if succeeded, false if failed</returns>
        internal void Load(XElement xElement)
        {
            if ( xElement == null )
            {
                throw new ArgumentNullException("xElement");
            }

            // Load first name
            FirstName = null;
            XElement xFirstName = xElement.Element(fileNameSpace + FirstNameElementName);
            if (xFirstName != null)
            {
                FirstName = new TextFieldType();
                try
                {
                    FirstName.Load(xFirstName);
                }
                catch (Exception)
                {
                }
            }

            // load middle name
            MiddleName = null;
            XElement xMiddleName = xElement.Element(fileNameSpace + MiddleNameElementName);
            if (xMiddleName != null)
            {
                MiddleName = new TextFieldType();
                try
                {
                    MiddleName.Load(xMiddleName);
                }
                catch(Exception)
                {

                }
            }

            // Load last name
            LastName = null;
            XElement xLastName = xElement.Element(fileNameSpace + LastNameElementName);
            if (xLastName != null)
            {
                try
                {
                    LastName = new TextFieldType();
                    LastName.Load(xLastName);
                }
                catch (Exception)
                {
                }
            }

            // Load Nickname
            NickName = null;
            XElement xNickName = xElement.Element(fileNameSpace + NickNameElementName);
            if (xNickName != null)
            {
                try
                {
                    NickName = new TextFieldType();
                    NickName.Load(xNickName);
                }
                catch (Exception)
                {
                }
            }

            // Load Homepage
            HomePage = null;
            XElement xHomePage = xElement.Element(fileNameSpace + HomePageElementName);
            if (xHomePage != null)
            {
                try
                {
                    HomePage = new TextFieldType();
                    HomePage.Load(xHomePage);
                }
                catch (Exception)
                {
                }
            }

            //Load e-mail
            EMail = null;
            XElement xEMail = xElement.Element(fileNameSpace + EMailElementName);
            if (xEMail != null)
            {
                try
                {
                    EMail = new TextFieldType();
                    EMail.Load(xEMail);
                }
                catch (Exception)
                {
                }
            }

            // Load UID
            uid = null;
            XElement xUID = xElement.Element(fileNameSpace + IdElementName);
            if (xUID != null)
            {
                uid = new TextFieldType();
                try
                {
                    uid.Load(xUID);
                    uid.Text = UID.Text.ToLower();
                }
                catch (Exception)
                {
                }
            }
        }
        public void Load(XElement xTitleInfo)
        {
            if ( xTitleInfo == null )
            {
                throw new ArgumentNullException("xTitleInfo");
            }

            // Load genres
            _genres.Clear();
            IEnumerable<XElement> xGenres = xTitleInfo.Elements(FileNameSpace + GenreElementName);
            foreach ( XElement xGenre in xGenres )
            {
                if ( (xGenre != null) )
                {
                    var genre = new TitleGenreType {Genre = xGenre.Value};
                    XAttribute xMatch = xGenre.Attribute("match");
                    if (xMatch != null && !string.IsNullOrEmpty(xMatch.Value))
                    {
                        int percentage;
                        if (int.TryParse(xMatch.Value,out percentage))
                        {
                            genre.Match = percentage;
                        }
                    }
                    _genres.Add(genre);
                }
            }

            // Load authors
            _bookAuthors.Clear();
            IEnumerable<XElement> xAuthors = xTitleInfo.Elements(FileNameSpace + AuthorType.AuthorElementName);
            foreach (XElement xAuthor in xAuthors )
            {
                var author = new AuthorItem { Namespace = FileNameSpace };
                try
                {
                    author.Load(xAuthor);
                    _bookAuthors.Add(author);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading author: {0}",ex.Message));
                    continue;
                }
            }

            // Load Title
            BookTitle = null;
            XElement xBookTitle = xTitleInfo.Element(FileNameSpace + BookTitleElementName);
            if (xBookTitle != null)
            {
                BookTitle = new TextFieldType();
                try
                {
                    BookTitle.Load(xBookTitle);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading book title: {0}", ex.Message));
                }
            }

            // Load Annotation
            Annotation = null;
            XElement xAnnotation = xTitleInfo.Element(FileNameSpace + AnnotationElementName);
            if (xAnnotation != null)
            {
                Annotation = new AnnotationItem();
                try
                {
                    Annotation.Load(xAnnotation);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading annotation: {0}", ex.Message));
                }
            }

            // Load keywords
            Keywords = null;
            XElement xKeywords = xTitleInfo.Element(FileNameSpace + KeywordsElementName);
            if (xKeywords != null)
            {
                Keywords    =   new TextFieldType();
                try
                {
                    Keywords.Load(xKeywords);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading keywords: {0}", ex.Message));
                }
            }

            // Load Book date
            BookDate = null;
            XElement xBookDate = xTitleInfo.Element(FileNameSpace + DateItem.Fb2DateElementName);
            if (xBookDate != null)
            {
                BookDate = new DateItem();
                try
                {
                    BookDate.Load(xBookDate);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading book date: {0}", ex.Message));
                }
            }

            Cover = null;
            // we should load coverpage images here but no use for them as for now
            XElement xCoverPage = xTitleInfo.Element(FileNameSpace + CoverPageElementName);
            if ( xCoverPage != null)
            {
                Cover = new CoverPage{Namespace = FileNameSpace};
                try
                {
                    Cover.Load(xCoverPage);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading cover: {0}", ex.Message));
                }
            }

            // Load Language
            Language = null;
            XElement xLanguage = xTitleInfo.Element(FileNameSpace + LanguageElementName);
            if ( (xLanguage != null))
            {
                Language = xLanguage.Value;
            }
            else
            {
                Debug.Write("Language not specified in title section");
            }

            // Load source language
            SrcLanguage = null;
            XElement xSrcLanguage = xTitleInfo.Element(FileNameSpace + SourceLanguageElementName);
            if ( (xSrcLanguage != null) )
            {
                SrcLanguage = xSrcLanguage.Value;
            }

            // Load translators
            _translators.Clear();
            IEnumerable<XElement> xTranslators = xTitleInfo.Elements(FileNameSpace + AuthorType.TranslatorElementName);
            foreach ( XElement xTranslator in xTranslators )
            {
                var translator = new TranslatorItem { Namespace = FileNameSpace };
                try
                {
                    translator.Load(xTranslator);
                    _translators.Add(translator);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading translator: {0}", ex.Message));
                    continue;
                }
            }

            // Load sequences
            ItemSequences.Clear();
            IEnumerable<XElement> xSequences = xTitleInfo.Elements(FileNameSpace + SequenceType.SequenceElementName);
            foreach (var xSequence in xSequences)
            {
               var sec = new SequenceType{ Namespace = FileNameSpace };
                try
                {
                    sec.Load(xSequence);
                    ItemSequences.Add(sec);
                }
                catch (Exception ex)
                {
                    Debug.Fail(string.Format("Error reading sequence data: {0}",ex.Message));
                    continue;
                }
            }
        }