I'm not sure, but maybe this text could help you
XmlCursor cursor = rdoc.newCursor();
if (cursor.toFirstChild()) {
cursor.setAttributeText(new QName(
"http://www.w3.org/2001/XMLSchema-instance",
"noNamespaceSchemaLocation"), "Respuesta.xsd");
}
rdoc is and XmlObject
----- Mensaje original ----
De: bob bob <[EMAIL PROTECTED]>
Para: [email protected]
Enviado: martes, 27 de noviembre, 2007 18:51:53
Asunto: Re: How to not add namespace on save
The original does not have the namespace in it. I add the namespace as
validateOptions just to allow the xml document to load (I couldn't get it to
load without it). The problem is on the save it adds the namespace regardless.
I would like it to not add it.
Thanks
----- Original Message ----
From: Jacob Danner <[EMAIL PROTECTED]>
To: [email protected]
Sent: Monday, November 26, 2007 7:24:52 PM
Subject: Re: How to not add namespace on save
I'm confused, does the instance you are parsing already have the
namespace defined?
Why is the namespace being set as the default?
Thx,
-jacobd
On 11/26/07, bob bob <[EMAIL PROTECTED]> wrote:
> I have an xml bean that I load an xml document by adding the namespace
> programatically (because the xml document never has it).
> XmlOptions validateOptions = new XmlOptions();
> validateOptions.setErrorListener(validationErrors);
>
HashMap ns = new HashMap();
> ns.put("", "http://skywiresoftware.com/ccm/global");
> validateOptions.setLoadSubstituteNamespaces(ns);
> xmlini = XMLINIDocument.Factory.parse(new
> File("war/WEB-INF/xml/global.xml"), validateOptions);
>
> problem is, when I save the xml document, it saves the xmlns and I don't
> want it to. How do I save an xml document using xml beans without putting
> the xmlns in it?
> Here's the save code;
> XmlOptions saveOptions = new XmlOptions();
> saveOptions.setUseDefaultNamespace();
> xmlini.save(new
File("war/WEB-INF/xml/global.xml"),
> saveOptions);
>
> Thx.
>
>
>
> ____________________________________________________________________________________
> Be a better sports nut! Let your teams follow you
> with Yahoo Mobile. Try it now.
> http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Get easy, one-click access to your favorites.
Make Yahoo! your homepage.
______________________________________________
¿Chef por primera vez?
Sé un mejor Cocinillas.
http://es.answers.yahoo.com/info/welcome