Re: how to: unqualify root element with targetnamespace


I dont seem to be able to send paste links to messages, else i could refer
you to my XML Namespaces post on this issue..

My original post is :

I have a XML file that looks approximately like

<SupplierRecord xmlns="http://mycompany/schemas/supplier1";>
</Supplier Record>

When i try to validate this against the schema, it throws errors for every
single element saying that it couldnt locate the namespace. So i generated a
instance from the schema and found that it creates a file that looks like this

<ns0:SupplierRecord xmlns:ns0="http://mycompany/schemas/supplier1";>
</ns0:Supplier Record>

This validates correctly. So i have had to resort to manually adding a ns0:
in order to get my map to work and the file to validate against the XSD

- Benjy

"Tomas Restrepo (MVP)" wrote:

> Benjamin,
> > In my case the source document comes from a custom component that uses
> > XSDObjectGen (the class in turn was generated from this schema) and does
> > not
> > have the ns0: prefix but has the correct targetNamespace. As a result it
> > fails to get mapped to my target schema (and fails when you validate it
> > against the schema). BizTalk complains that it cannot find the definition
> > for
> > any of the elements. I had to manually add the ns0: prefix for it to work
> > properly (the manual work around was only to test and see, obviously thats
> > not sustainable. )
> You mean it is something like this?
> <root xmlns="http://....";>
> <somenode>....</somenode>
> ....
> </root>
> If so, then that's just the same (as far as xml is concerned) to:
> <ns0:root xmlns:ns0="http://....";>
> <ns0:somenode>....</ns0:somenode>
> ....
> </ns0:root>
> Guess someone should just show what they mean because so far, I'm a little
> bit lost trying to understand you guys :)
> --
> Tomas Restrepo
> tomasr@xxxxxxxx

Relevant Pages