Title: [Click and type the General title]

 

Hello,

 

I’m just starting to use Xerces to manage (parse and generate) XML file. I use Xerces 2.4 to generate XML file.

 

My code is very common, I think:

 

      Document xmldoc = builder.newDocument();

 

      Element root = xmldoc.createElement("NewNETP");

 

      root.setAttribute("xmlns", "XXX");

      root.setAttribute("xmlns:MF","XXX");

      root.setAttribute("xmlns:xsi" , "http://www.w3.org/2001/XMLSchema-instance");

      root.setAttribute("xsi:schemaLocation", "XXX ./new_netp.xsd");

    Element elt = xmldoc.createElement("CompanyName");

    elt.appendChild(xmldoc.createTextNode(netp.getCompanyName()));

 

 

The problem: XML file generated contain « XMLNS="" » on each element! What’s wrong?

 

 

<?xml version="1.0" encoding="UTF-8"?>

<NewNETP xmlns="XXX"

    xmlns:MF="XXX"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xsi:schemaLocation="XXX ./new_netp.xsd" CreationDate="2003-08-06T13:07:05">

    <CompanyName xmlns="">TEST</CompanyName>

    <CompanyAddress xmlns="">test</CompanyAddress>

    <CompanyEmail xmlns="">test</CompanyEmail>

 

 

Thank you,

 

David DERUMIER

 

Reply via email to