src/snac/data/Source.php
/**
     * XML-Format this Source Text 
     *
     * Updates this Source text to add XML elements, including any <p> tags necessary.
     */
XML-Format this Source Text
Updates this Source text to add XML elements, including any  tags necessary.
XML - Format this Source Text Updates this Source text to add XML elements including any tags necessary .
public function formatXML() {
        $orig = $this->text;
        if (strpos($orig, "<p>") === false && strpos($orig, "<objectXML") === false) {
            $new = "";
            foreach (preg_split("/((\r?\n)|(\r\n?))/", $orig) as $par) {
                if (!empty(trim($par))) {
                    $new .= "<p>".htmlentities(trim($par), ENT_COMPAT|ENT_XML1)."</p>\n";  
                }
            } 
            $orig = $new;
        } else if (strpos($orig, "<objectXML") !== false) {
            $orig = str_replace("xmlns=\"\"", "xmlns=\"http://socialarchive.iath.virginia.edu/control/term#snacAdHocRandD\"", $orig);
        }
        $this->text = $orig;
    }
public function formatXML ( ) { $ orig = $ this -> text ; if ( strpos ( $ orig , " <p> " ) === false && strpos ( $ orig , " <objectXML " ) === false ) { $ new = " " ; foreach ( preg_split ( " /(( \r ? \n )|( \r \n ?))/ " , $ orig ) as $ par ) { if ( ! empty ( trim ( $ par ) ) ) { $ new .= " <p> " . htmlentities ( trim ( $ par ) , ENT_COMPAT | ENT_XML1 ) . " </p> \n " ; } } $ orig = $ new ; } else if ( strpos ( $ orig , " <objectXML " ) !== false ) { $ orig = str_replace ( " xmlns= \" \" " , " xmlns= \" http://socialarchive.iath.virginia.edu/control/term#snacAdHocRandD \" " , $ orig ) ; } $ this -> text = $ orig ; }
XML-Format this Source Text
 Updates this Source text to add XML elements, including any <p> tags necessary.
XML - Format this Source Text Updates this Source text to add XML elements including any <p > tags necessary .
// check for <p> tags, and if none, then add them to each line