api/MarkLogic/MLPHP/ValueConstraint.php
public function getAsElem($dom)
    {
        $constElem = $dom->createElement('constraint');
        $constElem->setAttribute('name', $this->name);
        $valElem = $dom->createElement('value');
        $elemElem = $dom->createElement('element');
        $elemElem->setAttribute('ns', $this->ns);
        $elemElem->setAttribute('name', $this->elem);
        $valElem->appendChild($elemElem);
        if($this->attr) {
            $attrElem = $dom->createElement('attribute');
            $attrElem->setAttribute('ns', $this->attrNs);
            $attrElem->setAttribute('name', $this->attr);
            $valElem->appendChild($attrElem);
        }
        $this->addTermOptions($dom, $valElem);
        $this->addFragmentScope($dom, $valElem);
        $constElem->appendChild($valElem);
    /* <constraint name='flavor'>
            <value>
                <element ns='http://example.com' name='flavor-descriptor'/>
            </value>
           </constraint> */
        return $constElem;
    }
public function getAsElem($dom)
    {
        $constElem = $dom->createElement('constraint');
        $constElem->setAttribute('name', $this->name);
        $valElem = $dom->createElement('value');
        $elemElem = $dom->createElement('element');
        $elemElem->setAttribute('ns', $this->ns);
        $elemElem->setAttribute('name', $this->elem);
        $valElem->appendChild($elemElem);
        if($this->attr) {
            $attrElem = $dom->createElement('attribute');
            $attrElem->setAttribute('ns', $this->attrNs);
            $attrElem->setAttribute('name', $this->attr);
            $valElem->appendChild($attrElem);
        }
        $this->addTermOptions($dom, $valElem);
        $this->addFragmentScope($dom, $valElem);
        $constElem->appendChild($valElem);
    /* <constraint name='flavor'>
            <value>
                <element ns='http://example.com' name='flavor-descriptor'/>
            </value>
           </constraint> */
        return $constElem;
    }
Get the constraint as a DOMElement object.

@param DOMDocument $dom The DOMDocument object with which to create the element.