@ 2014-11-12T17:41:31Z <?php
Class Crearxml
{
/**
*sube archivos al servidor a través de un formulario
*@access public
*@param array $files estructura de array con todos los archivos a subir
*/
public function createxml($xml64)
{
$xml = new DomDocument('1.0', 'ISO-8859-1');
$xml2 = file_get_contents($xml64);
$DOC = new DOMDocument('1.0', 'utf-8');
$DOC->loadXML($xml2);
$base = base64_encode($xml2);
$root = $xml->createElement('SOAP-ENV:Envelope');
$root = $xml->appendChild($root);
$atr1 = $xml->createAttribute('SOAP-ENV:encodingStyle');
$atr2 = $xml->createAttribute('xmlns:SOAP-ENV');
$atr3 = $xml->createAttribute('xmlns:xsd');
$atr4 = $xml->createAttribute('xmlns:xsi');
$atr5 = $xml->createAttribute('xmlns:SOAP-ENC');
$atr6 = $xml->createAttribute('xmlns:tns');
// Se lo acoplo al elemento "contactos"
$root->appendChild($atr6);
$root->appendChild($atr5);
$root->appendChild($atr4);
$root->appendChild($atr3);
$root->appendChild($atr2);
$root->appendChild($atr1);
// Creo el texto
$atr1v = $xml->createTextNode('http://schemas.xmlsoap.org/soap/encoding/');
$atr2v = $xml->createTextNode('http://schemas.xmlsoap.org/soap/envelope/');
$atr3v = $xml->createTextNode('http://www.w3.org/2001/XMLSchema');
$atr4v = $xml->createTextNode('http://www.w3.org/2001/XMLSchema-instance');
$atr5v = $xml->createTextNode('http://schemas.xmlsoap.org/soap/encoding/');
$atr6v = $xml->createTextNode('urn:respuestaValidacion');
// Se lo asigno al atributo
$atr1->appendChild($atr1v);
$atr2->appendChild($atr2v);
$atr3->appendChild($atr3v);
$atr4->appendChild($atr4v);
$atr5->appendChild($atr5v);
$atr6->appendChild($atr6v);
$body=$xml->createElement('SOAP-ENV:Body');
$body =$root->appendChild($body);
$vcfdi=$xml->createElement('tns:validarCFDI');
$vcfdi =$body->appendChild($vcfdi);
$atr_tns = $xml->createAttribute('xmlns:tns');
$vcfdi->appendChild($atr_tns);
$atrv_tns = $xml->createTextNode('urn:respuestaValidacion');
$atr_tns->appendChild($atrv_tns);
$susrfc=$xml->createElement('suscriptorRFC','APA9707035N4');
$susrfc =$vcfdi->appendChild($susrfc);
$atr_rfc = $xml->createAttribute('xsi:type');
$susrfc->appendChild($atr_rfc);
$atrv_rfc = $xml->createTextNode('xsd:string');
$atr_rfc->appendChild($atrv_rfc);
$ag_ti=$xml->createElement('agenteTI','APA9707035N4');
$ag_ti =$vcfdi->appendChild($ag_ti);
$atr_agti = $xml->createAttribute('xsi:type');
$ag_ti->appendChild($atr_agti);
$atrv_agti = $xml->createTextNode('xsd:string');
$atr_agti->appendChild($atrv_agti);
$doc_xml=$xml->createElement('documentoXML',$base);
$doc_xml =$vcfdi->appendChild($doc_xml);
$atr_dxml = $xml->createAttribute('xsi:type');
$doc_xml->appendChild($atr_dxml);
$atrv_dxml = $xml->createTextNode('xsd:string');
$atr_dxml->appendChild($atrv_dxml);
return $xml;
}
}
/*$xml->formatOutput = true;
$strings_xml = $xml->saveXML();
$xml->save('XML/prueba.xml');
echo 'Enhorabuena se creo el XML exitosamente';
*/
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.7 Output for 4.4.2 - 4.4.9 Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/sBDLZ on line 10
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/sBDLZ on line 10
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/sBDLZ on line 10
Process exited with code 255 . preferences:dark mode live preview
297.07 ms | 401 KiB | 457 Q