PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD] XML Creation
[WD] XML Creation
Débuté par Gianni Spano, 23 juil. 2017 15:44 - 4 réponses
Posté le 23 juillet 2017 - 15:44
Hello to all

I'm creating an XML file and i have a few questions to post here.

1) How to change the first line created by my program? Some parameter to use? :

<?xml version="1.0" encoding="ISO-8859-1" TO <?xml version="1.0" encoding="UTF-8"?>

2) Is there a Xml function to create this line (copied from another Xml file)?

<?xml-stylesheet type="text/xsl" href="(File per visualizzazione FatturaPA 1.2 - NON inviare).xsl"?>

Suggestions are very appreciated
TIA

Gianni
Posté le 23 juillet 2017 - 17:24
Hi Gianni,

I don't know if there is another way, but once the file is created, you can simply use the replace function to replace the original first line by yours

Best regards
Posté le 23 juillet 2017 - 20:28
Hello Fabrice

Thanks for your response.

Yes, i thought the same approach..but i wanted to know if there were any other ways.


Thanks again
Gianni
Posté le 24 juillet 2017 - 18:34
Hi

you can add it:



PROCEDURE Constructor()


xmlfact..Encoding = "UTF-8"
nNamespace1 is xmlNamespace
nNamespace2 is xmlNamespace
nNamespace3 is xmlNamespace
nNamespace4 is xmlNamespace
nNode is dynamic xmlNode
nNode = xmlfact.Invoice

nNamespace4..URI = "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" //1
nNamespace3..URI = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" //2
nNamespace3..Name = "cac" //2
nNamespace2..Name = "cbc"
nNamespace2..URI = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"//3
nNamespace1..Name = "xsi"
nNamespace1..URI = "http://www.w3.org/2001/XMLSchema-instance"

Add(nNode..NamespaceDeclared, nNamespace4)
Add(nNode..NamespaceDeclared, nNamespace3)
Add(nNode..NamespaceDeclared, nNamespace2)
Add(nNode..NamespaceDeclared, nNamespace1)

nNode:schemaLocation..Value = "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd"
nNode:schemaLocation..Namespace = nNamespace1

This stuff is needed for an ubl invoice


Regards
Allard
Posté le 24 juillet 2017 - 19:57
Hello Allard

Thank you for your suggestion

Gianni