You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "Mach, Gavin" <ga...@merck.com> on 2003/10/07 01:11:32 UTC

Having trouble with Multiple namespaces reading XML source

Hello everybody,
I am new to this group but have been developing a JSP page which reads in an
xml source file. I am also using Xtags taglib for XML parsing and
processing. A snippet of the xml source looks like below:...

INPUT.XML
<?xml version="1.0" ?>
<Task SchemaVersion="2.0" Type="ResponseTask"
xmlns="http://www.lexign.com/schemas/flow">
	<ApplicationData>
		<DataItemString ID="4100" Name="EMPLOYEENAME" Access="Write"
Description="Employees name">Joe Bloggs
</DataItemString>
		<DataItemString ID="4200" Name="ISIDINITIATOR"
Access="Write" Description="ISID">1031
		</DataItemString>
	</ApplicationData>
</Task>


The problem I am having is the xml file is only successfully read when the
xmlns attribute of the Task element is removed however the application that
creates this xml file cannot allow this so the xmlns attribute has to stay.
The JSP file that reads it has the following structure in the head ...(very
typical)

XMLReaderApp.jsp
<?xml version="1.0" encoding="UTF-8"?>
<html>
<%@ taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0" prefix="xtags"
%>
<head>
<%
    String TXNfile = "INPUT.XML";
%>
<xtags:parse uri=TXNfile/>
..etc..

  I am aware this has to do with a namespace clash and have looked into
various resources but to no avail. Could someone please shed some light on
this issue. Thanks a bundle in advance. 


Gavin.



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Having trouble with Multiple namespaces reading XML source

Posted by Pierre Delisle <Pi...@Sun.COM>.
Gavin,

I cannot talk for the xtags taglib, but for the xml tags of the standard taglib (implementation of JSTL), you have to make sure you access properly a specific node by referring to its namespace using the name() and namespace-uri() functions in XPath.

You may want to check that thread in the archive:
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=taglibs-user@jakarta.apache.org&msgNo=4049

The deferred section of the JSTL 1.1 change log (http://java.sun.com/jstl), says the following:

Deferred Changes

Provide adequate XML Namespace support for the XML actions

JSTL 1.0 does not currently provide adequate support for XML namespaces in XPath expressions. Collaboration between the JSP, JAXP, and JSTL specs is necessary to come up with the proper solution. This will therefore be addressed in the next major revision of JSTL.

HTH,

    -- Pierre

Mach, Gavin wrote:

> Hello everybody,
> I am new to this group but have been developing a JSP page which reads in an
> xml source file. I am also using Xtags taglib for XML parsing and
> processing. A snippet of the xml source looks like below:...
> 
> INPUT.XML
> <?xml version="1.0" ?>
> <Task SchemaVersion="2.0" Type="ResponseTask"
> xmlns="http://www.lexign.com/schemas/flow">
> 	<ApplicationData>
> 		<DataItemString ID="4100" Name="EMPLOYEENAME" Access="Write"
> Description="Employees name">Joe Bloggs
> </DataItemString>
> 		<DataItemString ID="4200" Name="ISIDINITIATOR"
> Access="Write" Description="ISID">1031
> 		</DataItemString>
> 	</ApplicationData>
> </Task>
> 
> 
> The problem I am having is the xml file is only successfully read when the
> xmlns attribute of the Task element is removed however the application that
> creates this xml file cannot allow this so the xmlns attribute has to stay.
> The JSP file that reads it has the following structure in the head ...(very
> typical)
> 
> XMLReaderApp.jsp
> <?xml version="1.0" encoding="UTF-8"?>
> <html>
> <%@ taglib uri="http://jakarta.apache.org/taglibs/xtags-1.0" prefix="xtags"
> %>
> <head>
> <%
>     String TXNfile = "INPUT.XML";
> %>
> <xtags:parse uri=TXNfile/>
> ..etc..
> 
>   I am aware this has to do with a namespace clash and have looked into
> various resources but to no avail. Could someone please shed some light on
> this issue. Thanks a bundle in advance. 
> 
> 
> Gavin.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org