Re: how to: unqualify root element with targetnamespace

Hi Jeff,

> I'm trying to create an XML doc that uses unqualified elements, but
> retains the targetnamespace in the root element. However, when I set the
> 'elementFormDefault' property to unqualified I end up with an XML doc
> whose body elements are unqualified, but whose root element remains
> qualified. Looks like this:
> <ns0:PaymentReceivingDataEntity
> xmlns:ns0="";>
> <AccRecPayment>
> <PayerID>PayerID_0</PayerID>
> <PayeeID>PayeeID_0</PayeeID>
> <TenderNo>TenderNo_0</TenderNo>
> <Amount>10.4</Amount>
> <TransactionDate>1999-05-31T13:20:00.000-05:00</TransactionDate>
> <TenderIssueDate>1999-05-31T13:20:00.000-05:00</TenderIssueDate>
> </AccRecPayment>
> </ns0:PaymentReceivingDataEntity>
> Does anyone know how to get the root element unqualified also?

I'm not sure I understand what you're saying. In the first paragraph you say
you want to retain the namespace on the root node, but in the last one you
say you want to remove it; which is it? :)

FWIW, the document you posted seems in line with what you ask in the first
paragraph. If what you want is what you ask in the last one (i.e. no
namespaces at all), then you'd need to remove the targetNamespace on the XSD

Tomas Restrepo


Relevant Pages