/** * accepts a name if it is not accepted by the child name class. */ public boolean accepts( String namespaceURI, String localName ) { return !child.accepts(namespaceURI,localName); }
/** * Computes the "complete attribute wildcard" */ private AttributeWildcard calcCompleteWildcard( AttributeWildcard local, Set s ) { final AttributeWildcard[] children = (AttributeWildcard[])s.toArray(new AttributeWildcard[s.size()]); // 1st step is to compute the complete wildcard. if( children.length==0 ) return local; // assert(children.length>0) // compute the intersection of wildcard. NameClass target = children[0].getName(); for( int i=1; i<children.length; i++ ) target = NameClass.intersection(target,children[i].getName()); if( local!=null ) return new AttributeWildcard( NameClass.intersection(local.getName(),target), local.getProcessMode() ); else return new AttributeWildcard( target, children[0].getProcessMode() ); }
private AttributeWildcard calcComplexTypeWildcard( AttributeWildcard complete, AttributeWildcard base ) { if(base!=null) { if(complete==null) return base; else return new AttributeWildcard( NameClass.union( complete.getName(), base.getName() ), complete.getProcessMode() ); } else { // the spec does not have a description for this case. // this is my guess. return complete; } }
protected void onElementFound( ElementExp elem ) { // root element if( namespaces.includes(elem.getNameClass()) ) { // add this element this.exp = pool.createChoice( this.exp, elem ); } }
/** * Computes the "complete attribute wildcard" */ private AttributeWildcard calcCompleteWildcard( AttributeWildcard local, Set s ) { final AttributeWildcard[] children = (AttributeWildcard[])s.toArray(new AttributeWildcard[s.size()]); // 1st step is to compute the complete wildcard. if( children.length==0 ) return local; // assert(children.length>0) // compute the intersection of wildcard. NameClass target = children[0].getName(); for( int i=1; i<children.length; i++ ) target = NameClass.intersection(target,children[i].getName()); if( local!=null ) return new AttributeWildcard( NameClass.intersection(local.getName(),target), local.getProcessMode() ); else return new AttributeWildcard( target, children[0].getProcessMode() ); }
private AttributeWildcard calcComplexTypeWildcard( AttributeWildcard complete, AttributeWildcard base ) { if(base!=null) { if(complete==null) return base; else return new AttributeWildcard( NameClass.union( complete.getName(), base.getName() ), complete.getProcessMode() ); } else { // the spec does not have a description for this case. // this is my guess. return complete; } }
protected void onAttribute( String namespaceURI, String localName, String value, Datatype type ) throws SAXException { // attribute step is not tested when the parent element doesn't match // the parent XPath expression. if( !elementMatched ) return; if( path.attributeStep.accepts(namespaceURI,localName) ) // report to the parent PathMatcher that a match was found matchFound = true; // keep the elementMatched flag as-is. }
/** * Computes the "complete attribute wildcard" */ private AttributeWildcard calcCompleteWildcard( AttributeWildcard local, Set s ) { final AttributeWildcard[] children = (AttributeWildcard[])s.toArray(new AttributeWildcard[s.size()]); // 1st step is to compute the complete wildcard. if( children.length==0 ) return local; // assert(children.length>0) // compute the intersection of wildcard. NameClass target = children[0].getName(); for( int i=1; i<children.length; i++ ) target = NameClass.intersection(target,children[i].getName()); if( local!=null ) return new AttributeWildcard( NameClass.intersection(local.getName(),target), local.getProcessMode() ); else return new AttributeWildcard( target, children[0].getProcessMode() ); }
private AttributeWildcard calcComplexTypeWildcard( AttributeWildcard complete, AttributeWildcard base ) { if(base!=null) { if(complete==null) return base; else return new AttributeWildcard( NameClass.union( complete.getName(), base.getName() ), complete.getProcessMode() ); } else { // the spec does not have a description for this case. // this is my guess. return complete; } }
public Object onNot( NotNameClass nc ) { nc.child.visit(this); return null; } public Object onDifference( DifferenceNameClass nc ) {
/** * Computes the "complete attribute wildcard" */ private AttributeWildcard calcCompleteWildcard( AttributeWildcard local, Set<AttributeWildcard> s ) { final AttributeWildcard[] children = (AttributeWildcard[])s.toArray(new AttributeWildcard[s.size()]); // 1st step is to compute the complete wildcard. if( children.length==0 ) return local; // assert(children.length>0) // compute the intersection of wildcard. NameClass target = children[0].getName(); for( int i=1; i<children.length; i++ ) target = NameClass.intersection(target,children[i].getName()); if( local!=null ) return new AttributeWildcard( NameClass.intersection(local.getName(),target), local.getProcessMode() ); else return new AttributeWildcard( target, children[0].getProcessMode() ); }
private AttributeWildcard calcComplexTypeWildcard( AttributeWildcard complete, AttributeWildcard base ) { if(base!=null) { if(complete==null) return base; else return new AttributeWildcard( NameClass.union( complete.getName(), base.getName() ), complete.getProcessMode() ); } else { // the spec does not have a description for this case. // this is my guess. return complete; } }
protected void onAttribute( String namespaceURI, String localName, String value, Datatype type ) throws SAXException { // attribute step is not tested when the parent element doesn't match // the parent XPath expression. if( !elementMatched ) return; if( path.attributeStep.accepts(namespaceURI,localName) ) // report to the parent PathMatcher that a match was found matchFound = true; // keep the elementMatched flag as-is. }
/** Tests two name classes to see if they collide. */ protected void check( NameClassAndExpression newExp, NameClassAndExpression oldExp ) { if(checker.check( newExp.getNameClass(), oldExp.getNameClass() )) { // two attributes/elements collide NameClass intersection = NameClass.intersection( newExp.getNameClass(), oldExp.getNameClass() ); reader.reportError( new Locator[]{ reader.getDeclaredLocationOf(errorContext), // the parent element reader.getDeclaredLocationOf(newExp), reader.getDeclaredLocationOf(oldExp)}, getErrorMessage(), new Object[]{intersection.toString()} ); } }
/** * accepts a name if it is not accepted by the child name class. */ public boolean accepts( String namespaceURI, String localName ) { return !child.accepts(namespaceURI,localName); }