you are parsing the xml correctly, the trouble is that you are not
displaying it correctly.

>From your code:

<x:out select="$parsedxml//*"/> 
This will show nothing, as the "String XPath value" of your whole xml is
empty

<c:out value="${parsedxml}"/>
This shows [#document: null], since you'r displaying an object of type
org.w3c.Document, whose toString() method returns : "[" + name-of-the-node +
": " + value-of-the-node + "]".

It's an xml-xpath problem what you are witnessing, not an jstl one.


        Back in the "String XPath value" issue, the XPath specification says
that the value of transforming a node or a set of them into a String is the
concatenation of the values of the text or cdata nodes contained in the
subtree. A strange way of saying that it merely remove the tags (attributes
included)

        If you use the following tag, you should see something:

--->><x:out select="$parsedxml/MenuConfig/Menus/Menu/@name"/><<---
        That should output:

--->>UserMenu<<<---


-----Original Message-----
From: David Ketchin [mailto:[EMAIL PROTECTED]
Sent: 27 May 2004 17:41
To: '[EMAIL PROTECTED]'
Subject: Unable to parse XML input using x:parse


I am having a problem with the x:parse tag. 
Im using the standard 1.05 apache jstl taglib in a struts 1.1 app on
Jboss3.2.3
No matter what I do the xml fails to parse and a null document is produced.

The xml exists as a string property on a bean. 

the xml is as follows -

<?xml version="1.0" encoding="ISO-8859-1" ?>
    <MenuConfig>
    <Menus>
        <Menu  name="UserMenu"  title="HOMEMENU"  description="test"
mtype="">
                <Item  name="HomeMenu"  title="HOMEMENU"  description="test"
forward="Main.Welcome" mtype=""/>
                <Item  name="AssystUserIncidentMenu"  title="INCIDENTMENU"
mtype="LogIncAllowed">
                        <Item   name="LogIncident"   title="LOGINCIDENT"
forward="Incident.LogIncident" mtype="LogIncAllowed"/>
                        <Item   name="PrinterFault"
title="LOGPRINTERFAULT" forward="Incident.LogPrinterFault"
mtype="LogIncAllowed"/>
                        <Item   name="SoftwareFault"
title="LOGSOFTWAREFAULT" forward="Incident.LogSoftwareFault"
mtype="LogIncAllowed"/>
        </Item>
                <Item  name="AssystUserChangeMenu"  title="CHANGEMENU"
mtype="LogRFCAllowed">
                        <Item   name="LogChange"   title="LOGCHANGE"
forward="Change.LogChange" mtype="LogRFCAllowed"/>
                        <Item   name="MoveFault"   title="LOGMOVEFAULT"
forward="Incident.LogMoveFault" mtype="LogRFCAllowed"/>
                        <Item   name="NewtstartFault"
title="LOGNEWSTARTFAULT" forward="Incident.LogNewstartFault"
mtype="LogRFCAllowed"/>
        </Item>
        
        <Item  name="ViewMenu"  title="VIEWMENU"  description="test"
mtype="">
                        <Item   name="EventMonitor"   title="EVENTMONITOR"
forward="Main.EventSearch" mtype=""/>
                        <Item   name="KnowledgeBase"   title="KNOWLEDGEBASE"
forward="Main.KnowledgeBase" mtype=""/>
                        <Item   name="AMSearch"   title="ASSETSEARCH"
forward="Asset.AssetSearch" image="../images/select-all.png" mtype=""/> 
        </Item>
        <Item name="ROOTACTION" title="ROOTACTION" mtype="OnSelectedEvent">
                <Item  name="action.menu.look.for.solution"
title="action.menu.look.for.solution" forward="KnowledgeSearchForEvent"
mtype="OnSelectedIncident"/>
                <Item  name="PLACEKNOWLEDGESOLVED" title="doesnt matter it
will come from the database"  forward="KnowledgeSolved"
mtype="OnSelectedEvent;KnowledgeSearchSelected"/>
                <Item  name="ACTIONMENUCATEGORYnormalActions"
title="NORMALACTION"  mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUCATEGORYsuggestedActions"
title="SUGGESTEDACTION"  mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUCATEGORYstageActions"
title="STAGEACTION"  mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUCATEGORYfutureActions"
title="FUTUREACTION"  mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUCATEGORYuserStatusActions"
title="USERACTION"  mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUCATEGORYclockActions"
title="CLOCKACTION"  mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUTYPE1" title="assign"
mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUTYPE2" title="acknowl"
mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUTYPE3" title="callback not matter
will be replaced with action name"  mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUTYPE40" title="add info"
mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUTYPE42" title="chaseup"
mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUTYPE4" title="pending cls"
mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUTYPE5" title="closure"
mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUTYPE6" title="reopen"
mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUCATEGORYsupplierActions"
title="SUPPLIERACTION"  mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUTYPE29" title="major inc"
mtype="OnSelectedEvent;MajorIncidentSelected"/>
                <Item  name="ACTIONMENUCATEGORYstateActions"
title="STATEACTION"  mtype="OnSelectedEvent"/>
                <Item  name="ACTIONMENUCATEGORYsystemActions"
title="SYSTEMACTION"  mtype="OnSelectedEvent"/>
                
        </Item>
        <Item  name="HelpMenu"  title="HELPMENU" mtype="">
                        <Item   name="AboutPage"   title="ABOUTPAGE"
forward="Help.About" mtype=""/>
                        <Item   name="HelpPage"   title="HELPPAGE"
forward="Help.Main"  target="_blank" mtype=""/>
        </Item>
        <Item  name="LogoutMenu"  title="LOGOUTMENU"   forward="Main.Logout"
description="test" mtype=""/>
        </Menu>
        </Menus>
        </MenuConfig>


the page parsing it is -

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/x.tld" prefix="x" %>
<html>
<body>
<title> Test page </title>
<h1> Xml display - from loaded value</h1>



<c:out value="${MenuBuilderForm.userXmlMenu}" escapeXml="false"/>

<x:parse var="parsedxml"  xml="${MenuBuilderForm.userXmlMenu}" />

<x:out select="$parsedxml//*"/> 
<c:out value="${parsedxml}"/>

The output is -
 

Xml display - from loaded value
  

[#document: null] 



But viewing the souce shows the c:out has written the xml to the source of
the page showing it is loaded on the bean and is in scope.

All the relevant jars are in /WEB-INF/lib and the tld's in /WEB-INF/ - have
also had the same issue with 1.04 and 1.02 taglib.

any ideas?



**********************************************************************
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this message (or responsible for delivery
of the message to such person), you may not copy or deliver this message to
anyone. In such case, you should destroy this message, and notify us
immediately. If you or your employer does not consent to Internet email
messages of this kind, please advise us immediately. Opinions, conclusions
and other information expressed in this message are not given or endorsed by
my Company or employer unless otherwise indicated by an authorised
representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being
transmitted via electronic mail attachments we cannot guarantee that
attachments do not contain computer virus code.  You are therefore strongly
advised to undertake anti virus checks prior to accessing the attachment to
this electronic mail.  Axios Systems Ltd grants no warranties regarding
performance use or quality of any attachment and undertakes no liability for
loss or damage howsoever caused.
**********************************************************************


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

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

Reply via email to