1

I am new to XML and XSD. I understand the basics but have to work with very complex XSD schema.

Can someone please explain to me:

  1. What the below header says in English. What I specifically do not get is e.g. "urn:oecd:ties:cbc:v1". This question is new.
  2. What the XML file header delivering data under this schema should look like. This question is new.

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:cbc="urn:oecd:ties:cbc:v1" 
            xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
            xmlns:stf="urn:oecd:ties:stf:v4" 
            xmlns:iso="urn:oecd:ties:isocbctypes:v1" 
            targetNamespace="urn:oecd:ties:cbc:v1" 
            elementFormDefault="qualified" 
            attributeFormDefault="unqualified" 
            version="1.0.1">
    <xsd:import namespace="urn:oecd:ties:isocbctypes:v1" 
                schemaLocation="isocbctypes_v1.0.1.xsd"/>
    <xsd:import namespace="urn:oecd:ties:stf:v4" 
                schemaLocation="oecdtypes_v4.1.xsd"/>
C. M. Sperberg-McQueen
  • 24,596
  • 5
  • 38
  • 65
  • Well this does not help very much does it now? Someone marks your question as a duplicate when it is not so and then nothing happens any more. – Johann Muller Nov 07 '17 at 18:48
  • Voting to re-open. OP's questions may be frustratingly naive w.r.t. how namespaces work, but he does seem to have identified parts of his question that are not duplicates. – C. M. Sperberg-McQueen Nov 08 '17 at 01:02
  • The string `urn:oecd:ties:cbc:v1` is a URI in the `urn` scheme. As you can see from its usage, here it names a namespace. The URN namespace ID `oecd` is not registered with [IANA](http://www.iana.org/assignments/urn-namespaces), but one might guess that it's used by the [Organization for Economic Cooperation and Development](http://www.oecd.org). (As with any unregistered identifier, that guess might be wrong.) It is the owner of the `oecd` URN namespace who determines what meaning, if any, attaches to the string `ties:cbc:v1`. It doesn't affect the XSD schema either way. – C. M. Sperberg-McQueen Nov 08 '17 at 01:03
  • The only thing we know about XML documents valid against the schema described by the schema document you show is that their outermost element is likely to be in one of the namespaces `urn:oecd:ties:cbc:v1`, `urn:oecd:ties:isocbctypes:v1`, or `urn:oecd:ties:stf:v4`. Since the schema documents imported here could import other namespaces, that's a likelihood, not a guarantee. – C. M. Sperberg-McQueen Nov 08 '17 at 01:07
  • Thank you so much C.M. Sperberg-McQueen. You are right we all have our own specialisations and I know about as much about XML as I guess you know about corporate international transfer pricing. Your help is much appreciated. – Johann Muller Nov 08 '17 at 06:11
  • One last question if I may (was in original post). What should the header of the xml file look like? Must I copy all from ""? (I cannot test this on online validators as the xsd file references other files, and my desktop version of XMLValidator has problems to eventhough the OECD says the XSD files are good). – Johann Muller Nov 08 '17 at 06:23
  • Quite right; my ignorance of international transfer pricing would fill volumes, if not entire libraries! But no XSD schema prescribes exactly what the first start-tag of an XML document looks like; if I have understood your question, it has no answer. Many people find it helpful to declare all namespaces used in the document on the outermost element, but it's not required. If you follow that pattern you'll have namespace declarations for all of the namespace mentioned in my earlier comment. (I recommend a quick tutorial on XML namespaces; it may be unpleasant, but it won't take long. ) – C. M. Sperberg-McQueen Nov 08 '17 at 16:23
  • 1
    Thank you for this. I can take it from here. By the way, I also came accross the following very helpful tutorial. I found it especially helpful for beginners like me and chapter 4 deals with Namespaces in a way that I found easier to follow than the WC3 Schools texts. https://www.liquid-technologies.com/xml-schema-tutorial/xsd-elements-attributes – Johann Muller Nov 08 '17 at 19:30

0 Answers0