> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> 
> Hello,
> 
> A java library, I call it "itemAcc" produces the text of the XML-Tags
I'd
> like to include in my XSP file for stylesheet transformation.
> 
> In my XSP-File there is the following call:
> toXml.marshal(itemAcc, new IncludeXMLConsumer(this.contentHandler));
> 
> 
> ToXml.java method marshal contains following:
> 
> _cHandler.startElement("","","simple-item", new
> org.xml.sax.helpers.AttributesImpl());
>    _cHandler.startElement("","","id", new
> org.xml.sax.helpers.AttributesImpl());
>         _cHandler.characters(acc.getMember("id").toCharArray(), 0,
> acc.getMember("id").length());
>    _cHandler.endElement("","","id");
>    _cHandler.startElement("","","weight", new
> org.xml.sax.helpers.AttributesImpl());
>
_cHandler.characters(acc.getMember("weight").toCharArray(), 0,
> acc.getMember("weight").length());
>    _cHandler.endElement("","","weight");
>    _cHandler.startElement("","","weight-msg", new
> org.xml.sax.helpers.AttributesImpl());
>
_cHandler.characters(acc.getMemberExc("weight").toCharArray(),
> 0, acc.getMemberExc("weight").length());
>    _cHandler.endElement("","","weight-msg");
>   _cHandler.endElement("","","simple-item");
> 
> 
> 
> Call it without stylesheet transformation e.g.:
> 
> <map:match pattern="simplexml">
>       <map:generate type="serverpages" src="simple.xsp"/>
>       <map:serialize type="xml"/>
> </map:match>
> 
> I get the following correct Output:
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <simple-items edit="true" xmlns:xsp="http://apache.org/xsp";
> xmlns:cinclude="http://apache.org/cocoon/include/1.0";>
>       <simple-item>
>                 <id>1</id>
>                 <weight>123a</weight>
>                 <weight-msg>wrong NumberFormat</weight-msg>
>   </simple-item>
> </simple-items>
> 
> 
> However if I call it with an XSL transformation, I get the following
> exception:
> 
> java.lang.RuntimeException: java.lang.NullPointerException
>       at
>
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:31
74)
>       at java.lang.Thread.run(Thread.java:484)
> 
> Am I allowed to call _cHandler.startElement, _cHandler.characters and
> _cHandler.endElement by my own?

Yes.

However, instead of 

>   _cHandler.endElement("","","simple-item");

I would write:

   _cHandler.endElement("","simple-item","simple-item");

This might be your problem.

Vadim
 
> Is there a better solution available if I don't want to compose the
xml-tags
> directy in my XSP-File?
> 
> Regards,
> 
> Harald
> 
> --
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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

Reply via email to