public function getAsElem($dom)
    {
        $termElem = $dom->createElement('term');
        $emptyElem = $dom->createElement('empty');
        $emptyElem->setAttribute('apply', $this->empty);
        $termElem->appendChild($emptyElem);
        if (!empty($this->termOptions)) {
            foreach($this->termOptions as $opt) {
                $termOptElem = $dom->createElement('term-option');
                $termOptElem->nodeValue = $opt;
                $termElem->appendChild($termOptElem);
            }
        }
        if (!empty($this->default)) {
            $constraint = $this->default->getAsElem($dom);
            /* pluck out child nodes of the <constraint/> */
            if ($constraint->hasChildNodes()) {
                $defElem = $dom->createElement('default');
                foreach ($constraint->childNodes as $child) {
                    if ($child->nodeType == XML_ELEMENT_NODE) {
                        $defElem->appendChild($child);
                    }
                }
                $termElem->appendChild($defElem);
            }
        }
        /* <term>
               <empty apply="no-results" />
               <term-option>diacritic-insensitive</term-option>
               <term-option>unwildcarded</term-option>
               <default>....</default>
            </term> */
        return $termElem;
    }
public function getAsElem($dom)
    {
        $termElem = $dom->createElement('term');
        $emptyElem = $dom->createElement('empty');
        $emptyElem->setAttribute('apply', $this->empty);
        $termElem->appendChild($emptyElem);
        if (!empty($this->termOptions)) {
            foreach($this->termOptions as $opt) {
                $termOptElem = $dom->createElement('term-option');
                $termOptElem->nodeValue = $opt;
                $termElem->appendChild($termOptElem);
            }
        }
        if (!empty($this->default)) {
            $constraint = $this->default->getAsElem($dom);
            /* pluck out child nodes of the <constraint/> */
            if ($constraint->hasChildNodes()) {
                $defElem = $dom->createElement('default');
                foreach ($constraint->childNodes as $child) {
                    if ($child->nodeType == XML_ELEMENT_NODE) {
                        $defElem->appendChild($child);
                    }
                }
                $termElem->appendChild($defElem);
            }
        }
        /* <term>
               <empty apply="no-results" />
               <term-option>diacritic-insensitive</term-option>
               <term-option>unwildcarded</term-option>
               <default>....</default>
            </term> */
        return $termElem;
    }
public function getAsElem ( $ dom ) { $ termElem = $ dom -> createElement ( 'term' ) ; $ emptyElem = $ dom -> createElement ( 'empty' ) ; $ emptyElem -> setAttribute ( 'apply' , $ this -> empty ) ; $ termElem -> appendChild ( $ emptyElem ) ; if ( ! empty ( $ this -> termOptions ) ) { foreach ( $ this -> termOptions as $ opt ) { $ termOptElem = $ dom -> createElement ( 'term-option' ) ; $ termOptElem -> nodeValue = $ opt ; $ termElem -> appendChild ( $ termOptElem ) ; } } if ( ! empty ( $ this -> default ) ) { $ constraint = $ this -> default -> getAsElem ( $ dom ) ; /* pluck out child nodes of the <constraint/> */ if ( $ constraint -> hasChildNodes ( ) ) { $ defElem = $ dom -> createElement ( 'default' ) ; foreach ( $ constraint -> childNodes as $ child ) { if ( $ child -> nodeType == XML_ELEMENT_NODE ) { $ defElem -> appendChild ( $ child ) ; } } $ termElem -> appendChild ( $ defElem ) ; } } /* <term>
               <empty apply="no-results" />
               <term-option>diacritic-insensitive</term-option>
               <term-option>unwildcarded</term-option>
               <default>....</default>
            </term> */ return $ termElem ; }
Get the term as a DOMElement object.

@param DOMDocument $dom The DOMDocument object with which to create the element.
Get the term as a DOMElement object .