dom4j生成带命名空间的节点

Element workBook = doc.getRootElement();
Namespace namespace = workBook.getNamespace();
    Element workSheet = workBook.addElement(new QName("Worksheet",namespace));
    workSheet.addAttribute("ss:Name","Sheet1");
            Element names = workSheet.addElement(new QName("Names",namespace));
                Element namedRange = names.addElement(new QName("NamedRange",namespace));
                namedRange.addAttribute("ss:Name","Print_Area");
                namedRange.addAttribute("ss:RefersTo","=Sheet1!R1C1:R45C16");

你可能感兴趣的:(dom4j生成带命名空间的节点)