Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 2 Jahren, 9 Monaten
Letzter Beitrag:
vor 2 Jahren, 9 Monaten
Beteiligte Autoren:
Allard, aelfassi, Stefan Bentvelsen

XML ( namespace )

Startbeitrag von Allard am 25.08.2015 09:07

Hi

I need to make and xml invoice file. So I have an xml that can be used, no xsd.

I use the second way to manage xml ( see code ):

sPath is string
xmlfact is xmlDocument ,description="UBL-Invoice"
xmlfact = XMLOpen("UBL-Invoice.xml")

I have the xml succesfully imported. And I can replace my data with the test data that is in the xml template.
So far all goes fine. However If I add extra invoice lines then a "prefix", an item that stand before the tagname is not added.

I have put a document in google docs so you can seen what I mean


link

After looking at it over and over again I read something about xmlespaces and it seems that the "prefixes" are namespaces that are declared in the template xml file.

OK My qusetion:

I guess windev cannot figger out the namespace from the templte xml. So I would have to add them manually. Is this possible?
And if I add the namespace in the declaration of the xml. and thus remove the tekst from the template xml. Will windev then use these prefixes ?

I hope this is a good explination of my problem. Iam just geting started with xml. I is possible to build the xml yourself but that is a lot more work and as the documentthat needs to be created is already quite complex that would be difficult to achief.

regards
Allard

Antworten:

Hi all who are interested,

I used the namespace to add schema location etc. These things where in the original template xml. It seems windev wants you to declare these yourself. After removing the lines windev recognized the prefix of the template xml.

I havenot solved all the problems I encoutered. But these are worth mentioning to anyone who wants to do some xml. The help on this topic is very pour!!

if you donnot add namespaces your self windev copies the xml templated and overwrites the content. If you profide namespaces this is not the case. It copies the template xml and doesnot overwrite it's content. New content is added. ( No errors in the newly added content).

This is strange behaviour. I have to figger out how to solve this.

If anyone of you has delt with this issue please respond this posting.

regards

Allard

von Allard - am 25.08.2015 22:20
Hi you all.

Hi you all. I have succesfully made the ubl invoicing ( Dutch version 1.1). However I have one issue left. I had to add the namespaces manually ( by code in windev, version 18 )
The order of these namespaces is where the final fault is. Does anyone know how to get the order as it should be.??


The order of My declaration:



The order in witch it should be:



link to a word doc. to see the code
My code for adding the namespaces:
xmlfact..Encoding = "UTF-8"
nNamespace1 is xmlNamespace
nNamespace2 is xmlNamespace
nNamespace3 is xmlNamespace
nNamespace4 is xmlNamespace
nNode is dynamic xmlNode
nNode = xmlfact.Invoice

nNamespace1..Name = "xsi"
nNamespace1..URI = "http://www.w3.org/2001/XMLSchema-instance";
nNamespace2..Name = "cbc"
nNamespace2..URI = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
nNamespace3..Name = "cac"
nNamespace3..URI = "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
nNamespace4..URI = "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
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
Add(nNode..NamespaceDeclared, nNamespace2)
//nNode:SchemaLocation..Namespace = nNamespace2
Add(nNode..NamespaceDeclared, nNamespace3)
Add(nNode..NamespaceDeclared, nNamespace4)

If anyone is interested then I can post some stuff on how to generate an xml like the one I am talking about. Please let me know for if nobody is interrested it would be a bit of a waste of time to write an article on this.

Regards
Allard

von Allard - am 26.08.2015 08:34
Hi Allard,

I'm interested ...

von Stefan Bentvelsen - am 29.08.2015 17:07
Hi Allard,

I'm also interested

Thanks in advance

von aelfassi - am 29.08.2015 19:48
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.