Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/intabulas/sandler/elements/impl/ContributorImpl.java


1   /**
2    * Copyright (c) 2003, Mark Lussier
3    * All rights reserved.
4    *
5    * Portions Copyright (c) 2003 by David A. Czarnecki
6    *
7    * Redistribution and use in source and binary forms, with or without
8    * modification, are permitted provided that the following conditions are met:
9    *
10   * Redistributions of source code must retain the above copyright notice,
11   *      this list of conditions and the following disclaimer.
12   * Redistributions in binary form must reproduce the above copyright notice,
13   *      this list of conditions and the following disclaimer in the documentation
14   *      and/or other materials provided with the distribution.
15   * Neither the name of the "Mark Lussier" and "Sandler" nor the names of
16   * its contributors may be used to endorse or promote products derived from
17   * this software without specific prior written permission.
18   * Products derived from this software may not be called "Sandler",
19   * nor may "Sandler" appear in their name, without prior written permission of
20   * Mark Lussier
21   *
22   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23   * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25   * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
26   * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
27   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29   * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31   * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
34   * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35   */
36  package org.intabulas.sandler.elements.impl;
37  
38  import org.intabulas.sandler.elements.AtomElement;
39  import org.intabulas.sandler.elements.Contributor;
40  import org.xmlpull.v1.XmlPullParser;
41  import org.xmlpull.v1.XmlPullParserException;
42  
43  import java.io.IOException;
44  
45  /**
46   * ContributorImpl
47   *
48   * @author Mark Lussier
49   * @version $Id: ContributorImpl.java,v 1.2 2003/09/09 23:44:44 intabulas Exp $
50   */
51  public class ContributorImpl extends AbstractIdentityElement implements Contributor, AtomElement {
52  
53      /**
54       * Returns a string representation of the object.
55       *
56       * @return  a String representation of the object.
57       */
58      public String toString() {
59          StringBuffer buffer = new StringBuffer(HTMLTAG_START).append(ELEMENT_CONTRIBUTOR).append(HTMLTAG_CLOSE);
60          buffer.append(super.toString());
61          buffer.append(HTMLTAG_BEGIN).append(ELEMENT_CONTRIBUTOR).append(HTMLTAG_CLOSE);
62          return buffer.toString();
63  
64      }
65  
66      public void loadDocument(XmlPullParser parser) throws XmlPullParserException {
67          int eventType = parser.getEventType();
68          do {
69              if (eventType == XmlPullParser.START_TAG) {
70                  if (parser.getName().equals(ELEMENT_NAME)) {
71                      try {
72                          setName(parser.nextText());
73                      } catch (IOException e) {
74                          e.printStackTrace();
75                      }
76                  } else if (parser.getName().equals(ELEMENT_EMAIL)) {
77                      try {
78                          setEmail(parser.nextText());
79                      } catch (IOException e) {
80                          e.printStackTrace();
81                      }
82  
83                  } else if (parser.getName().equals(ELEMENT_URL)) {
84                      try {
85                          setUrl(parser.nextText());
86                      } catch (IOException e) {
87                          e.printStackTrace();
88                      }
89  
90                  } else if (parser.getName().equals(ELEMENT_HOMEPAGE)) {
91                      try {
92                          setUrl(parser.nextText());
93                      } catch (IOException e) {
94                          e.printStackTrace();
95                      }
96  
97                  }
98              } else if (eventType == XmlPullParser.END_TAG) {
99              }
100             try {
101                 eventType = parser.next();
102             } catch (XmlPullParserException e) {
103                 e.printStackTrace();
104             } catch (IOException e) {
105                 e.printStackTrace();
106             }
107 
108         } while (!(eventType == XmlPullParser.END_TAG && ELEMENT_CONTRIBUTOR.equals(parser.getName())));
109 
110 
111     }
112 
113 
114 }