David,

if I try your example with my modification, the Styles element has no namespace declaration in it:
<workbook xmlns="..." xmlns:o="..." >
<Styles></Styles>
</workbook>


how do you want it to look like?

regards,
Maarten

David Thielen wrote:

Hi;

I tried that and Excel chokes over that too. What I need is to get <Styles>
with no namespace of any type set. Is there a way to do that?

Thanks - dave



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Maarten Coene
Sent: Thursday, December 09, 2004 4:27 AM
To: David Thielen
Cc: [EMAIL PROTECTED]
Subject: Re: [dom4j-user] How to addElement with no xmlns=""

David,

you add your <Styles> element with no namespace information, This means that your <Styles> element doesn't belong to a namespace, that's why the default namespace is set to "". However, I think you want your <Styles> element to be part of the default namespace of your workbook, so you'll have to add your <Styles> element with the correct namespace:

styles = wb.addElement("Styles", "urn:schemas-microsoft-com:office:spreadsheet");

this should do the trick

regards,
Maarten

David Thielen wrote:



Hi;



I have a root node with a number of namespaces including one with no prefix:

     wb = doc.addElement("Workbook");

     wb.addNamespace("", "urn:schemas-microsoft-com:office:spreadsheet");

     wb.addNamespace("o", "urn:schemas-microsoft-com:office:office");

     wb.addNamespace("x", "urn:schemas-microsoft-com:office:excel");

     wb.addNamespace("ss", "schemas-microsoft-com:office:spreadsheet");

     wb.addNamespace("html", "http://www.w3.org/TR/REC-html40";);



When I add an element to that element, I get:

     styles = wb.addElement("Styles");  è <Styles xmlns="">



How can I get rid of the xmlns=""?



Thanks - dave







-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user








-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to