if UploadIntoStream(DialogTitle, '', 'XML file(*.xml)|*.xml', TempFileName, InStrm) then XmlDocument.ReadFrom(InStrm, xmlDoc) else Error('It is not an XML file');
<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Certificado="FICTITIOUS_CERTIFICATE" PaymentConditions="30" Export="01" Date="2023-08-15T10:30:45" Folio="12345" PaymentMethod="01" ExpeditionLocation="75000" PaymentType="PUE" Currency="USD" CertificateNumber="SAT_CERTIFICATE" Seal="FICTITIOUS_DIGITAL_SEAL" Series="B" Subtotal="500.00" ExchangeRate="1.00" DocumentType="I" Total="575.00" Version="3.3" xsi:schemaLocation="http://www.sat.gob.mx/cfd/4 http://www.sat.gob.mx/sitio_internet/cfd/4/cfdv33.xsd"> <cfdi:Issuer Name="FICTITIOUS_ISSUER" FiscalRegime="601" Rfc="FICTITIOUS_ISSUER_RFC" /> <cfdi:Receiver FiscalAddress="76000" Name="FICTITIOUS_RECEIVER" FiscalRegimeReceiver="612" Rfc="FICTITIOUS_RECEIVER_RFC" CfdiUsage="G01" /> <cfdi:Concepts> <cfdi:Concept Quantity="10" ProdServKey="01010101" UnitKey="H87" Description="Sample Product" Amount="500.00" IdentificationNumber="PROD-001" Unit="Piece" UnitValue="50.00"> <cfdi:Taxes> <cfdi:Transfers> <cfdi:Transfer Base="500.00" Amount="80.00" Tax="002" RateOrQuota="0.160000" TaxType="Rate" /> </cfdi:Transfers> </cfdi:Taxes> <cfdi:CustomsInformation PedimentNumber="15 12345 67890 1234567" /> </cfdi:Concept> </cfdi:Concepts> <cfdi:Taxes TotalTransferredTaxes="80.00"> <cfdi:Transfers> <cfdi:Transfer Base="500.00" Amount="80.00" Tax="002" RateOrQuota="0.160000" TaxType="Rate" /> </cfdi:Transfers> </cfdi:Taxes> <cfdi:Complement> <tfd:DigitalTaxStamp xmlns:tfd="http://www.sat.gob.mx/TimbreFiscalDigital" TimbradoDate="2023-08-15T10:35:22" SATCertificateNumber="SAT_CERTIFICATE" CertifyingEntityRfc="SAT_RFC" CFDigitalSeal="FICTITIOUS_DIGITAL_CFD_SEAL" SATSeal="FICTITIOUS_DIGITAL_SAT_SEAL" UUID="9b824153-a667-4a46-829d" Version="1.1" xsi:schemaLocation="http://www.sat.gob.mx/TimbreFiscalDigital http://www.sat.gob.mx/sitio_internet/cfd/TimbreFiscalDigital/TimbreFiscalDigitalv11.xsd" /> </cfdi:Complement> </cfdi:Comprobante>
Message('%1', xmlNodRoot.AsXmlAttribute());
xmlAttrCol := xmlNodRoot.AsXmlElement().Attributes(); for i := 1 to xmlAttrCol.Count do begin if xmlAttrCol.Get(i, xmlAttr) then Message('%1 = %2', xmlAttr.Name, xmlAttr.Value); end;
Answers
You could use the "XML Buffer" table to do that, something like this:
Regards.
I found an error in the following line of code:
xmlDoc.WriteTo(TxtVar)
The error is that the variable TxtVar cannot store more than 250 characters.
How did you declare the variable TxtVar ?
Must be like this:
Regards
Ok, then what type of variable xmlDoc is ?
Regards.
This is part of the code; I declared the variable xmlDoc as an XMLDocument.
These are the data from app.json
Regards.
And you get the error in the line circled in red in the image below ?
That line have not the limitation of 250 chars, the function copy the XML to a Text, and I use it in my code a lot.
Maybe you cloud check if the XML uploaded is correct.
Regards.
The content of the .XML file is correct; it does not trigger the suggested error.
Regards.
In the image looks like the error is in the line
If that is the case some of the table fields that the function filled may exceed 250 chars.
So you should need to process the XML on your own, like this:
Regards
In the meantime, I tested the XML file that you posted and works fine with then XML Buffer table, this is the code to get the attributes of 'Concept':
Regards
In the last example, I encountered an error on the line "tmpXMLBuffer.SetRange(tmpXMLBuffer.Name, xmlTag);" this error occurred when using XML files with larger content.
I used a bit of your previous example, however, I haven't been able to retrieve attribute values, but I can access the 'Concept' node. I've made adjustments to my code:
Regards.
To retrieve the attributes with your ladst code you can use the code that I posted before, inside the foreach change this:
For this:
Regards.
I adapted it to my code, and after conducting some tests, it met the requirement. I appreciate your support.
Regards.