You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by ti...@apache.org on 2010/06/06 22:07:53 UTC
svn commit: r951949 -
/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/nodes/DocumentConstructorIterator.java
Author: tillw
Date: Sun Jun 6 20:07:53 2010
New Revision: 951949
URL: http://svn.apache.org/viewvc?rev=951949&view=rev
Log:
- added support for more than one item in the content sequence
Modified:
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/nodes/DocumentConstructorIterator.java
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/nodes/DocumentConstructorIterator.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/nodes/DocumentConstructorIterator.java?rev=951949&r1=951948&r2=951949&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/nodes/DocumentConstructorIterator.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/nodes/DocumentConstructorIterator.java Sun Jun 6 20:07:53 2010
@@ -1,28 +1,29 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.vxquery.runtime.nodes;
import org.apache.vxquery.datamodel.NodeConstructingEventAcceptor;
import org.apache.vxquery.datamodel.NodeFactory;
import org.apache.vxquery.datamodel.XDMItem;
+import org.apache.vxquery.datamodel.XDMSequence;
+import org.apache.vxquery.datamodel.XDMValue;
import org.apache.vxquery.exceptions.SystemException;
import org.apache.vxquery.runtime.CallStackFrame;
import org.apache.vxquery.runtime.RegisterAllocator;
import org.apache.vxquery.runtime.base.AbstractEagerlyEvaluatedIterator;
+import org.apache.vxquery.runtime.base.CloseableIterator;
import org.apache.vxquery.runtime.base.RuntimeIterator;
public class DocumentConstructorIterator extends AbstractEagerlyEvaluatedIterator {
@@ -39,8 +40,20 @@ public class DocumentConstructorIterator
NodeConstructingEventAcceptor dc = nf.createDocumentConstructor();
dc.open();
dc.startDocument();
- XDMItem item = (XDMItem) ci.evaluateEagerly(frame);
- dc.item(item);
+ XDMValue xdmv = (XDMValue) ci.evaluateEagerly(frame);
+ if (xdmv != null) {
+ if (xdmv.getDMOKind().isItem()) {
+ dc.item((XDMItem) xdmv);
+ } else {
+ XDMSequence xdms = (XDMSequence) xdmv;
+ CloseableIterator iter = xdms.createItemIterator();
+ XDMItem xdmi;
+ while ((xdmi = (XDMItem) iter.next()) != null) {
+ dc.item(xdmi);
+ }
+ iter.close();
+ }
+ }
dc.endDocument();
dc.close();
return dc.getConstructedNode();