Title: Message

Hi Ray

 

Does XmlOptions.setSaveSuggestedPrefixes() with a map mapping your default namespace to a blank prefix (“”) do what you want? If not try that with XmlOptions.setSaveAggressiveNamespaces().

 

Cheers,

 

Lawrence

 


From: Roberts, Ray [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 1:03 PM
To: [email protected]
Subject: RE: elementFormDefault="unqualified" not generated unqualified elements....

 

Lawrence,

 

Thanks for your help.  It's gotten me closer to a solution.  I guess what I really want to do it to declare a default namespace in the XML that is output, therefore eliminating prefixes on the elements.

 

e.g.

 

<kml xmlns="http://earth.google.com/kml/2.0">

   <Folder>

        <description>....</description>

        ... etc....

   </Folder>

</kml>

 

I was guessing that setUseDefaultNamespace() would achieve this affect, but it didn't seem to do the trick.

 

Any ideas?

 

Thanks again for your help.

-Ray

 

-----Original Message-----
From: Lawrence Jones [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 3:15 PM
To: [email protected]
Subject: RE: elementFormDefault="unqualified" not generated unqualified elements....

Hi Ray

 

elementFormDefault=”qualified” affects only those elements which are local (i.e. declared within the context of another element or type), not those which are global (i.e. declared at the top level – just within <schema>). See http://www.w3.org/TR/xmlschema-1/ section 3.3.2.

 

If you want the top level ones to not have a namespace then you must not have a targetNamespace attribute in the <schema> element.

 

I believe your generated XMLBeans will then end up in the “special” package “noNamespace”. But please note - this is _not_ something we recommend. Namespaces are useful to stop your elements clashing with ones with the same name from a different schema.

 

Cheers,

 

Lawrence

 


From: Roberts, Ray [mailto:[EMAIL PROTECTED]
Sent: Monday, September 26, 2005 8:12 AM
To: [email protected]
Subject: elementFormDefault="unqualified" not generated unqualified elements....

 

I've got a schema that starts off like:

 

<?xml version="1.0"?>
<xs:schema elementFormDefault="unqualified" attributeFormDefault="unqualified"
           targetNamespace="http://earth.google.com/kml/2.0"
           xmlns="http://earth.google.com/kml/2.0"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">

 

 

But when I go to generate the xml from XMLBeans, my elements all have prefixes attached to them.   Does anyone know how to generate unqualified XML elements via XMLBeans?

 

 

Any help you could throw this way would be much appreciated.

 

Thanks,

-Ray

 

 

Reply via email to