Re: DOMWrite an HTMLDocument

Jacob Kjome <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi Roger,

Ah... that is quite novel

Out of curiosity, can you provide the code snippets you use to load the 
generated XSL transformation using XMLC for both XML and HTML 
documents?  This might be functionality we'd want to add to the 
DOMLoader.  Right now the DOMLoader loads documents from classes and either 
a file from the file system or classpath, but does not yet load a stream 
(if that is, in fact, what you are doing).  Anyway, rather than speculate 
on what you are doing, I'll just wait for you to tell me what you are 
doing....and we'll try to get the bug worked out on the XMLC side of things.

thanks,

Jake

At 10:20 AM 7/11/2003 -0300, you wrote:
>Hi Jake,
>
>Thanks a lot for the workaround. Unfortunatly it doesn't work for me 
>because my Document comes from an XSL transformation, so it is not a 
>class. I'm using it to generate a preview:
>http://www.livesidebar.com/servlet/SetTheme.event?themeId=doubleTab
>
>Fortunatly, it works for XML Documents, so I'm now generating XHTML which 
>is fine for now. Hopefully this bug will be fixed when I need to generate 
>HTML again, so that's fine :)
>
>Thanks again!
>Cheers,
>Roger.
>
>--
>Jacob Kjome wrote:
>>Hi Roger,
>>Hopefully this bug will get tracked down and fixed in XMLC before making 
>>the XMLC-2.2 release.  In the meantime, you should be able to load your 
>>document successfully using (exception handling not provided for brevity)...
>>DOMLoader loader = DefaultDOMLoader.getGlobalInstance();
>>Document doc = null;
>>doc = loader.getDOM(MyPageHTML.class);
>>new DefaultDOMWriter().write(doc, resp);
>>Jake
>>At 10:06 AM 7/10/2003 -0300, you wrote:
>>
>>>Hi Jake,
>>>
>>>I did test the reduced test case. It produces the exact same exception 
>>>from when I get the HTMLDocument from my business object.
>>>
>>>Thanx,
>>>Roger.
>>>
>>>--
>>>Jacob Kjome wrote:
>>>
>>>>Hi Roger,
>>>>See comments below...
>>>>At 11:30 PM 7/9/2003 -0300, you wrote:
>>>>
>>>>>Hey Barracuda wizards!
>>>>>
>>>>>I'm updating an application from Barracuda 0.something to Barracuda 
>>>>>1.2 and I got stuck on this:
>>>>>
>>>>>--
>>>>>java.lang.NullPointerException
>>>>>         at 
>>>>> org.enhydra.xml.io.BaseDOMFormatter.getEncoding(BaseDOMFormatter.java:326)
>>>>>         at 
>>>>> org.enhydra.xml.io.BaseDOMFormatter.(BaseDOMFormatter.java:374)
>>>>>         at org.enhydra.xml.io.HTMLFormatter.(HTMLFormatter.java:99)
>>>>>         at 
>>>>> org.enhydra.xml.io.DOMFormatter.getFormatter(DOMFormatter.java:156)
>>>>>         at org.enhydra.xml.io.DOMFormatter.write(DOMFormatter.java:192)
>>>>>         at 
>>>>> org.enhydra.barracuda.core.util.dom.DefaultDOMWriter.write(DefaultDOMWriter.java:181) 
>>>>>
>>>>>         at 
>>>>> org.enhydra.barracuda.core.util.dom.DefaultDOMWriter.write(DefaultDOMWriter.java:146) 
>>>>>
>>>>>         at 
>>>>> lsb.presentation.screens.WizardScreen$RenderTabPreviewHandler.handleViewEvent(WizardScreen.java:336) 
>>>>>
>>>>>--
>>>>
>>>>
>>>>Hmm... curious.  Looks like it has more to do with XMLC than Barracuda, 
>>>>though.  As such, I'm cc'ing the XMLC list.
>>>>
>>>>>when writing an HTMLDocument with DefaultDOMWriter.
>>>>>
>>>>>Do you guys have an idea what it could be? The reduced testcase is:
>>>>>
>>>>>HTMLDocument themeDoc = 
>>>>>org.enhydra.xml.xmlc.html.HTMLDocumentFactory.createBasicDocument();
>>>>>new DefaultDOMWriter().write(themeDoc, context.getResponse());
>>>>
>>>>
>>>>What exactly are you trying to do?  createBasicDocument() will create 
>>>>an empty HTMLDocument.  Why would you want to write that immediately to 
>>>>output?  It still shouldn't fail with a NullPointerException in 
>>>>BaseDOMFormatter, however.  Looks like it bombs on the second line below...
>>>>} else if (document instanceof XMLObjectLink) {
>>>>         encoding = ((XMLObjectLink)document).getXMLObject().getEncoding();
>>>>}
>>>>Not sure how that would cause a null pointer exception?  If the 
>>>>document is an instance of XMLObjectLink, then the document is, 
>>>>obviously, not null and that whole line should succeed.  Richard, 
>>>>David, Mark, any ideas here?
>>>>Roger, did you actually test your reduced testcase or are you assuming 
>>>>that it is equivalent to another piece of code that is bombing?  If you 
>>>>haven't tested the reduced testcase, can you post your actual code?  It 
>>>>might make a bit more sense.
>>>>Jake
>>>>
>>>>>Cheers,
>>>>>Roger.
>>>>>
>>>>>_______________________________________________
>>>>>Barracuda mailing list
>>>>>[email protected]
>>>>>http://barracudamvc.org/lists/listinfo/barracuda
>>>>
>>>>
>>>>_______________________________________________
>>>>Barracuda mailing list
>>>>[email protected]
>>>>http://barracudamvc.org/lists/listinfo/barracuda
>>>
>>>
>>>_______________________________________________
>>>Barracuda mailing list
>>>[email protected]
>>>http://barracudamvc.org/lists/listinfo/barracuda
>>
>>_______________________________________________
>>Barracuda mailing list
>>[email protected]
>>http://barracudamvc.org/lists/listinfo/barracuda
>
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://barracudamvc.org/lists/listinfo/barracuda
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.