p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   XSLT (http://p2p.wrox.com/forumdisplay.php?f=86)
-   -   XLS with XML containing JSP tags dom4j - weird! (http://p2p.wrox.com/showthread.php?t=42951)

azudio May 24th, 2006 07:09 AM

XLS with XML containing JSP tags dom4j - weird!
 
Hi All,

Hope this is the right place to ask and somebody could help.

I've got an XML file which is similar to XHTML but also has jps tags ( c:if test="blah...") embedded. When I do my transformation I get:

org.dom4j.DocumentException: Error on line 439 of document:
The prefix "c" for element "c:if" is not bound. Nested exception: The prefix "c" for element "c:if" is not bound.
    at org.dom4j.io.SAXReader.read(SAXReader.java:482)
blah...

Below is a snippet from my method that does the conversion from a string into a Document object..

Code:

286  // Read file as a string
287  String fileAsString = FileUtils.readFileToString(mySourceFile,"utf-8");
288
289  // Convert to a Document object
290  Document srcDocument = DocumentHelper.parseText(fileAsString);


My source XML looks a little like this..
Code:

<div id="items">
    <c:if test="${not empty tariffs}">
        do something
    </c:if>
</div>

Anybody got any idea?

Many thanks,

Adam.

mhkay May 24th, 2006 07:49 AM

My source XML looks a little like this..
Code:

<div id="items">
    <c:if test="${not empty tariffs}">
        do something
    </c:if>
</div>


Like the error message says, that's not namespace-well-formed XML because the "c:" prefix hasn't been declared.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

azudio May 24th, 2006 08:32 AM

Michael,

Doh! That worked !

I put the following onto my root element and it worked:

xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tiles="http://java.sun.com/jsp/jstl/core"

Still a bit new to this.

Thanks for the quick reply.

Adam


All times are GMT -4. The time now is 09:56 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.