• Font Size
  • S
  • M
  • L

Search via FAQ No.


  • No : 30713
  • Open Date : 2019/09/02 14:46
  • Print
NEW

[DataSpider Servista] About the Namespace Definition Upon Outputting Data in the XML Type Schema

After defining a namespace with a certain element upon outputting data in the XML type schema, I tried to define the same namespace in the sub-element of that element. However, the value of the namespace was unable to output in the sub-element.
 
Please explain the cause and a way to resolve this problem.
Category : 

Answer

■Specification
 
If you define a namespace in a certain element, the namespace will be applied to the entire content of the element.
 
In other words, if you declare the namespace in the element, it will also apply to the sub-element of that element. For this reason, if you declare the same namespace in the sub-element, the value will be omitted for it is already being applied.
 
■Workaround
 
The above behavior conforms to the XML namespace specification.
(Please refer to the reference information link for details.)
 
For this reason, it is not possible to output the namespace definition value in the sub-element of the same element.
 
■Avoidance Method
 
Please consider methods such as first declaring a value different from the value that is already been defined and then converting it using other adapters in the subsequent process.
 
For example, the method will be such as first outputting the file as an XML file and then calling the program that will convert upon starting an external application; or converting it after reading it using the CSV adapter and then exporting it to files again.
 
■Supplementary (Notes on Bypass Method)
 
Please note that if you define the same namespace multiple times in the same content, it may not read.
 
For example, in the case of the XML adapter, if an element and its sub-element define the same namespace, the namespace of the sub-element will not read.
 
 
Reference Information
  • XML Schema: About Namespaces (*External website)
*Contents of the web page in the link above is written in Japanese.
 
The relevant part is below:
 
A namespace is declared as an element attribute. The Namespace Definition does not necessarily need to be done by the root element, but you can declare at any element of the XML document. Unless it is not overwritten by another namespace definition that has the same prefix name, the scope of the defined namespace starts from the defined element and applies to the entire content of that element.
The content of the element here is defined as the content between the <start tag> and the </ end tag> of that element.