api/MarkLogic/MLPHP/RangeConstraint.php
public function getAsElem($dom)
    {
        $constElem = $dom->createElement('constraint');
        $constElem->setAttribute('name', $this->name);
        $rangeElem = $dom->createElement('range');
        $rangeElem->setAttribute('type', $this->datatype);
        $rangeElem->setAttribute('facet', $this->facet);
        $elemElem = $dom->createElement('element');
        $elemElem->setAttribute('ns', $this->ns);
        $elemElem->setAttribute('name', $this->elem);
        $rangeElem->appendChild($elemElem);
        if($this->attr) {
            $attrElem = $dom->createElement('attribute');
            $attrElem->setAttribute('ns', $this->attrNs);
            $attrElem->setAttribute('name', $this->attr);
            $rangeElem->appendChild($attrElem);
        }
        if($this->buckets) {
            foreach ($this->buckets as $buck) {
                $buckElem = $dom->createElement('bucket');
                $buckElem->setAttribute('name', $buck->getName());
                foreach ($buck->getOptions() as $key => $val) {
                    $buckElem->setAttribute($key, $val);
                }
                $rangeElem->appendChild($buckElem);
            }
        }
        // Note: No term options for range constraints
        $this->addFacetOptions($dom, $rangeElem);
        $this->addFragmentScope($dom, $rangeElem);
        $constElem->appendChild($rangeElem);
    /* <constraint name='rating'>
               <range type='xs:decimal'>
                   <element ns='http://example.com' name='rating'/>
               </range>
           </constraint> */
        return $constElem;
    }
public function getAsElem($dom)
    {
        $constElem = $dom->createElement('constraint');
        $constElem->setAttribute('name', $this->name);
        $rangeElem = $dom->createElement('range');
        $rangeElem->setAttribute('type', $this->datatype);
        $rangeElem->setAttribute('facet', $this->facet);
        $elemElem = $dom->createElement('element');
        $elemElem->setAttribute('ns', $this->ns);
        $elemElem->setAttribute('name', $this->elem);
        $rangeElem->appendChild($elemElem);
        if($this->attr) {
            $attrElem = $dom->createElement('attribute');
            $attrElem->setAttribute('ns', $this->attrNs);
            $attrElem->setAttribute('name', $this->attr);
            $rangeElem->appendChild($attrElem);
        }
        if($this->buckets) {
            foreach ($this->buckets as $buck) {
                $buckElem = $dom->createElement('bucket');
                $buckElem->setAttribute('name', $buck->getName());
                foreach ($buck->getOptions() as $key => $val) {
                    $buckElem->setAttribute($key, $val);
                }
                $rangeElem->appendChild($buckElem);
            }
        }
        // Note: No term options for range constraints
        $this->addFacetOptions($dom, $rangeElem);
        $this->addFragmentScope($dom, $rangeElem);
        $constElem->appendChild($rangeElem);
    /* <constraint name='rating'>
               <range type='xs:decimal'>
                   <element ns='http://example.com' name='rating'/>
               </range>
           </constraint> */
        return $constElem;
    }
Get the constraint as a DOMElement object.

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