3 * Exports the data of a class as an xml file.
\r
5 * @version $Id: PhpdocXMLClassExporter.php,v 1.2 2000/12/03 22:37:38 uw Exp $
\r
7 class PhpdocXMLClassExporter extends PhpdocXMLDocumentExporter {
\r
10 * Variable container attributes.
\r
11 * @var array $variableAttributes
\r
13 var $variableAttributes = array(
\r
15 "access" => "CDATA",
\r
17 "abstract" => "Boolean",
\r
18 "static" => "Boolean",
\r
19 "final" => "Boolean"
\r
22 * Class container attributes.
\r
23 * @var array $classAttributes
\r
25 var $classAttributes = array(
\r
27 "extends" => "CDATA",
\r
28 "undoc" => "Boolean",
\r
29 "access" => "CDATA",
\r
30 "abstract" => "Boolean",
\r
31 "static" => "Boolean",
\r
32 "final" => "Boolean",
\r
33 "package" => "CDATA"
\r
36 var $fileprefix = "class_";
\r
38 function PhpdocXMLClassExporter() {
\r
39 $this->PHPDocXMLExporter();
\r
40 } // end constructor
\r
44 $attribs = $this->getAttributes($this->result, $this->classAttributes);
\r
45 $this->xmlwriter->startElement("class", "", $attribs, false);
\r
47 $this->filenameXML($this->result["filename"]);
\r
49 $this->docXML($this->result);
\r
51 if (isset($this->result["functions"]))
\r
52 $this->functionsXML($this->result["functions"]);
\r
54 if (isset($this->result["variables"]))
\r
55 $this->variablesXML($this->result["variables"]);
\r
57 if (isset($this->result["uses"]))
\r
58 $this->usesXML($this->result["uses"]);
\r
60 if (isset($this->result["consts"]))
\r
61 $this->constsXML($this->result["consts"]);
\r
63 if (isset($this->result["inherited"]))
\r
64 $this->inheritedOverridenXML($this->result["inherited"], "inherited");
\r
66 if (isset($this->result["overriden"]))
\r
67 $this->inheritedOverridenXML($this->result["overriden"], "overriden");
\r
69 if (isset($this->result["path"]))
\r
70 $this->pathXML($this->result["path"]);
\r
72 if (isset($this->result["baseclass"]))
\r
73 $this->baseclassXML($this->result["baseclass"]);
\r
75 if (isset($this->result["subclasses"]))
\r
76 $this->subclassesXML($this->result["subclasses"]);
\r
78 $this->xmlwriter->endElement("class", true);
\r
80 } // end func create
\r
83 * Handles inherited and overriden elements.
\r
85 * @param array Array of inherited or overriden elements
\r
86 * @param string Container used when saving the elements
\r
88 function inheritedOverridenXML($data, $tag) {
\r
91 while (list($type, $elements) = each($data)) {
\r
94 while (list($from, $data2) = each($elements)) {
\r
96 $attribs = $this->getAttributes( array ("type" => $type, "src" => $from), $this->inheritedOverridenAttributes);
\r
97 $this->xmlwriter->startElement($tag, "", $attribs, false);
\r
100 while (list($name, $v) = each($data2))
\r
101 $this->xmlwriter->addElement("element", $name);
\r
103 $this->xmlwriter->endElement($tag, true);
\r
109 } // end func inheritedOverridenXML
\r
112 * Writes the "path" (inheritance chain) of an element.
\r
116 function pathXML($path) {
\r
117 if (0 == count($path))
\r
120 $this->xmlwriter->startElement("path", "", "", false);
\r
123 while (list($k, $parent) = each($path))
\r
124 $this->xmlwriter->addElement("parent", $parent);
\r
126 $this->xmlwriter->endElement("path", true);
\r
128 } // end func pathXML
\r
131 * Adds a baseclass container to the generated xml.
\r
133 * @param string Name of the baseclass
\r
135 function baseclassXML($base) {
\r
138 $this->xmlwriter->addElement("baseclass", $base);
\r
140 } // end func baseclassXML
\r
143 * Adds a list of subclasses to the generated xml.
\r
147 function subclassesXML($subclasses) {
\r
148 if (0 == count($subclasses))
\r
151 $this->xmlwriter->startElement("subclasses", "", "", false, true);
\r
153 reset($subclasses);
\r
154 while(list($subclass, $v) = each($subclasses))
\r
155 $this->xmlwriter->addElement("subclass", $subclass);
\r
157 $this->xmlwriter->endElement("subclasses", true);
\r
159 } // end func subclassesXML
\r
162 * Adds class variables to the XMl document.
\r
166 function variablesXML($variables) {
\r
169 while (list($variable, $data) = each($variables)) {
\r
171 $attribs = $this->getAttributes($data, $this->variableAttributes);
\r
172 $this->xmlwriter->startElement("variable", $data["value"], $attribs, false);
\r
173 $this->docXML($data);
\r
174 $this->xmlwriter->endElement("variable", true);
\r
178 } // end func variablesXML
\r
180 } // end class PhpdocXMLClassExporter
\r