You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Jaksch Stefan <s....@iti.tuwien.ac.at> on 2003/10/30 09:22:06 UTC
AW: Error with simple xpath query
I had the same Exception when I added elements that I had received before from xindice. When Itried to query that elements I had this exception. I'm not a java expert, I just used a workaround that removes the "src" and the "xindice" namespace from an element before adding it to a collection - after that I could query my elements.
I don't know if this works for you, anyway I think that you have the namespace already defined in your elements, so maybe your problem is where you add the elements to xindice.
- stefan
-----Ursprüngliche Nachricht-----
Von: Miguel Angel Urrutia Soler [mailto:urrutiasoler@yahoo.com.mx]
Gesendet: Donnerstag, 30. Oktober 2003 09:05
An: xindice-users@xml.apache.org
Betreff: Error with simple xpath query
Hello:
I have a problem, when I do the xpath query "/DataSource" at a collection that contains documents with this structure:
<DataSource ID="00ffa7c06e3979dd000000f59437d713" Name="DC2 Reverso" Description="">
<Fields>
<Field key="0cffa7c0411731c6000000f39dac0383" col="/db/com/ESH_Systems/ContingenSys/configurations/elements/XCompany">
<Fields>
<Field key="0cffa7c0411731c6000000f39b6900b8" col="/db/com/ESH_Systems/ContingenSys/configurations/elements/XCompany">
<Values>
<Value Source="6" Type="0" Pattern="" Name="COLUMN1_ESTABLECIMIENTOS_EN_QUE_RIGE_EL_PLAN" Aux="1"/>
<Value Source="6" Type="0" Pattern="" Name="COLUMN2_ESTABLECIMIENTOS_EN_QUE_RIGE_EL_PLAN" Aux="2"/>
<Value Source="6" Type="0" Pattern="" Name="COLUMN3_ESTABLECIMIENTOS_EN_QUE_RIGE_EL_PLAN" Aux="3"/>
</Values>
</Field>
<Field key="0cffa7c0411731c6000000f392645365" col="/db/com/ESH_Systems/ContingenSys/configurations/elements/XCompany">
<Values>
<Value Source="0" Type="0" Pattern="" Name="VALUE_DEL"/>
</Values>
</Field>
</Fields>
</Field>
</Fields>
</DataSource>
I receive the follow exception:
[Fatal Error] :2:17753: Attribute "http://xml.apache.org/xindice/Query" bound to namespace "http://xml.apache.org/xindice/Query" was already specified for element "DataSource".
org.xml.sax.SAXParseException: Attribute "http://xml.apache.org/xindice/Query" bound to namespace "http://xml.apache.org/xindice/Query" was already specified for element "DataSource".
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.apache.xindice.client.xmldb.xmlrpc.CollectionImpl.query(CollectionImpl.java:572)
at org.apache.xindice.client.xmldb.XindiceCollection.query(XindiceCollection.java:292)
at org.apache.xindice.client.xmldb.services.QueryService.query(QueryService.java:131)
at com.ESHSystems.ContingenSys.Data.CollectionsDBManager.getXPathQuerySAX(CollectionsDBManager.java:236)...
but just when I use the tomcat version... when use the embedded version that works fine...
the code is something like this:
//get the query service
XPathQueryService queryservice = (XPathQueryService)
col.getService(DBConstants.XINDICE_XPATHQUERYSERVICE_NAME,
DBConstants.XINDICE_XPATHQUERYSERVICE_VERSION);
//Execute query
queryservice.clearNamespaces();
ResourceSet resultset = queryservice.query(xpath);
if (resultset.getSize() > 0) {
objs = new Object[(int) resultset.getSize()];
XMLResource resource = null;
for (int i = 0; i < resultset.getSize(); i++) {
resource = (XMLResource) resultset.getResource(i);
if (resource != null) {
resource.setSAXFeature(SAXEventGenerator.SAX_NAMESPACE_PREFIXES_FEATURE, false);
resource.setSAXFeature(SAXEventGenerator.SAX_NAMESPACES_FEATURE, false);
resource.getContentAsSAX(handler);
objs[i] = handler.getUserObject();
}
}
return objs;
}
Plz If anybody knows what I missing help me.
any suggestions?