You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Richard J Cardone <ri...@us.ibm.com> on 2004/09/27 06:56:02 UTC

Avoiding Namespace Prefix Insertion

Hi,

I use XmlObject.save(OutputStream, XmlOptions) to save XHTML/XForms markup 
to file.  My problem is that all unqualified element names in my document 
are given the xhtml namespace prefix even though those prefixes weren't 
specified in the original document.  I'd like to stop unqualified names 
from becoming namespace qualified. 

Here are the namespace declarations in the schema that I used to generate 
my xmlbeans:

<xs:schema targetNamespace="http://www.w3.org/1999/xhtml" 
xmlns="http://www.w3.org/1999/xhtml" 
xmlns:xforms="http://www.w3.org/2002/xforms" 
xmlns:xs="http://www.w3.org/2001/XMLSchema">

 Here is the element that declares namespaces in my XHTML documents:

<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:xhtml="http://www.w3.org/1999/xhtml" 
xmlns:xforms="http://www.w3.org/2002/xforms" id="hx1"> 

When I save a document that contains the above <html> tag, all unqualified 
element tags are assigned the "xhtml:" prefix.  For example, the above 
line is saved as <xhtml:html ...>.  If I remove the xmlns:xhtml attribute 
from the above <html> tag, then only those prefixes in the original source 
code appear in the saved file.  Is there a way other than removing the 
xmlns:xhtml attribute to stop this prefix insertion?

Thanks, 
Rich