I don't think should be a "feature" of dom4j because it's really irritating to 
generate common XML formats like WEB-INF/web.xml and see a bunch of xmlns="" 
attributes throughout the web.xml instead of seeing the typical web.xml. It 
would be a nice "feature" if dom4j had the smarts to not print the attribute if 
a namespace is not used.

-George

>Date: Thu, 24 May 2007 14:30:30 +0100
>From: "Edwin Dankert" <[EMAIL PROTECTED]>
>Subject: Re: [dom4j-user] Creating a namespace without a prefix (as in
>    sitemap.xml)
>To: "Galen Palmer" <[EMAIL PROTECTED]>
>Cc: dom4j-user@lists.sourceforge.net
>Message-ID:
>    <[EMAIL PROTECTED]>
>Content-Type: text/plain; charset=UTF-8; format=flowed
>
>Sorry for replying this late.
>
>> Element root = DocumentHelper.createElement("urlset");
>> root.addNamespace("", "http://www.sitemaps.org/schemas/sitemap/0.9";;);
>> Document doc = DocumentHelper.createDocument(root);
>>
>> I end up with a structure like :
>> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9";;>
>>   <url xmlns="">
>>     <loc>...
>
>The problem is that you will have to specify the namespace
>specifically on every element you create, otherwise dom4j assumes that
>the element is in no namespace.
>
>Regards,
>Edwin



------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

------------------------------

_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user


End of dom4j-user Digest, Vol 12, Issue 1
*****************************************

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to