goetas-webservices/xsd-reader

getDoc() empty for Elements

mgrundkoetter opened this issue · 4 comments

Assuming an xsd node like

<xsd:element name="bewertung">
	<xsd:annotation>
		<xsd:documentation>Container für detailierte Bewertungs Parmater</xsd:documentation>
	</xsd:annotation>
	<xsd:complexType>
		...
	</xsd:complexType>
</xsd:element>

the xsd parser returns always an empty doc for $element->getDoc(). I was able to fix this by just adding
$attribute->setDoc($this->getDocumentation($node)); in Schemareader->loadAttributeOrElementDef() in the else branch after $attribute = new ElementDef($schema, $name);

Is this behavior intended/is there a reason for not parsing the documentation for elements? If not, this would be a nice feature! I generate PHP code based on a given xsd and this would allow for some more useful class docblock :-) (see https://github.com/ujamii/openimmo/blob/master/src/Generator/ApiGenerator.php)

I can open a PR if you consider this useful.

PR is welcome. I think this was not implemented just for lack of time

Out of curiosity: any reason to not use https://github.com/goetas-webservices/xsd2php for https://github.com/ujamii/openimmo ? from what I can see they are very similar

The step of generating code is just an intermediate one, because the organisation behind http://www.openimmo.de/ does not offer a free API or a base wrapper for their structure. I need this for a project (TYPO3 CMS) and wanted to have as least config as possible inside the library, so no yml config and metadata via annotations. I did not see that possible in the other package. Also, I am not sure whether the publisher of the xsd file (its not even really public, you have to register) complies to all standards. The element and attribute names there are all in German, different naming strategies mixed and so on.

PR is on the way.

thanks for the explanation. i think this can be closed