if (locationPath.isAbsolute()) { final List<Step> steps = locationPath.getSteps(); allNodeStep.addPredicate(predicate); relativeLocationPath.addStep(allNodeStep); relativeLocationPath.addStep(steps.get(i)); final BaseXPath xpath = createXPath(relativeLocationPath.getText(), navigator); addQueryToNode(xpath, ((NameStep) step2).getLocalName()); valid = true;
List steps = locationPath.getSteps(); if ( locationPath.isAbsolute() )
private QName getChildElementStepAsQName( ValueReference ref ) { QName qName = null; Expr xpath = ref.getAsXPath(); if ( xpath instanceof LocationPath ) { LocationPath lpath = (LocationPath) xpath; if ( lpath.getSteps().size() == 1 ) { if ( lpath.getSteps().get( 0 ) instanceof NameStep ) { NameStep step = (NameStep) lpath.getSteps().get( 0 ); if ( isChildElementStepWithoutPredicateOrWithNumberPredicate( step ) ) { String prefix = step.getPrefix(); if ( prefix.isEmpty() ) { qName = new QName( step.getLocalName() ); } else { String ns = ref.getNsContext().translateNamespacePrefixToUri( prefix ); qName = new QName( ns, step.getLocalName(), prefix ); } LOG.debug( "QName: " + qName ); } } } } return qName; }
protected void addSteps(LocationPath locationPath, Iterator stepIter) { while ( stepIter.hasNext() ) { locationPath.addStep( (Step) stepIter.next() ); } }
private QName getName( ValueReference path ) { if ( path.getAsQName() != null ) { return path.getAsQName(); } Expr xpath = path.getAsXPath(); if ( xpath instanceof LocationPath ) { LocationPath lp = (LocationPath) xpath; if ( lp.getSteps().size() == 1 && !lp.isAbsolute() ) { Step step = (Step) lp.getSteps().get( 0 ); if ( step instanceof NameStep ) { return getQName( (NameStep) step ); } } } return null; }
@SuppressWarnings("unchecked") public String getElementNameWithPredicates() throws JaxenException { BaseXPath baseXPath = new BaseXPath(xPath, new DocumentNavigator()); Expr rootExpr = baseXPath.getRootExpr(); LocationPath locationPath = (LocationPath) rootExpr; List<Step> steps = locationPath.getSteps(); Step lastStep = steps.get(steps.size() - 1); return MCRNodeBuilder.simplify(lastStep.getText()); }
if (locationPath.isAbsolute()) { final List<Step> steps = locationPath.getSteps(); allNodeStep.addPredicate(predicate); relativeLocationPath.addStep(allNodeStep); relativeLocationPath.addStep(steps.get(i)); final BaseXPath xpath = createXPath(relativeLocationPath.getText(), navigator); addQueryToNode(xpath, ((NameStep) step2).getLocalName()); valid = true;
if ( xpath instanceof LocationPath ) { LocationPath lp = (LocationPath) xpath; if ( lp.getSteps().size() != 1 ) { LOG.warn( "Unhandled location path: '" + particleMapping.getPath() + "'. Only single step paths are handled." ); continue; if ( lp.isAbsolute() ) { LOG.warn( "Unhandled location path: '" + particleMapping.getPath() + "'. Only relative paths are handled." ); continue; Step step = (Step) lp.getSteps().get( 0 ); if ( !step.getPredicates().isEmpty() ) { List<?> predicates = step.getPredicates();
public static List<QName> extractQNames( XPath xpath ) { List<QName> list = new ArrayList<QName>(); try { Expr expr = new BaseXPath( xpath.getXPath(), null ).getRootExpr(); if ( expr instanceof LocationPath ) { LocationPath lp = (LocationPath) expr; for ( Object o : lp.getSteps() ) { findQName( list, (Step) o, xpath.getNamespaceContext() ); } } } catch ( JaxenException e ) { // not a proper xpath } return list; }
private Element createRootElement(String xPath) throws JaxenException { BaseXPath baseXPath = new BaseXPath(xPath, new DocumentNavigator()); LocationPath lp = (LocationPath) (baseXPath.getRootExpr()); NameStep nameStep = (NameStep) (lp.getSteps().get(0)); String prefix = nameStep.getPrefix(); Namespace ns = prefix.isEmpty() ? Namespace.NO_NAMESPACE : MCRConstants.getStandardNamespace(prefix); return new Element(nameStep.getLocalName(), ns); }
if ( !( lhs instanceof LocationPath ) || ( (LocationPath) lhs ).getSteps().size() != 1 || !( ( (LocationPath) lhs ).getSteps().get( 0 ) instanceof NameStep ) || ( (NameStep) ( (LocationPath) lhs ).getSteps().get( 0 ) ).getAxis() != ATTRIBUTE || !( (NameStep) ( (LocationPath) lhs ).getSteps().get( 0 ) ).getLocalName().equals( "name" ) ) { String msg = "Unable to map PropertyName '" + propName.getAsText() + "'. Slot steps must specify a single name predicate (../rim:Slot[@name=...]).";
for ( Object o : ( (LocationPath) path ).getSteps() ) { if ( o instanceof NameStep ) { NameStep step = (NameStep) o;
List<Step> steps = path.getSteps();
List<Step> steps = path.getSteps();
List<Step> steps = path.getSteps();
List<Step> steps = path.getSteps();
List<Step> steps = path.getSteps();
List<Step> steps = locationPath.getSteps();