Hi Jason,
 
I tested your xml and xpath on xindice 1.0, works fine if you make a little adjustment:
 
Try it without the namespaces in the xml doc if you can. Just make a document like:
<Mpeg7> <Description ..
 
That will help.
This also explains why the /*/* query worked for you, and the others didn't: the '*' will match on any element, regardless of the namespace.
 
 
You could also add the namespace to the query of course, even though it might beep al little since the namespaces are not defined there...
 
Also, remember to add double quotes to the query if you are using Windows, just in case you ever get into querying with attributes and things like that. See the wiki for more information on that subject (http://wiki.apache.org/xindice/XindiceFAQ/AttributeValue)
 
Good luck.
 
Jelle
 
----- Original Message -----
From: Jason Kim
Sent: Wednesday, May 19, 2004 1:24 AM
Subject: XPath Query, HELP

Hi

 

I am a newbie to both xindice and xpath.

 

I have added following document to collection /db/description and tried to test xpath with following queries

 - xindice xpath –c /db/description –q /Mpeg7

 - xindice xpath –c /db/description –q /Mpeg7/Description

 - xindice xpath –c /db/description –q //Label

- xindice xpath –c /db/description –q /*/*

 

 

However only the last query returns result and the other return nothing.

Can someone help me fix my xml doc or my xpath query please ?

 

 

<?xml version="1.0" encoding="iso-8859-1"?>

<Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001"

xsi:schemaLocation="urn:mpeg:mpeg7:schema:2001 Mpeg7-2001.xsd">

            <Description>

                        <Semantics>

                                    <Label>

                                                <Name> Running </Name>

                                    </Label>

                                    <SemanticBase xsi:type="AgentObjectType" id="AOa">

                                                <Label>

                                                            <Name> Person A </Name>

                                                </Label>

                                    </SemanticBase>

                                    <SemanticBase xsi:type="EventType" id="run-event">

                                                <Label>

                                                            <Name> Running </Name>

                                                </Label>

                                                <Relation type="urn:mpeg:mpeg7:cs:SemanticRelationCS:2001:timeOf" target="#ST1"/>

                                                <Definition>

                                                            <FreeTextAnnotation>

                                                               Moving at a fast speed

                                                            </FreeTextAnnotation>

                                                </Definition>

                                    </SemanticBase>

                                    <SemanticBase xsi:type="SemanticTimeType" id="ST1">

                                                <Label>

                                                            <Name>

                                                                        12/11/2001 at 2:13pm

                                                            </Name>

                                                </Label>

                                                <Time>

                                                            <TimePoint>2001-11-12T14:13:00</TimePoint>

                                                            <Duration>PT1M</Duration>

                                                </Time>

                                    </SemanticBase>

                                    <MediaOccurrence>

                                                <MediaLocator>

                                                            <MediaUri>

                                                                        http://129.94.135.174/demo.avi

                                                            </MediaUri>

                                                </MediaLocator>

                                    </MediaOccurrence>

                        </Semantics>

            </Description>

</Mpeg7>

Reply via email to