|
DOMDocument::registerNodeClassRegister extended class used to create base node type Beschreibung
public bool DOMDocument::registerNodeClass
( string
$baseclass
, string $extendedclass
)This method allows you to register your own extended DOM class to be used afterward by the PHP DOM extension. This method is not part of the DOM standard. Parameter-Liste
Rückgabewerte
Gibt bei Erfolg Changelog
Beispiele
Beispiel #1 Adding a new method to DOMElement to ease our code
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe: <?xml version="1.0"?> <root><child foo="bar"/></root>
Beispiel #2 Retrieving elements as custom class
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe: string(9) "myElement" text in child
Beispiel #3 Retrieving owner document When instantiating a custom DOMDocument the ownerDocument property will refer to the instantiated class, meaning there is no need (and in fact not possible) to use DOMDocument::registerNodeClass with DOMDocument
<?phpDas oben gezeigte Beispiel erzeugt folgende Ausgabe: string(13) "myDOMDocument" string(18) "myOtherDOMDocument" |