Hi all,

     We are using dom4j-1.6.1.  I need to add namespace information in the root element of Document object. I tried some options

Like:

1.   Doc.getRootElement().addAttribute("xmlns","http://www.w3.org/2001/06/grammar");


  This does not work  .addAttribute does not allow adding “xmlns” in dom4j-1.6.1. It used to allow in previous versions.

 

2. I tried using Doc.getRootElement().add(new Namespace("","http://www.w3.org/2001/06/grammar"));

 

   This seems the solution as per documentation and it adds the namespace information in root element but this solution gives one other problem  

 

 xmlns are added in immediate child elements which we do not require.

i.e

 

 <Myroot  xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-us" root="InfoMain" version="1.0">

 

            <mychild  xmlns="" id="InfoMain" scope="public">

 

                       

 

             </ mychild  >

</ Myroot  >

 

Please suggest solution/ work around to fix this issue. Your help will be highly appreciated.

 

Regards

Kirti  

 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to