In the two snippets, one is schema and the other is a XML document, shown below, why a new namespace "po" is created in the XML document? The URI for "po" is the same as that of "mh". Can we use "mh" in the XML document? Or can we not to create a namespace in the XML document? Thank you.
The prefix name you choose to use in the document should be equal to the targetnamespace of the schema which contains the element you are using.
for example, in your case, mh prefix is just for use in schema definition, but po prefix in document is actually linking to targetnamespace and not mh prefix. Its just that both prefix mh and targetnamespace are the same in this case.
so, you cannot use mh as it is defined for use only in the schema definition.
An interesting thing. The scope of the prefix extends from the beginning of the start-tag in which it appears to the end of the corresponding end-tag. Meaning, after passing the end tag the prefix is gone.
Please have a look at Namespace Scoping.
William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com