Hi,

Thanks a lot for help.

However I am getting performance issue. If I use java 1.5.0.13 with xalan 2.6 
version, first of all , it does not give me HIERARCHY_REQUEST_ERR error and 
performance is also very good.

If I use xalan 2.7.1 using xalan API in classpath, it gives 
HIERARCHY_REQUEST_ERR error which is solved by using below code as you 
suggested. However, performace is degraded by 35%.

DocumentFragment resultRoot = doc.createDocumentFragment();
Result result = new DOMResult( resultRoot );

My classpath is 

CLASSPATH=/tmp/xalan/xalan.jar:/tmp/xalan/serializar.jar:/tmp/xalan/xml-apis.jar:/tmp/xalan/xercesImpl.jar

/opt/java1.5/jre/bin/IA64N/java 
-Djavax.xml.transform.TransformFactory=org.apacge.xerces.jaxp.TransformFactoryImpulser.parserApp
 -Xms512m -Xmx1024m -Xss1024k -XX:+ForceMmapReserved MyServer


Could you please help what I am doing wrong so that I can get the same 
performance as I am getting from the JAVA 1.5.0.13 with xalan-2.6 version 


Thanks & regards
Ajay Bhadauria

--- On Tue, 10/28/08, Henry Zongaro <[EMAIL PROTECTED]> wrote:

> From: Henry Zongaro <[EMAIL PROTECTED]>
> Subject: Re: HIERARCHY_REQUEST_ERR error while transforming.
> To: "ajay bhadauria" <[EMAIL PROTECTED]>
> Cc: xalan-j-users@xml.apache.org
> Date: Tuesday, October 28, 2008, 6:57 PM
> Hi, Ajay.
> 
> ajay bhadauria <[EMAIL PROTECTED]> wrote on
> 2008-10-27 01:10:34 PM:
> > I am using xalan jar files for xsl transformation. I
> am using my 
> > custom class to call java method. It gives me below
> error if I add 
> > another node within
> /Doc:Document/Doc:camt.028.001.02/Doc:Assgnmt . 
> > Please see the attached file c.xml file 
> > 
> > SystemId Unknown; Line #0; Column #0;
> org.w3c.dom.DOMException: 
> > HIERARCHY_REQUEST_ERR: An attempt was made to insert a
> node where it
> > is not permitted.
> 
> I can't actually run your test, as I don't have
> your Validator class. 
> However, I'm guessing that your stylesheet produces a
> result tree that 
> consists of a root node with a non-whitespace text node
> child.
> 
> Your Java program contains the following.
> 
>     DocumentBuilder dBuilder =
> dFactory.newDocumentBuilder();
>     Document doc = dBuilder.newDocument();
> 
>     ...
> 
>     Source source = new DOMSource( document );
>     Result result = new DOMResult( doc );
>     System.out.println("debug1");
>     xformer.transform( source,result);
> 
> So it's using a DOM Document node to contain the
> result.  Although the 
> XPath data model and XSLT allow for trees where the root
> node has 
> non-whitespace text node children, and more than one
> element child, DOM 
> Document nodes permit only one Element node child and no
> non-whitespace 
> Text node children.
> 
> To fix this, create either a DOM DocumentFragment node or a
> DOM Element 
> node to contain the result tree, like this:
> 
>     DocumentFragment resultRoot =
> doc.createDocumentFragment();
>     Result result = new DOMResult( resultRoot );
> 
> Or you can use the zero-argument DOMResult constructor, in
> which case the 
> processor will create a DocumentFragment node for you, like
> this:
> 
> 
>     Result result = new DOMResult();
>     System.out.println("debug1");
>     xformer.transform( source,result);
>     Node resultRoot = result.getNode();
> 
> I hope that helps.
> 
> Thanks,
> 
> Henry
> ------------------------------------------------------------------
> Henry Zongaro
> XML Transformation & Query Development
> IBM Toronto Lab   T/L 313-6044;  Phone +1 905 413-6044
> mailto:[EMAIL PROTECTED]


      

Reply via email to