<?xml version="1.0"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <CancelaCFDResponse xmlns="http://cancelacfd.sat.gob.mx"> <CancelaCFDResult Fecha="2016-01-18T16:13:25.1273627" RfcEmisor="CCO910614DN5"> <Folios> <UUID>CE48E873-1409-4566-8619-0ACC449AD5E5</UUID> <EstatusUUID>201</EstatusUUID> </Folios> <Signature Id="SelloSAT" xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /> <SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#hmac-sha512" /> <Reference URI=""> <Transforms> <Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116"> <XPath>not(ancestor-or-self::*[local-name()='Signature'])</XPath> </Transform> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512" /> <DigestValue>rMD8d4QDZqyUHGWJz0flUQd1E27NsFBDosM6s++whMCjCW3dx92HTIQlvF2PFfNPnACwgkvksQ0C/7XpQ==</DigestValue> </Reference> </SignedInfo> <SignatureValue>0seP9bfry6PTwWXP9RsSs2+JCsI8o87ZHWtOix+1n76ZeA8NL1rWtQTr1BOEJ+Q0qezp3qyOYRl6l5AgxgEM8Q==</SignatureValu <KeyInfo> <KeyName>00001088800000016</KeyName> <KeyValue> <RSAKeyValue> <Modulus>xnL2zDPtH5jDsAZDTIfMqbKGrve+At8Kyx2EZvbfXbpK9uVExWS874oMelFzNq69/YqSReT3I7I8wr+joy5O7ouZH+4KWdIGp4Si6lHe0kntxzNmuuKyOPkJ9tMcntnFmQ4bfxFxlg/Ud2hCtuoy3j2xYkIXu5O4pGM98Nz8pAM=</Modulus> <Exponent>AQAB</Exponent> </RSAKeyValue> </KeyValue> </KeyInfo> </Signature> </CancelaCFDResult> </CancelaCFDResponse> </s:Body> </s:Envelope>
and save into a text the Attribute 'FECHA', and in a second variable the 'RfcEmisor'.CancelaCFDResult Fecha="2016-01-18T16:13:25.1273627" RfcEmisor="CCO910614DN5"
IF ISCLEAR(lautxmldocument) THEN CREATE(lautxmldocument,FALSE, TRUE); lautxmldocument.load(PathCFDI); lautxmlnodelist := lautxmldocument.getElementsByTagName('UUID'); lautxmlnodelist2 := lautxmldocument.getElementsByTagName('EstatusUUID'); lautxmlnode := lautxmlnodelist.nextNode; lautxmlnode2 := lautxmlnodelist2.nextNode; lautxmlnodelist3 := lautxmldocument.childNodes; FOR i := 0 TO lautxmlnodelist3.length() - 1 DO BEGIN lautatributo := lautxmlnodelist3.item(i); IF NOT ISCLEAR(lautatributo)THEN lautxmlatributo := lautatributo.getAttributeNode('Fecha'); IF NOT ISCLEAR(lautxmlatributo) THEN tfecha := lautxmlatributo.value; END; tfecha:= lautatributo.nodeValue; tuuid := lautxmlnode.text; testatusuuid := lautxmlnode2.text; fechacancelacion := COPYSTR(tfecha,1, 19); testatusuuid := lautxmlnode2.text; "Date/Time Canceled" := fechacancelacion; "Fiscal Invoice Number PAC" := tuuid; "Date/Time Canceled" := fechacancelacion; IF testatusuuid = '201' THEN BEGIN "Electronic Document Status" := "Electronic Document Status"::Canceled; "Error Code" := lautxmlnode2.text; "Error Description" := 'Cancelado'; END;[s][s][/s][/s]Any idea
Answers
you can use the following functions for delete prefix and namespace.
//variables
Name DataType
GlobSourceInStream InStream
XMLDestinationStream InStream
//called function
RemoveNameSpace(GlobSourceInStream,XMLDestinationStream);
PROCEDURE RemoveNameSpace@50000008(VAR XMLSourceStream@50000007 : InStream;VAR XMLDestinationStream@50000008 : InStream);
VAR
XslCompiledTransform@50000000 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.Xsl.XslCompiledTransform";
XsltXMLReader@50000001 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlReader";
XSLTString@50000002 : Text;
SourceXMLReader@50000003 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlReader";
DestinationXMLWriter@50000004 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlWriter";
StringReader@50000005 : DotNet "'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.StringReader";
XmlReaderSettings@50000006 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlReaderSettings";
TempBlob@50000011 : Record 99008535;
BEGIN
TempBlob.Blob.CREATEINSTREAM(XMLDestinationStream);
XSLTString := '<?xml version="1.0" encoding="UTF-8"?>';
XSLTString := XSLTString + '<xsl:stylesheet version="1.0" ' +
'xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' +
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" >';
XSLTString := XSLTString + '<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes"/>';
XSLTString := XSLTString + '<xsl:template match="/">';
XSLTString := XSLTString + '<xsl:copy>';
XSLTString := XSLTString + '<xsl:apply-templates />';
XSLTString := XSLTString + '</xsl:copy>';
XSLTString := XSLTString + '</xsl:template>';
XSLTString := XSLTString + '<xsl:template match="soap:Header">';
XSLTString := XSLTString + '</xsl:template>';
XSLTString := XSLTString + '<xsl:template match="*">';
XSLTString := XSLTString + '<xsl:element name="{local-name()}">';
XSLTString := XSLTString + '<xsl:apply-templates select="@* | node()" />';
XSLTString := XSLTString + '</xsl:element>';
XSLTString := XSLTString + '</xsl:template>';
XSLTString := XSLTString + '<xsl:template match="@*">';
XSLTString := XSLTString + '<xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute>';
XSLTString := XSLTString + '</xsl:template>';
XSLTString := XSLTString + '<xsl:template match="text() | processing-instruction() | comment()">';
XSLTString := XSLTString + '<xsl:copy />';
XSLTString := XSLTString + '</xsl:template>';
XSLTString := XSLTString + '</xsl:stylesheet>';
StringReader := StringReader.StringReader(XSLTString);
XsltXMLReader := XsltXMLReader.Create(StringReader);
XslCompiledTransform := XslCompiledTransform.XslCompiledTransform;
XslCompiledTransform.Load(XsltXMLReader);
XmlReaderSettings := XmlReaderSettings.XmlReaderSettings;
SourceXMLReader := SourceXMLReader.Create(XMLSourceStream,XmlReaderSettings);
DestinationXMLWriter := DestinationXMLWriter.Create(XMLDestinationStream);
XslCompiledTransform.Transform(SourceXMLReader,DestinationXMLWriter);
XmlDoc := XmlDoc.XmlDocument;
XmlDoc.Load(XMLDestinationStream);
END;