[jdom-interest] Adding attributes which contain colons to root element

Black, Henry henry.black at ngc.com
Fri Jul 22 10:47:56 PDT 2005


I am using XML and JDOM for the first time, and want to build a document
using:

 

      Element root = new Element("myReport");

      Document doc = new Document(root);

 

Then I want to add attributes for namespace and schema

 

      root.setAttribute("xmlns:asi",

                        http://www.broken.com/asi)

      root.setAttribute("xsi:schemaLocation",

                         "C:/config/myReport.xsd");

 

This results in an error which states:  "Attribute names cannot contain
colons."

 

I think I can deal with the namespace by assigning the namespace when I
build each element.  I have not figured out how to assign a schema
location without using the SAXBuilder class to build my document.  That
option seems to require that I have a physical xml file, which I don't
need.

 

Suggestions?

 

Thanks.

 

     - Henry

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20050722/74ddc04d/attachment.htm


More information about the jdom-interest mailing list