org.jaxen.UnsupportedAxisException Java Examples

The following examples show how to use org.jaxen.UnsupportedAxisException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DocumentNavigator.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public Iterator getChildAxisIterator(Object contextNode, String localName, String namespacePrefix, String namespaceURI) throws UnsupportedAxisException
{
    // decode the localname
    localName = ISO9075.decode(localName);
    
    // MNT-10730
    if (localName != null && (localName.equalsIgnoreCase("true") || localName.equalsIgnoreCase("false")))
    {
        return Collections.singletonList(new Boolean(Boolean.parseBoolean(localName))).iterator();
    }
    
    ChildAssociationRef assocRef = (ChildAssociationRef) contextNode;
    NodeRef childRef = assocRef.getChildRef();
    QName qName = QName.createQName(namespaceURI, localName);
    List<? extends ChildAssociationRef> list = null;
    list = nodeService.getChildAssocs(childRef, RegexQNamePattern.MATCH_ALL, qName);
    // done
    return list.iterator();
}
 
Example #2
Source File: DocumentNavigatorTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void testGetChildAxisIterator() throws UnsupportedAxisException
{
    try
    {
        // Check true
        DocumentNavigator docNav = new DocumentNavigator(null, null, null, null, false, false);
        Iterator nodeIter = docNav.getChildAxisIterator(null, "true", "", null);
        assertNotNull(nodeIter);
        boolean value = (Boolean) nodeIter.next();
        assertTrue("The true value should be returned. See MNT-10730", value);

        // Check false
        nodeIter = docNav.getChildAxisIterator(null, "false", "", null);
        assertNotNull(nodeIter);
        value = (Boolean) nodeIter.next();
        assertFalse("The false value should be returned. See MNT-10730", value);
    }
    catch (NullPointerException exp)
    {
        fail("The boolean value should be returned. See MNT-10730");
    }
}
 
Example #3
Source File: DocumentNavigator.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Iterator getChildAxisIterator(Object o) throws UnsupportedAxisException
{
    // Iterator of ChildAxisRef
    ChildAssociationRef assocRef = (ChildAssociationRef) o;
    NodeRef childRef = assocRef.getChildRef();
    List<ChildAssociationRef> list;
    list = nodeService.getChildAssocs(childRef);
    return list.iterator();
}
 
Example #4
Source File: DocumentNavigator.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Iterator getNamespaceAxisIterator(Object o) throws UnsupportedAxisException
{
    // Iterator of Namespace
    ArrayList<Namespace> namespaces = new ArrayList<Namespace>();
    for (String prefix : nspr.getPrefixes())
    {
        String uri = nspr.getNamespaceURI(prefix);
        Namespace ns = new Namespace(prefix, uri);
        namespaces.add(ns);
    }
    return namespaces.iterator();
}
 
Example #5
Source File: DocumentNavigator.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Iterator getParentAxisIterator(Object o) throws UnsupportedAxisException
{
    ArrayList<ChildAssociationRef> parents = new ArrayList<ChildAssociationRef>(1);
    // Iterator of ??
    if (o instanceof ChildAssociationRef)
    {
        ChildAssociationRef contextRef = (ChildAssociationRef) o;
        if (contextRef.getParentRef() != null)
        {
            if (followAllParentLinks)
            {
                for (ChildAssociationRef car : nodeService.getParentAssocs(contextRef.getChildRef()))
                {
                    parents.add(nodeService.getPrimaryParent(car.getParentRef()));
                }
            }
            else
            {
                parents.add(nodeService.getPrimaryParent(contextRef.getParentRef()));
            }
        }
    }
    if (o instanceof Property)
    {
        Property p = (Property) o;
        parents.add(nodeService.getPrimaryParent(p.parent));
    }
    return parents.iterator();
}
 
Example #6
Source File: DocumentNavigator.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @see #EXCEPTION_NOT_SUPPORTED always thrown
 */
@Override
public Iterator getFollowingSiblingAxisIterator(Object arg0) throws UnsupportedAxisException
{
    throw EXCEPTION_NOT_SUPPORTED;
}
 
Example #7
Source File: DocumentNavigator.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @see #EXCEPTION_NOT_SUPPORTED always thrown
 */
@Override
public Iterator getFollowingAxisIterator(Object arg0) throws UnsupportedAxisException
{
    throw EXCEPTION_NOT_SUPPORTED;
}
 
Example #8
Source File: DocumentNavigator.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @see #EXCEPTION_NOT_SUPPORTED always thrown
 */
@Override
public Iterator getPrecedingAxisIterator(Object arg0) throws UnsupportedAxisException
{
    throw EXCEPTION_NOT_SUPPORTED;
}
 
Example #9
Source File: DocumentNavigator.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * @see #EXCEPTION_NOT_SUPPORTED always thrown
 */
@Override
public Iterator getPrecedingSiblingAxisIterator(Object arg0) throws UnsupportedAxisException
{
    throw EXCEPTION_NOT_SUPPORTED;
}
 
Example #10
Source File: ParseNodeNavigator.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public Iterator<?> getParentAxisIterator(final Object contextNode) throws UnsupportedAxisException
{
	if (isAttribute(contextNode))
	{
		throw new UnsupportedAxisException("Need to add an iterator that supports attributes"); //$NON-NLS-1$
	}
	else
	{
		return new Iterator<Object>()
		{
			IParseNode next;

			{
				if (contextNode != null)
				{
					if (isAttribute(contextNode))
					{
						next = ((IParseNodeAttribute) contextNode).getParent();
					}
					else if (isElement(contextNode))
					{
						next = ((IParseNode) contextNode).getParent();
					}
				}
			}

			public boolean hasNext()
			{
				return next != null;
			}

			public Object next()
			{
				Object result = next;

				next = next.getParent();

				return result;
			}

			public void remove()
			{
				// do nothing
			}
		};
	}
}
 
Example #11
Source File: NormalizedNodeNavigator.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Iterator<NormalizedNodeContext> getAncestorAxisIterator(final Object contextNode)
        throws UnsupportedAxisException {
    final NormalizedNodeContext parent = cast(contextNode).getParent();
    return parent == null ? null : new NormalizedNodeContextIterator(parent);
}
 
Example #12
Source File: NormalizedNodeNavigator.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Iterator<NormalizedNodeContext> getSelfAxisIterator(final Object contextNode)
        throws UnsupportedAxisException {
    return Iterators.singletonIterator(cast(contextNode));
}
 
Example #13
Source File: NormalizedNodeNavigator.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Iterator<NormalizedNodeContext> getAncestorOrSelfAxisIterator(final Object contextNode)
        throws UnsupportedAxisException {
    return new NormalizedNodeContextIterator(cast(contextNode));
}
 
Example #14
Source File: NormalizedNodeNavigator.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public NormalizedNodeContext getParentNode(final Object contextNode) throws UnsupportedAxisException {
    return cast(contextNode).getParent();
}