Hi;

 

I use:

Document wordML = DocumentHelper.createDocument();

Element wordDoc = wordML.addElement("w:wordDocument");

wordDoc.addNamespace("w", "http://schemas.microsoft.com/office/word/2003/wordml");         

Element fonts = wordDoc.addElement("w:fonts");

 

This gets me:

<w:wordDocument xmlns:w=http://schemas.microsoft.com/office/word/2003/wordml>

  <w:fonts>

  </w:fonts>

</w:wordDocument>

 

Which is what I want. However, I am not understanding namespaces right. Because I tried the following and I did not get the w: on the nodes:

Document wordML = DocumentHelper.createDocument();

Element wordDoc = wordML.addElement("wordDocument", "http://schemas.microsoft.com/office/word/2003/wordml");

wordDoc.addNamespace("w", "http://schemas.microsoft.com/office/word/2003/wordml");         

Element fonts = wordDoc.addElement("fonts", “http://schemas.microsoft.com/office/word/2003/wordml");

 

I can understand that maybe it wouldn’t work for <wordDocument> as it is getting added there. But shouldn’t this work for <fonts>? What am I not understanding about this?

 

Thanks - dave

Reply via email to