Desktop tool for browsing account info from EVE-Online
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DefaultJDOMFactory.java 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*--
  2. $Id: DefaultJDOMFactory.java,v 1.7 2007/11/10 05:28:58 jhunter Exp $
  3. Copyright (C) 2000-2007 Jason Hunter & Brett McLaughlin.
  4. All rights reserved.
  5. Redistribution and use in source and binary forms, with or without
  6. modification, are permitted provided that the following conditions
  7. are met:
  8. 1. Redistributions of source code must retain the above copyright
  9. notice, this list of conditions, and the following disclaimer.
  10. 2. Redistributions in binary form must reproduce the above copyright
  11. notice, this list of conditions, and the disclaimer that follows
  12. these conditions in the documentation and/or other materials
  13. provided with the distribution.
  14. 3. The name "JDOM" must not be used to endorse or promote products
  15. derived from this software without prior written permission. For
  16. written permission, please contact <request_AT_jdom_DOT_org>.
  17. 4. Products derived from this software may not be called "JDOM", nor
  18. may "JDOM" appear in their name, without prior written permission
  19. from the JDOM Project Management <request_AT_jdom_DOT_org>.
  20. In addition, we request (but do not require) that you include in the
  21. end-user documentation provided with the redistribution and/or in the
  22. software itself an acknowledgement equivalent to the following:
  23. "This product includes software developed by the
  24. JDOM Project (http://www.jdom.org/)."
  25. Alternatively, the acknowledgment may be graphical using the logos
  26. available at http://www.jdom.org/images/logos.
  27. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  28. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  29. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  30. DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
  31. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  32. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  33. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  34. USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  35. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  36. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  38. SUCH DAMAGE.
  39. This software consists of voluntary contributions made by many
  40. individuals on behalf of the JDOM Project and was originally
  41. created by Jason Hunter <jhunter_AT_jdom_DOT_org> and
  42. Brett McLaughlin <brett_AT_jdom_DOT_org>. For more information
  43. on the JDOM Project, please see <http://www.jdom.org/>.
  44. */
  45. package org.jdom;
  46. import java.util.*;
  47. /**
  48. * Creates the standard top-level JDOM classes (Element, Document, Comment,
  49. * etc). A subclass of this factory might construct custom classes.
  50. *
  51. * @version $Revision: 1.7 $, $Date: 2007/11/10 05:28:58 $
  52. * @author Ken Rune Holland
  53. * @author Phil Nelson
  54. * @author Bradley S. Huffman
  55. */
  56. public class DefaultJDOMFactory implements JDOMFactory {
  57. private static final String CVS_ID =
  58. "@(#) $RCSfile: DefaultJDOMFactory.java,v $ $Revision: 1.7 $ $Date: 2007/11/10 05:28:58 $ $Name: jdom_1_1 $";
  59. public DefaultJDOMFactory() { }
  60. // Allow Javadocs to inherit from JDOMFactory
  61. public Attribute attribute(String name, String value, Namespace namespace) {
  62. return new Attribute(name, value, namespace);
  63. }
  64. public Attribute attribute(String name, String value,
  65. int type, Namespace namespace) {
  66. return new Attribute(name, value, type, namespace);
  67. }
  68. public Attribute attribute(String name, String value) {
  69. return new Attribute(name, value);
  70. }
  71. public Attribute attribute(String name, String value, int type) {
  72. return new Attribute(name, value, type);
  73. }
  74. public CDATA cdata(String text) {
  75. return new CDATA(text);
  76. }
  77. public Text text(String text) {
  78. return new Text(text);
  79. }
  80. public Comment comment(String text) {
  81. return new Comment(text);
  82. }
  83. public DocType docType(String elementName,
  84. String publicID, String systemID) {
  85. return new DocType(elementName, publicID, systemID);
  86. }
  87. public DocType docType(String elementName, String systemID) {
  88. return new DocType(elementName, systemID);
  89. }
  90. public DocType docType(String elementName) {
  91. return new DocType(elementName);
  92. }
  93. public Document document(Element rootElement, DocType docType) {
  94. return new Document(rootElement, docType);
  95. }
  96. public Document document(Element rootElement, DocType docType, String baseURI) {
  97. return new Document(rootElement, docType, baseURI);
  98. }
  99. public Document document(Element rootElement) {
  100. return new Document(rootElement);
  101. }
  102. public Element element(String name, Namespace namespace) {
  103. return new Element(name, namespace);
  104. }
  105. public Element element(String name) {
  106. return new Element(name);
  107. }
  108. public Element element(String name, String uri) {
  109. return new Element(name, uri);
  110. }
  111. public Element element(String name, String prefix, String uri) {
  112. return new Element(name, prefix, uri);
  113. }
  114. public ProcessingInstruction processingInstruction(String target,
  115. Map data) {
  116. return new ProcessingInstruction(target, data);
  117. }
  118. public ProcessingInstruction processingInstruction(String target,
  119. String data) {
  120. return new ProcessingInstruction(target, data);
  121. }
  122. public EntityRef entityRef(String name) {
  123. return new EntityRef(name);
  124. }
  125. public EntityRef entityRef(String name, String publicID, String systemID) {
  126. return new EntityRef(name, publicID, systemID);
  127. }
  128. public EntityRef entityRef(String name, String systemID) {
  129. return new EntityRef(name, systemID);
  130. }
  131. // =====================================================================
  132. // List manipulation
  133. // =====================================================================
  134. public void addContent(Parent parent, Content child) {
  135. if (parent instanceof Document) {
  136. ((Document) parent).addContent(child);
  137. }
  138. else {
  139. ((Element) parent).addContent(child);
  140. }
  141. }
  142. public void setAttribute(Element parent, Attribute a) {
  143. parent.setAttribute(a);
  144. }
  145. public void addNamespaceDeclaration(Element parent, Namespace additional) {
  146. parent.addNamespaceDeclaration(additional);
  147. }
  148. }