You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Guoliang Cao <ca...@ispsoft.com> on 2000/12/04 16:45:07 UTC

Use xalan extension.

Hi,

I'm willing to use Xalan Java extension to insert a node to the input
xml object. I wonder if it's possible.   Seems "ext-java:getDNSRR()"
returns the original input xml object instead of
<addRR><RRName>....</RRName></addRR>

...
<apply-templates select="ext-java:getDNSRR()"/>
...

...
    public static NodeList getDNSRR() throws Exception {
        Document doc = new DocumentImpl();
        Node n1 = doc.appendChild(doc.createElement("addRR"));
        Node n2 = n1.appendChild(doc.createElement("RRName"));
        n2.appendChild(doc.createTextNode("fadsfsadfasfadsfds"));
        return (NodeList)doc;
    }
...


Re: Use xalan extension.

Posted by Guoliang Cao <ca...@ispsoft.com>.
This method works fine (with or w/o namespace).

Guoliang


public static NodeList getDNSRR() throws Exception {
        Document doc = new DocumentImpl();
        Element elm = doc.createElementNS(PROVREQ_NAMESPACE,"addRR");
        Node n2 =
elm.appendChild(doc.createElementNS(PROVREQ_NAMESPACE,"RRName"));
        n2.appendChild(doc.createTextNode("fadsfsadfasfadsfds"));
        return (NodeList)elm;
    }


> Hi,
>
> I'm willing to use Xalan Java extension to insert a node to the input
> xml object. I wonder if it's possible.   Seems "ext-java:getDNSRR()"
> returns the original input xml object instead of
> <addRR><RRName>....</RRName></addRR>
>
> ...
> <apply-templates select="ext-java:getDNSRR()"/>
> ...
>
> ...
>     public static NodeList getDNSRR() throws Exception {
>         Document doc = new DocumentImpl();
>         Node n1 = doc.appendChild(doc.createElement("addRR"));
>         Node n2 = n1.appendChild(doc.createElement("RRName"));
>         n2.appendChild(doc.createTextNode("fadsfsadfasfadsfds"));
>         return (NodeList)doc;
>     }
> ...