You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by Sandra Mendez <ka...@yahoo.fr> on 2007/10/10 16:25:22 UTC

Forcing namespace prefixes

I would like to save un xml with a specific namespace.  I tried the following:
Map mappingNameSpaces = new HashMap();    
mappingNameSpaces.put("trn", http://my_uri);

XmlOptions xmlOptions = new XmlOptions();
xmlOptions.setSaveOuter();
xmlOptions.setSaveSuggestedPrefixes(mappingNameSpaces);

ClassXmlBean.xmlText(xmlOptions));

I got my xml with no prefixe "trn".  Does anyone know how to do this?


      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

Re: Forcing namespace prefixes

Posted by Christian Kaltepoth <li...@kaltepoth.de>.
Hi,

if I remember correctly you have to use the namespace uri as the key in the 
HashMap and not the prefix. Try using this:

mappingNameSpaces.put("http://my_uri", "trn");

Kind regards

Christian Kaltepoth


On Wednesday 10 October 2007 16:25:22 Sandra Mendez wrote:
> I would like to save un xml with a specific namespace.  I tried the
> following: Map mappingNameSpaces = new HashMap();
> mappingNameSpaces.put("trn", http://my_uri);
>
> XmlOptions xmlOptions = new XmlOptions();
> xmlOptions.setSaveOuter();
> xmlOptions.setSaveSuggestedPrefixes(mappingNameSpaces);
>
> ClassXmlBean.xmlText(xmlOptions));
>
> I got my xml with no prefixe "trn".  Does anyone know how to do this?
>
>
>      
> ___________________________________________________________________________
>__ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo!
> Mail



-- 
Christian Kaltepoth <ch...@kaltepoth.de>
GnuPG Key: http://www.kaltepoth.de/gnupg/pubkey.asc
Fingerprint: 9F04 0A94 CC40 C3EF 1A69  B2BB 51F4 4C84 BEB6 F127

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org