HTML Area Problem: SAXParserException and ResourceNotFoundException

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

HTML Area Problem: SAXParserException and ResourceNotFoundException

Florian Schmitt-2
Hi,

i've got a problem concerning the HTMLArea Control (fckeditor, last
nightly build because i need correct processing of the enter key -> new
paragraph). I use that control to render HTML that's embedded in my XML
Files. Before passing my XML instance to my xform, the html content gets
serialized to text content so that it can be passed to the HTML Area;
after submitting the xform, its (maybe updated) content gets parsed again.

Serialization seems to work fine, the problem appears on parsing the
output of the HTML Area. The parsing is done using a XSTL Transformation
wih the attached xsl file. My fckconfig.js contains:

FCKConfig.ProcessHTMLEntities = false ;
FCKConfig.ProcessLatinEntities = false ;
FCKConfig.ProcessGreekEntities = false ;
FCKConfig.IncludeLatinEntities = true ;
FCKConfig.IncludeGreekEntities = true ;
FCKConfig.ProcessNumericEntities = false ;

The instance data may look like:
(...)
<textdaten>
         <titelzeile>
             <body>[HTML content]</body>
         </titelzeile>
         <osatz>
             <body>[HTML content]</body>
         </osatz>
</textdaten> (...)

The titelzeile/body and osatz/body elements contain the serialized HTML
content as text. I get several Exceptions depending on the text content.

If the body tag looks like
<body>&lt;p&gt;foo&lt;/p&gt;&lt;p&gt;bar&lt;/p&gt;</body>
(parsed: <body><p>foo</p><p>bar</p></body>
i get a SAXPArserException:

org.xml.sax.SAXParseException: The markup in the document following the
root element must be well-formed.
        at
orbeon.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
        at
orbeon.apache.xerces.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
        at
orbeon.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
        at
orbeon.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:314)
        at
orbeon.apache.xerces.impl.XMLScanner.reportFatalError(XMLScanner.java:1436)
        at
orbeon.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(XMLDocumentScannerImpl.java:1164)
        at
orbeon.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:338)
        at
orbeon.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:828)
        at
orbeon.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:758)
        at orbeon.apache.xerces.parsers.XMLParser.parse(XMLParser.java:148)
        at
orbeon.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1178)
        at org.orbeon.saxon.event.Sender.sendSAXSource(Sender.java:269) (...)

Some log messages later, a ResourceNotFoundException appears:

org.orbeon.oxf.resources.ResourceNotFoundException: Cannot load
"/oxf/xslt/utils/utils.xsl" with webapp loader
        at
org.orbeon.oxf.resources.WebAppResourceManagerImpl.getContentAsStream(WebAppResourceManagerImpl.java:74)
        at
org.orbeon.oxf.resources.ResourceManagerBase.getContentAsSAX(ResourceManagerBase.java:133)
        at
org.orbeon.oxf.resources.PriorityResourceManagerImpl$4.run(PriorityResourceManagerImpl.java:122)
(...)

If the body tag looks like <body>&lt;p&gt;foo&lt;/p&gt;</body>
(parsed: <body><p>foo</p></body>), everything works fine.

I don't understand why PresentationServer behaves differently in those
cases - i need to process HTML content with more than one paragraph
element. Can anybody help?

Thanks a lot
florian

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:saxon="http://saxon.sf.net/"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       
        <xsl:template match="/">
                <xsl:apply-templates />
        </xsl:template>

        <!-- parse the content of the html node to xml -->
        <xsl:template match="titelzeile/body/text()|osatz/body/text()">
                <xsl:copy-of select="saxon:parse(.)" />
        </xsl:template>

        <!-- For all other nodes: copy them and iterate over children -->
        <xsl:template
                match="*|@*|comment()|processing-instruction()|text()">
                <xsl:copy>
                        <xsl:apply-templates
                                select="*|@*|comment()|processing-instruction()|text()" />
                </xsl:copy>
        </xsl:template>
       
</xsl:stylesheet>

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

smime.p7s (6K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: HTML Area Problem: SAXParserException and ResourceNotFoundException

Alessandro Vernet
Administrator
On 1/30/07, Florian Schmitt <[hidden email]> wrote:

> If the body tag looks like
> <body>&lt;p&gt;foo&lt;/p&gt;&lt;p&gt;bar&lt;/p&gt;</body>
> (parsed: <body><p>foo</p><p>bar</p></body>
> i get a SAXPArserException:
>
> org.xml.sax.SAXParseException: The markup in the document following the
> root element must be well-formed.

Florian,

You get this error because you have more than one root element (there
are 2 <p> at the root of the document you are trying to parse). If you
need to be able to parse this type of expression, try something like:

saxon:parse(concat('&lt;gaga>', ., '&lt;/gaga>'))/gaga/node()

Alex
--
Orbeon Forms - Web Forms for the Enterprise, Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: HTML Area Problem: SAXParserException and ResourceNotFoundException

Florian Schmitt-2
Hi Alex,

>> org.xml.sax.SAXParseException: The markup in the document following the
>> root element must be well-formed.
>
> Florian,
>
> You get this error because you have more than one root element (there
> are 2 <p> at the root of the document you are trying to parse). If you
> need to be able to parse this type of expression, try something like:
>
> saxon:parse(concat('&lt;gaga>', ., '&lt;/gaga>'))/gaga/node()
thanks a lot, i missed that the parsed text should result in a
well-formed document. Now everything works :-)

florian


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

smime.p7s (6K) Download Attachment