Sorry, guys, I tried setNamespaceMapping and think I understand what it does.
But it just adds stuff to the header.
The following code
java.io.FileWriter fw = new java.io.FileWriter (m_outputFile, false);
org.exolab.castor.xml.Marshaller m = new org.exolab.castor.xml.Marshaller
(fw);
m.setNamespaceMapping("wls", "http://apps.pdc.org/server/xyz");
will generate the "wls" namespace below (but that is not my question...). My
question pertains to *eliminating* that empty xmlns="" that shows up in every
one of the wls child elements (which could be hundreds) to the top level gauges
element. As I see it, I have an all-or-nothing option either get rid of all
xmlns or have them show up in every element. My XML schema definition is at
http://www.pdc.org/pride/xmlschema/wls.xsd
Thanks.
<gauges xmlns:wls="http://apps.pdc.org/server/xyz"
xmlns="http://apps.pdc.org/wls/server/api">
- <wls xmlns="">
- <station globalID="SXXX03" operatorID="kodi" stationName="Kodiak_AK"
status="active" operator="NOS">
<location latitude="57.7317" longitude="-152.5117" />
- <nation>
<isoalpha3code>USA</isoalpha3code>
</nation>
</station>
- <system>
- <sensors>
<sensor type="BWL" interval="6" samples="1" xmtint="6" />
<sensor type="PWL" interval="1" samples="6" xmtint="6" />
<sensor type="BUB" interval="2" samples="30" xmtint="60" />
</sensors>
- <platforms>
<platform dcpid="33626698" xmtint="6" unit="M" fstmin="4" nonsample="0"
har="No" reverse="No" />
<platform dcpid="9321C400" xmtint="60" unit="F" fstmin="34" nonsample="0"
har="No" reverse="No" />
</platforms>
</system>
<product
serverLocation="http://tidesandcurrents.noaa.gov/data_menu.shtml?stn=9457292%20Kodiak%20Island%20AK&type=Tide%20Data"
/>
</wls>
</gauges>
-----Original Message-----
From: Stephen Bash [mailto:[EMAIL PROTECTED]
Sent: Friday, March 23, 2007 2:35 AM
To: [email protected]
Subject: Re: [castor-user] Supress Namespaces
Hi all-
Hopefully this isn't redundant, but I believe if you use the
setNamespaceMapping method on a Marshaller object (i.e. using the
NON-static marshal method), the namespace mapping will be declared at
the top level and any child elements that use that namespace will not
redeclare the prefix (in other words no xmlns attribute).
HTH,
Stephen
On 3/23/07, Werner Guttmann <[EMAIL PROTECTED]> wrote:
> Again, this is not required, as Castor (during marshalling) will be able
> (given that descriptor classes are available) to control the use of
> namespaces according to your XML schema definition.
>
> Werner
>
> > -----Ursprüngliche Nachricht-----
> > Von: Uday Kari [mailto:[EMAIL PROTECTED]
> > Gesendet: Freitag, 23. März 2007 03:16
> > An: [email protected]
> > Betreff: RE: [castor-user] Supress Namespaces
> >
> > B. (prefer this) one of us extends the API within
> > org.exolab.castor.xml.Marshaller to provide method
> > suppressNamespacesInAllChildElements() or
> > showNamespacesInTopElementOnly()
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email