|
|
|
|
|
|
Re: How to test an element specified in the input xml or not? [message #41288 is a reply to message #41257] |
Tue, 05 February 2008 19:08 |
Paul Elder Messages: 849 Registered: July 2009 |
Senior Member |
|
|
Thanks fro the information.
FYI. I have committed a change that at least resolves the NPE.
Bug, the underlying problem is you have the following code:
<c:if test="/datasource/raw" var="ds1">
Raw ds is <c:get select="$ds1/@uri"/>.
</c:if>
The fix corrects a problem where /datasource/raw was evaluating to 'true',
and setting $ds1 to null, thus causing the follow-on problem in c:get (which
has also been fixed).
The fix will be included in this weeks maintenance build.
Paul
"Chaohong" <hamlinxie@gmail.com> wrote in message
news:9a9e3e691d2bddeea0176df04115e32d$1@www.eclipse.org...
> Hi Paul,
> For your convenient, here is the attached. Please create an "EMFT JET
> Transformation Project", paste the following content into corresponding
> files and then run the transformation. The NullPointerException should
> catch you there. Or, you can fetch the test project from here
> (https://bugs.eclipse.org/bugs/attachment.cgi?id=88492).
> I found a bug submitted
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=217057) reporting such an
> issue. Could you have a look as well? Thanks a lot.
>
> stack trace
> =====================================
> java.lang.NullPointerException
> at
> org.eclipse.jet.internal.xpath.ast.Axis$AttributeAxis.evalua te(Axis.java:119)
> at org.eclipse.jet.internal.xpath.ast.Step.evalAsNodeSet(Step.j ava:77)
> at
> org.eclipse.jet.internal.xpath.ast.NodeSetExpr.evalAsObject( NodeSetExpr.java:44)
> at
> org.eclipse.jet.internal.xpath.XPathExpressionImpl.evaluate( XPathExpressionImpl.java:59)
> at
> org.eclipse.jet.XPathContextExtender.resolveAsObject(XPathCo ntextExtender.java:444)
> at
> org.eclipse.jet.XPathContextExtender.resolveAsString(XPathCo ntextExtender.java:141)
> at org.eclipse.jet.internal.taglib.control.GetTag.doAction(GetT ag.java:53)
> at
> org.eclipse.jet.internal.runtime.SafeEmptyRuntimeTag$1.doRun (SafeEmptyRuntimeTag.java:49)
> at
> org.eclipse.jet.internal.runtime.SafeCustomRuntimeTag$TagSaf eRunnable.run(SafeCustomRuntimeTag.java:72)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
> at org.eclipse.core.runtime.Platform.run(Platform.java:857)
> at
> org.eclipse.jet.internal.runtime.SafeEmptyRuntimeTag.doStart (SafeEmptyRuntimeTag.java:43)
> at org.eclipse.jet.compiled._jet_dump1.generate(_jet_dump1.java :78)
> at
> org.eclipse.jet.transform.TransformContextExtender.execute(T ransformContextExtender.java:146)
> at
> org.eclipse.jet.transform.TransformContextExtender.execute(T ransformContextExtender.java:119)
> at
> org.eclipse.jet.internal.taglib.workspace.FileTag.doAction(F ileTag.java:101)
> at
> org.eclipse.jet.internal.runtime.SafeEmptyRuntimeTag$1.doRun (SafeEmptyRuntimeTag.java:49)
> at
> org.eclipse.jet.internal.runtime.SafeCustomRuntimeTag$TagSaf eRunnable.run(SafeCustomRuntimeTag.java:72)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
> at org.eclipse.core.runtime.Platform.run(Platform.java:857)
> at
> org.eclipse.jet.internal.runtime.SafeEmptyRuntimeTag.doStart (SafeEmptyRuntimeTag.java:43)
> at org.eclipse.jet.compiled._jet_main.generate(_jet_main.java:4 1)
> at
> org.eclipse.jet.transform.TransformContextExtender.execute(T ransformContextExtender.java:146)
> at
> org.eclipse.jet.transform.TransformContextExtender.execute(T ransformContextExtender.java:119)
> at org.eclipse.jet.JET2Platform$5.run(JET2Platform.java:458)
> at
> org.eclipse.jet.internal.runtime.JETBundleManager.run(JETBun dleManager.java:331)
> at org.eclipse.jet.JET2Platform.runTransform(JET2Platform.java: 426)
> at org.eclipse.jet.internal.launch.JETProcess.run(JETProcess.ja va:156)
> at
> org.eclipse.jet.internal.launch.JET2TransformationDelegate.l aunch(JET2TransformationDelegate.java:59)
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.java:1102)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
> =====================================
>
> dump.jet
> =====================================
> <?xml version="1.0" encoding="utf-8"?>
> <c:if test="/datasource/raw" var="ds1">
> Raw ds is <c:get select="$ds1/@uri"/>.
> </c:if>
> <c:if test="/datasource/aggregated" var="ds2">
> <c:if test="$ds2/query" var="query">
> Query language is <c:get select="$query/@language"/>.
> </c:if>
> </c:if>
> =====================================
>
> sample.xml
> =====================================
> <?xml version="1.0" encoding="UTF-8"?>
> <datasource name="AggregatedCalendar"
> xsi:noNamespaceSchemaLocation="test.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <aggregated>
> <query language="mysql">
> <![CDATA[
> SELECT Calendar.TestEvent AS Event
> FROM MyCalendar AS Calendar;
> ]]>
> </query>
> </aggregated>
> </datasource>
> =====================================
>
> test.xsd
> =====================================
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:sdi="http://www.motorola.com/sdi" elementFormDefault="qualified"
> attributeFormDefault="unqualified">
> <xs:element name="datasource">
> <xs:complexType>
> <xs:sequence>
> <xs:choice>
> <xs:element name="raw">
> <xs:complexType>
> <xs:attribute name="uri" use="required">
> </xs:attribute>
> <xs:attribute name="type">
> </xs:attribute>
> </xs:complexType>
> </xs:element>
> <xs:element name="aggregated">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="query">
> <xs:complexType>
> <xs:simpleContent>
> <xs:extension base="xs:anySimpleType">
> <xs:attribute name="language" use="required">
> </xs:attribute>
> </xs:extension>
> </xs:simpleContent>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:choice>
> </xs:sequence>
> <xs:attribute name="name" use="required">
> </xs:attribute>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> =====================================
>
> B.R.
>
> Chaohong
>
>
> Paul Elder wrote:
>
>> Chaohong:
>
>> Can you attach the schema, the test document, and XPath expression that
>> is failing? I have not been able to reproduce from the information you
>> have provided.
>
>> Paul
>
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04039 seconds