Hi Pete, The xmlns="" on the root shouldn't hurt, it's perfectly valid XML. I believe the latest CVS was supressing the xmlns="" when it wasn't needed however. I'll double check.
Thanks, --Keith Pete Thomas wrote: > > Keith, > > Apologies for emailing you direct, but we've moved to the latest castor > version from cvs and we're getting xmlns="" coming out on our root element. > I saw your reply below to someone elses problem, but our xsd already has > elementFormDefault="qualified". > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > elementFormDefault="qualified"> > > any ideas ? We need the latest version for some bug fixes re: xs:import. > > XML after Marhalling > > <?xml version="1.0" encoding="UTF-8"?> > <CTP xmlns=""> > <CTPHEADER> > > cheers > Pete > > -----Original Message----- > From: Keith Visco [mailto:[EMAIL PROTECTED] > Sent: 19 February 2003 20:34 > To: [EMAIL PROTECTED] > Subject: Re: [castor-dev] xmlns="" attribute in many elements > > Hi Zeb, > > This has to do with your XML Schema, and a recent bug fix for Castor. > The <schema> element has two attributes: 'elementFormDefault' and > 'attributeFormDefault' which help to determine the targetNamespace for a > given element or attribute declaration. In previous versions of Castor > these two attributes (and their associated default values) were being > ignored. Now Castor is handling them, which is why you see the the > xmlns="" appear on many of your elements. > > By default, the 'elementFormDefault' attribute is "unqualified". This > means any non top-level element declarations will have no associated > targetNamespace. All top-level element declarations (those that have > the <schema> as it's parent element) will be associated with the > targetNamespace as defined for the schema itself. > > So in your schema, all your top-level elements will be in your > targetNamespace and all non top-level elements won't. > > To get the behavior of Castor 0.9.4.2, change the elementFormDefault > attribute to "qualified" as such: > > <xsd:schema elementFormDefault="qualified"....> > > This will cause both top-level and non top-level element declarations to > be in the targetNamespace that is defined for the schema, or none if one > doesn't exist. > > Hopefully that's enough information so that you understand why Castor is > adding the xmlns="", if you need more information you can read the W3C > XML Schema 1.0 Recommendation: Part 1 Structures, for all the details, > and specifically sections 3.3 "Element Declarations", 3.2 "Attribute > Declarations" and 3.15 "Schemas as a whole". Pay attention to > attributeFormDefault, elementFormDefault and targetNamespace. > > Thanks, > > --Keith > > "Aurangzeb M. Agha" wrote: > > > > I apologize if this has been answered in the past few days, but my search > > in the archives brough up nothing. > > > > I've just upgraded from 0.9.4.2 to 0.9.4.3 and am finding that new XML > > queries I generate has many empty xmlns="" attribute in some elements. > > > > With the old version, when I unmarshalled and printed, my generated XML > > would look like: > > > > <NexRes product="Hotel" xmlns="http://castor.exolab.org/"> > > <session> > > <language>ENG</language> > > <affiliate> > > <id>123456789</id> > > </affiliate> > > </session > > ... > > > > But now, I'm getting: > > > > <NexRes product="Hotel" xmlns="http://castor.exolab.org/"> > > <session> > > <language xmlns="">ENG</language> > > <affiliate> > > <id xmlns="">123456789</id> > > </affiliate> > > </session > > ... > > > > Note the empty xmlns="" attributes in only some of the the elements. > > > > I'm not sure why this would be happening. > > > > Just in case, my xsd contains the following for the 'session' element: > > > > <!--Description for session --> > > <xsd:element name="session"> > > <xsd:complexType> > > <xsd:sequence> > > <xsd:element name="id" type="xsd:string" > > minOccurs="0" maxOccurs="1"/> > > <xsd:element name="timestamp" > > type="xsd:string" minOccurs="0" > maxOccurs="1"/> > > <xsd:element name="language" > > type="xsd:string" minOccurs="0" > maxOccurs="1"/> > > <xsd:element ref="affiliate"/> > > </xsd:sequence> > > </xsd:complexType> > > </xsd:element> > > > > Rgs, > > Zeb > > > > -- > > http://www.greece101.com > > > > ----------------------------------------------------------- > > If you wish to unsubscribe from this mailing, send mail to > > [EMAIL PROTECTED] with a subject of: > > unsubscribe castor-dev > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev > This transmission is confidential and intended solely for the person or > organisation to whom it is addressed. It may contain privileged and > confidential information. If you are not the intended recipient, you should > not copy, distribute or take any action in reliance on it. If you have > received this transmission in error, please notify the sender immediately. > Any opinions or advice contained in this e-mail are those of the individual > sender except where they are stated to be the views of RDF Group or EMS plc. > All messages passing through this gateway are virus scanned.
