private static String getStartingNodeDescription(SchemaType type) { String s = type.getDescription(); if (s.startsWith("of element")) { return "a valid element named" + s.substring("of element".length()); } else if (s.startsWith("of attribute")) { return "a valid attribute named" + s.substring("of attribute".length()); } else { return "a node with " + (type.isSimpleType() ? "simple" : "complex") + " type " + s; } }
private static String getStartingNodeDescription(SchemaType type) { String s = type.getDescription(); if (s.startsWith("of element")) { return "a valid element named" + s.substring("of element".length()); } else if (s.startsWith("of attribute")) { return "a valid attribute named" + s.substring("of attribute".length()); } else { return "a node with " + (type.isSimpleType() ? "simple" : "complex") + " type " + s; } }
/** * Get the content type allowed by this NodeTest (that is, the type annotation of the matched nodes). * Return AnyType if there are no restrictions. The default implementation returns AnyType. */ public SchemaType getContentType() { SchemaType type1 = nodetest1.getContentType(); SchemaType type2 = nodetest2.getContentType(); if (type1.isSameType(type2)) { return type1; } if (operator == Token.INTERSECT) { if (type2 instanceof AnyType || (type2 instanceof AnySimpleType && type1.isSimpleType())) { return type1; } if (type1 instanceof AnyType || (type1 instanceof AnySimpleType && type2.isSimpleType())) { return type2; } } return AnyType.getInstance(); }
/** * Get the content type allowed by this NodeTest (that is, the type annotation of the matched nodes). * Return AnyType if there are no restrictions. The default implementation returns AnyType. */ public SchemaType getContentType() { SchemaType type1 = nodetest1.getContentType(); SchemaType type2 = nodetest2.getContentType(); if (type1.isSameType(type2)) { return type1; } if (operator == Token.INTERSECT) { if (type2 instanceof AnyType || (type2 instanceof AnySimpleType && type1.isSimpleType())) { return type1; } if (type1 instanceof AnyType || (type1 instanceof AnySimpleType && type2.isSimpleType())) { return type2; } } return AnyType.getInstance(); }
public void startElement(NodeName elemName, SchemaType type, Location location, int properties) throws XPathException { // System.err.println("startElement " + nameCode); nextReceiver.startElement(elemName, type, location, properties); byte preserveParent = stripStack[top]; byte preserve = (byte) (preserveParent & (PRESERVE_PARENT | ASSERTIONS_EXIST)); int elementStrip = isSpacePreserving(elemName, type); if (elementStrip == ALWAYS_PRESERVE) { preserve |= ALWAYS_PRESERVE; } else if (elementStrip == ALWAYS_STRIP) { preserve |= ALWAYS_STRIP; } if (type != Untyped.getInstance()) { if (preserve == 0) { // if the element has simple content, whitespace stripping is disabled if (type.isSimpleType() || ((ComplexType) type).isSimpleContent()) { preserve |= SIMPLE_CONTENT; } } if (type instanceof ComplexType && ((ComplexType) type).hasAssertions()) { preserve |= ASSERTIONS_EXIST; } } // put "preserve" value on top of stack top++; if (top >= stripStack.length) { stripStack = Arrays.copyOf(stripStack, top * 2); } stripStack[top] = preserve; }
public void startElement(NodeName elemName, SchemaType type, Location location, int properties) throws XPathException { // System.err.println("startElement " + nameCode); nextReceiver.startElement(elemName, type, location, properties); byte preserveParent = stripStack[top]; byte preserve = (byte) (preserveParent & (PRESERVE_PARENT | ASSERTIONS_EXIST)); int elementStrip = isSpacePreserving(elemName, type); if (elementStrip == ALWAYS_PRESERVE) { preserve |= ALWAYS_PRESERVE; } else if (elementStrip == ALWAYS_STRIP) { preserve |= ALWAYS_STRIP; } if (type != Untyped.getInstance()) { if (preserve == 0) { // if the element has simple content, whitespace stripping is disabled if (type.isSimpleType() || ((ComplexType) type).isSimpleContent()) { preserve |= SIMPLE_CONTENT; } } if (type instanceof ComplexType && ((ComplexType) type).hasAssertions()) { preserve |= ASSERTIONS_EXIST; } } // put "preserve" value on top of stack top++; if (top >= stripStack.length) { stripStack = Arrays.copyOf(stripStack, top * 2); } stripStack[top] = preserve; }
public void startElement (int nameCode, int typeCode, int locationId, int properties) throws XPathException { // System.err.println("startElement " + nameCode); nextReceiver.startElement(nameCode, typeCode, locationId, properties); byte preserveParent = stripStack[top]; byte preserve = (byte)(preserveParent & PRESERVE_PARENT); byte elementStrip = isSpacePreserving(nameCode); if (elementStrip == ALWAYS_PRESERVE) { preserve |= ALWAYS_PRESERVE; } else if (elementStrip == ALWAYS_STRIP) { preserve |= ALWAYS_STRIP; } if (preserve == 0 && typeCode != -1 && typeCode != StandardNames.XS_UNTYPED) { // if the element has simple content, whitespace stripping is disabled SchemaType type = getConfiguration().getSchemaType(typeCode); if (type.isSimpleType() || ((ComplexType)type).isSimpleContent()) { preserve |= CANNOT_STRIP; } } // put "preserve" value on top of stack top++; if (top >= stripStack.length) { byte[] newStack = new byte[top*2]; System.arraycopy(stripStack, 0, newStack, 0, top); stripStack = newStack; } stripStack[top] = preserve; }
public void startElement (int nameCode, int typeCode, int locationId, int properties) throws XPathException { // System.err.println("startElement " + nameCode); nextReceiver.startElement(nameCode, typeCode, locationId, properties); byte preserveParent = stripStack[top]; byte preserve = (byte)(preserveParent & PRESERVE_PARENT); byte elementStrip = isSpacePreserving(nameCode); if (elementStrip == ALWAYS_PRESERVE) { preserve |= ALWAYS_PRESERVE; } else if (elementStrip == ALWAYS_STRIP) { preserve |= ALWAYS_STRIP; } if (preserve == 0 && typeCode != -1 && typeCode != StandardNames.XS_UNTYPED) { // if the element has simple content, whitespace stripping is disabled SchemaType type = getConfiguration().getSchemaType(typeCode); if (type.isSimpleType() || ((ComplexType)type).isSimpleContent()) { preserve |= CANNOT_STRIP; } } // put "preserve" value on top of stack top++; if (top >= stripStack.length) { byte[] newStack = new byte[top*2]; System.arraycopy(stripStack, 0, newStack, 0, top); stripStack = newStack; } stripStack[top] = preserve; }
public void startElement (int nameCode, int typeCode, int locationId, int properties) throws XPathException { // System.err.println("startElement " + nameCode); nextReceiver.startElement(nameCode, typeCode, locationId, properties); byte preserveParent = stripStack[top]; byte preserve = (byte)(preserveParent & PRESERVE_PARENT); byte elementStrip = isSpacePreserving(nameCode); if (elementStrip == ALWAYS_PRESERVE) { preserve |= ALWAYS_PRESERVE; } else if (elementStrip == ALWAYS_STRIP) { preserve |= ALWAYS_STRIP; } if (preserve == 0 && typeCode != -1 && typeCode != StandardNames.XS_UNTYPED) { // if the element has simple content, whitespace stripping is disabled SchemaType type = getConfiguration().getSchemaType(typeCode); if (type.isSimpleType() || ((ComplexType)type).isSimpleContent()) { preserve |= CANNOT_STRIP; } } // put "preserve" value on top of stack top++; if (top >= stripStack.length) { byte[] newStack = new byte[top*2]; System.arraycopy(stripStack, 0, newStack, 0, top); stripStack = newStack; } stripStack[top] = preserve; }
/** * Simplify type so that hierarchy comparison could be accurate. */ private ItemType simplify(ItemType it) { TypeHierarchy th = processor.getUnderlyingConfiguration().getTypeHierarchy(); if (it instanceof CombinedNodeTest) { CombinedNodeTest n = (CombinedNodeTest) it; __log.debug(n.getComponentNodeTests()); return simplify(n.getComponentNodeTests()[1]); } else if (it instanceof NodeTest) { NodeTest n = (NodeTest) it; __log.debug(n); SchemaType t = n.getContentType(); if (t.isSimpleType() || t.equals(AnyType.getInstance())) { AtomicType at = it.getAtomizedItemType(); while (!at.isBuiltInType()) at = at.getSuperType(th).getAtomizedItemType(); return at; } else if (t.isComplexType()) { return n; } else { return AnyItemType.getInstance(); } } else { if (it == null) return null; else return it.getAtomizedItemType(); } }
if (type.isSimpleType() || ((ComplexType) type).isSimpleContent()) { return true;
if (type.isSimpleType() || ((ComplexType) type).isSimpleContent()) { return true;
compileError("Unknown attribute type " + typeAtt, "XTSE1520"); } else { if (type.isSimpleType()) { schemaType = (SimpleType) type; } else {
compileError("Unknown attribute type " + typeAtt, "XTSE1520"); } else { if (type.isSimpleType()) { schemaType = (SimpleType) type; } else {
compileError("Unknown attribute type " + typeAtt, "XTSE1520"); } else { if (type.isSimpleType()) { schemaType = (SimpleType)type; } else {
compileError("Unknown attribute type " + typeAtt, "XTSE1520"); } else { if (type.isSimpleType()) { schemaType = (SimpleType)type; } else {
compileError("Unknown attribute type " + typeAtt, "XTSE1520"); } else { if (type.isSimpleType()) { schemaType = (SimpleType)type; } else {
if (schemaType.isSimpleType()) { if (((SimpleType) schemaType).isNamespaceSensitive()) { XPathException err = new XPathException("Cannot create a parentless attribute whose " +
if (schemaType.isSimpleType()) { if (((SimpleType) schemaType).isNamespaceSensitive()) { XPathException err = new XPathException("Cannot create a parentless attribute whose " +
final boolean isSimple1 = type1.isSimpleType() || ((ComplexType)type1).isSimpleContent(); final boolean isSimple2 = type2.isSimpleType() || ((ComplexType)type2).isSimpleContent(); if (isSimple1 != isSimple2) { explain(config, "one element has a simple type, the other does not", flags);