0) { if (substr(trim(urldecode($_GET['htmlfile'])) . ' ', 0, 1) == '<') { $contents=trim(str_replace('+',' ',urldecode($_GET['htmlfile']))); if (strpos(strtolower(explode('>', $contents)[0]), 'html') !== false) { $fn='/tmp/html_' . $rn . '.html'; } else if (strpos(strtolower(explode('>', $contents)[0]), 'xml') !== false) { $fn='/tmp/xml_' . $rn . '.xml'; } file_put_contents($fn, $contents); } else { $fn=str_replace('+',' ',urldecode($_GET['htmlfile'])); } if ($fn != '') { if (strpos($fn, 'localhost') !== false) { $rhs=explode('localhost' . explode('/', explode('localhost', $fn)[1])[0], $fn)[1]; $fn=$_SERVER['DOCUMENT_ROOT'] . $rhs; $pth='/usr/bin/'; } else if (strpos($fn, 'rjmprogramming.com.au') !== false) { $rhs=explode('rjmprogramming.com.au' . explode('/', explode('rjmprogramming.com.au', $fn)[1])[0], $fn)[1]; $fn=$_SERVER['DOCUMENT_ROOT'] . $rhs; } else if (strpos($_SERVER['SERVER_NAME'], 'localhost') !== false) { $pth='/usr/bin/'; } } if (file_exists($fn)) { if ($contents == '') { $contents=file_get_contents($fn); } $prefn=$fn; $fn=realpath($fn); if (strpos(strtolower($fn), '.xml') !== false) { $vsnone='block'; $results=shell_exec($pth . 'xmllint --valid --noout ' . $fn . ' 2> ' . ' ' . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); if (file_exists(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err')) { $results.="\n"; $results.=file_get_contents(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); unlink(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); } } else if (strpos(strtolower($fn), '.htm') !== false) { $vsnone='block'; $results=shell_exec($pth . 'xmllint --html --valid --noout ' . $fn . ' 2> ' . ' ' . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); if (file_exists(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err')) { $results.="\n"; $results.=file_get_contents(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); unlink(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); } } if (strpos($fn, '/tmp/') !== false) { unlink($fn); } } else { $contents=''; if (strpos($fn, '/tmp/') !== false) { unlink($fn); } } } else if (isset($_POST['htmlfile']) && strlen(('' . $_POST['htmlfile'])) > 0) { if (substr(trim(urldecode($_POST['htmlfile'])) . ' ', 0, 1) == '<') { $contents=trim(str_replace('+',' ',urldecode($_POST['htmlfile']))); if (strpos(strtolower(explode('>', $contents)[0]), 'html') !== false) { $fn='/tmp/html_' . $rn . '.html'; } else if (strpos(strtolower(explode('>', $contents)[0]), 'xml') !== false) { $fn='/tmp/xml_' . $rn . '.xml'; } file_put_contents($fn, $contents); } else { $fn=str_replace('+',' ',urldecode($_POST['htmlfile'])); } if ($fn != '') { if (strpos($fn, 'localhost') !== false) { $rhs=explode('localhost' . explode('/', explode('localhost', $fn)[1])[0], $fn)[1]; $fn=$_SERVER['DOCUMENT_ROOT'] . $rhs; $pth='/usr/bin/'; } else if (strpos($fn, 'rjmprogramming.com.au') !== false) { $rhs=explode('rjmprogramming.com.au' . explode('/', explode('rjmprogramming.com.au', $fn)[1])[0], $fn)[1]; $fn=$_SERVER['DOCUMENT_ROOT'] . $rhs; } else if (strpos($_SERVER['SERVER_NAME'], 'localhost') !== false) { $pth='/usr/bin/'; } } if (file_exists($fn)) { $prefn=$fn; if ($contents == '') { $contents=file_get_contents($fn); } $fn=realpath($fn); if (strpos(strtolower($fn), '.xml') !== false) { $vsnone='block'; $results=shell_exec($pth . 'xmllint --valid --noout ' . $fn . ' 2> ' . ' ' . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); if (file_exists(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err')) { $results.="\n"; $results.=file_get_contents(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); unlink(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); } } else if (strpos(strtolower($fn), '.htm') !== false) { $vsnone='block'; $results=shell_exec($pth . 'xmllint --html --valid --noout ' . $fn . ' 2> ' . ' ' . rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); if (file_exists(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err')) { $results.="\n"; $results.=file_get_contents(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); //file_put_contents('xxx.xxx', $results); unlink(rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'xmllint.err'); } } if (strpos($fn, '/tmp/') !== false) { unlink($fn); } } else { $contents=''; if (strpos($fn, '/tmp/') !== false) { unlink($fn); } } } if ($contents != '') { $lines=explode("\n", $contents); $rowseq=' rows=' . sizeof($lines) . ' '; for ($ii=1; $ii<=sizeof($lines); $ii++) { $precontents.='' . $ii . "\n"; } } if (isset($_GET['browsecontents'])) { if (strlen($_GET['browsecontents']) > 0) { $prefn=str_replace('+',' ',urldecode($_GET['browsecontents'])); $bc='#' . urlencode($prefn); } } if (isset($_POST['browsecontents'])) { if (strlen($_POST['browsecontents']) > 0) { $prefn=str_replace('+',' ',urldecode($_POST['browsecontents'])); $bc='#' . urlencode($prefn); } } ?> XML Lint Usage - RJM Programming - June, 2024

XML Lint Validation  

RJM Programming - June, 2024

id=myform method=POST target=_self>
XML Lint validation of  
Data to validate 
XML Lint results
data-status='' style=font-size:8px;display:inline-block;overflow-x:clip;text-wrap:nowrap;text-align:right; id=preincoming>','>',str_replace('<','<',$precontents)); ?> onchange="if (document.getElementById('mytwosub')) { document.getElementById('mytwosub').disabled=false; }" onblur="if (this.value.length > 0 && '' == '') { alert('bC=' + bc); document.getElementById('mysub').click(); }" style=width:80%;font-size:8px;display:inline-block;overflow-x:clip;text-wrap:nowrap; name=content id=incoming>','>',str_replace('<','<',$contents)); ?> style=width:100%; id=outgoing>','>',str_replace('<','<',$results)); ?>
value=Validate>