users@jaxb.java.net

Problem with namespaces in jaxb generated files

From: Sebestyén Zoltán <szoli2_at_FREEMAIL.HU>
Date: Tue, 05 Nov 2002 19:06:45 +0100

You are not authorized to send mail to the JAXB-
INTEREST list from your
zoltan.sebestyen_at_NETVISOR.HU account. You might be
authorized to send to the
list from another of your accounts, or perhaps when using
another mail program
which generates slightly different addresses, but
LISTSERV has no way to
associate this other account or address with yours. If
you need assistance or
if you have any question regarding the policy of the JAXB-
INTEREST list, please
contact the list owners: JAXB-INTEREST-request_at_JAVA.SUN.COM.

------------------------ Rejected message (94 lines) -------
-------------------
Return-Path: <zoltan.sebestyen_at_netvisor.hu>
Delivered-To: jaxb-interest_at_java.sun.com
Received: from netvisorpdc.intranet.netvisor.hu (adsl-242-
79.adsl-fixip.axelero.hu [195.228.79.242])
        by swjscmail1.java.sun.com (Postfix) with ESMTP id
27F67480E
        for <JAXB-INTEREST_at_JAVA.SUN.COM>; Tue, 5 Nov 2002
10:55:51 -0700 (MST)
Received: by netvisorpdc.intranet.netvisor.hu with Internet
Mail Service (5.5.2653.19)
        id <T9CATRD1>; Tue, 5 Nov 2002 19:00:37 +0100
Message-ID:
<617185BB0AA2D111872400105AD899AD4B6F80_at_netvisorpdc.intranet
.netvisor.hu>
From: zoltan.sebestyen_at_netvisor.hu
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Problem with namespaces in jaxb generated files.
Date: Tue, 5 Nov 2002 19:00:36 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: text/plain;
        charset="iso-8859-2"

Hi,

 I've got problems with generating valid XML files. JAXB
puts the whole file
into a namespace called 'ns1', even though it doesn't do so
in case of the
sample applications. I suppose it has to do with my xml
schema, JAXB's
missing something and creates this 'ns1' namespace as a
default. Could you
tell me please what's missing?

Regards,

Zoltan

To check things I wrote a little app that unmarshal an xml
file and then
marshalls it into another file.

The schema header:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
targetNamespace="http://www.mx.com/Schemas/2002/Service"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.mx.com/Schemas/2002/Service"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
        <xsd:element name="AppPortal">
        ...
        </xsd:element>
        ...
</xsd:schema>


The source file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DEFANGED_AppPortal
xmlns="http://www.mx.com/Schemas/2002/Service"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mx.com/Schemas/2002/Service
D:\Development\AppPortal\src\MyApp\in.xsd">
        <sdtResponse version="00.01" client="1234567890">
                <client>
                        <name>Jozsi Corporate</name>
                        <site>

        <contactName>JoskaPista</contactName>
                                <contactTel>1-234-
567</contactTel>
                                <Location>Joska
Inc.</Location>
                        </site>
                </client>
                <topology>
                        <sapList>
                                <sap id="1234567890"/>
                        </sapList>
                </topology>
        </sdtResponse>
</AppPortal>

The result:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns1:AppPortal
xsi:schemaLocation="http://www.mx.com/Schemas/2002/Service
D:\Development\AppPortal\src\MyApp\in.xsd"
xmlns:ns1="http://www.mx.com/Schemas/2002/Service"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns1:sdtResponse version="00.01" client="1234567890">
<ns1:client>
<ns1:name>Jozsi Corporate</ns1:name>
<ns1:site>
<ns1:contactName>JoskaPista</ns1:contactName>
<ns1:contactTel>1-234-567</ns1:contactTel>
<ns1:Location>Joska Inc.</ns1:Location>
</ns1:site>
</ns1:client>
<ns1:topology>
<ns1:sapList>
<ns1:sap id="1234567890"></ns1:sap>
</ns1:sapList>
</ns1:topology>
</ns1:sdtResponse>
</ns1:AppPortal>