You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Jim Shain <Ji...@alltel.com> on 2001/02/02 17:36:00 UTC

Proper Way to Create Schema Node in DOM?

In Xerces 1.3.0, is there a proper/preferred way to create the schema NS
attributes for a DOM?  Old DTD land we used DocumentTypeImpl to specify DTD
like:

  outDocument.appendChild(new DocumentTypeImpl((DocumentImpl) outDocument,
    null, null, dtdName.toString()));

What is the twin of this in schemaland?

Jim Shain
Sr. C/S Architect
ALLTEL Information Services

Re: Proper Way to Create Schema Node in DOM?

Posted by Elena Litani <hl...@jtcsv.com>.
Hi, Jim,

You mean you want to have smth like:

<root xmlns="http://www.my.com"
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:schemaLocation="http://www.my.com mySchema.xsd"/> ?

If so, I believe the proper code is:

DocumentImpl doc = new DocumentImpl();
Element e = doc.createElementNS("", "root");            
e.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns",
"http://www.my.com");
e.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xsi",
"http://www.w3.org/2000/10/XMLSchema-instance");
e.setAttributeNS("", "xsi:schemaLocation", "http://www.my.com
mySchema.xsd");


Elena

Jim Shain wrote:
> 
> In Xerces 1.3.0, is there a proper/preferred way to create the schema NS
> attributes for a DOM?  Old DTD land we used DocumentTypeImpl to specify DTD
> like:
> 
>   outDocument.appendChild(new DocumentTypeImpl((DocumentImpl) outDocument,
>     null, null, dtdName.toString()));
> 
> What is the twin of this in schemaland?
> 
> Jim Shain
> Sr. C/S Architect
> ALLTEL Information Services
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org