I want to create a xml file with this content:
<?xml version="1.0" ?>
<bsmart xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";
                 xsi:noNamespaceSchemaLocation="BkmsSchema2.xsd"/>

and stop.

I wrote this:
...
String xmlns="http://www.w3.org/2000/10/XMLSchema";;
String xsiNS="http://www.w3.org/2000/10/XMLSchema-instance";;

Document document = new DocumentImpl();
document.createProcessingInstruction("xml","version");
document.appendChild(document.createElement("bsmart"));


/**
* starting problem: this part don't work.
*/
Attr  xmlnsAttr=document.createAttributeNS(xmlns,"xsi");
xmlnsAttr.setValue(xsiNS);
xmlnsAttr.setPrefix("xmlns");
/**
* end.
* In this way I should create an attribute node with the xmlns
namespaceURI and "xmlns"
* prefix.
* But the parsing give me a NAMSPACE_ERR linked (I suppose) to the
setPrefix("xmlns")!
*/

Attr  noNameSpaceAttr =
document.createAttributeNS(xsiNS,"noNamespaceSchemaLocation");

noNameSpaceAttr.setValue("BkmsSchema2.xsd");
noNameSpaceAttr.setPrefix("xsi");

document.getDocumentElement().setAttributeNodeNS(noNameSpaceAttr);
...

thank you in advance


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to