Schema - Target Namespace
In my biztalk application, there are 1 flat file and 1 xml as incoming files, and 1 xml as output.
The source xml file contains no namespace. Thus, I didn't add any target namespace to the schema. But I find that the xml disassembler will not be able to recognize the file.
If I add the target namespace in the schema, then the source file will not conform to the schema.
So, what should I do?
Please help.
[670 byte] By [
YCH] at [2008-1-7]
So, if the source XML is fixed, what should I do in this case?
Keep the target namespace in the schema?
YCH at 2007-10-2 >

Hi,
You don't necessarily have to have a target namespace. However your Xml message should have a namespace. And, as said in the previous post, it's this namespace in combination with the root node that will identify the message type of the message.
Post your schema and your Xml message and further describe your problem and we'll be able to help you better.
Richard Hallgren
http://richardhallgren.com/blog
The XML document.
Code Snippet
<?xml version="1.0" encoding="UTF-8"?>
<Example xmlns="http://www.w3.org/XML/Schema">
<Item>
<Element1>A</Element1>
<Element2>B</Element2>
</Item>
</Example> I can't remember the schema exactly because I'm not using my PC.
But the problem is that if I put a target namespace in the schema, the xml disassembler cannot recognize the above message.
If I alter the above message to the below one and keep the target namespace. It works fine.
However, the real situation is that the source xml document should be the first one. YCH at 2007-10-2 >

YCH,
The first document snippet you show is certainly using the wrong namespace... It is using the XSD namespace! Why would you want to say that an XML message should be using the XSD namespace if it is not, indeed, XSD?
Still you don't need (read shouldn't have

) the
schema namespace in you
message. I'd try something like the below.
Code Snippet
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Example xmlns:ns0="http://example.org/example/">
<Item>
<Element1>A</Element1>
<Element2>B</Element2>
</Item>
</ns0:Example>
Basically you have to
define the "ns0" namespace that you've declared that the Example node is in (by saying "ns0:Example").
However if you like something that more like your first message you can define the namespace as a default namespace as in the example below.
Code Snippet
<?xml version="1.0" encoding="UTF-8"?>
<Example xmlns="http://example.org/example">
<Item>
<Element1>A</Element1>
<Element2>B</Element2>
</Item>
</Example>
This however means that
all you nodes are within that namespace and you'll have a little harder getting the right XPath expressions and so on. But they should be perfectly valid messages.
This could also be a good time to read some about qualified vs. unqaulifed messages and namespaces in general.
Richard Hallgren
http://richardhallgren.com/blog
Thanks. In my case, I will keep the document like the second one.
But now there is one more schema, a property schema, it seems that property schema must have a target namespace. And that prperty schema is relate to the xml document.
Will this problem more complex? Please suggest.
YCH at 2007-10-2 >
