com.sun.xml.internal.rngom.nc.NameClass Java Examples

The following examples show how to use com.sun.xml.internal.rngom.nc.NameClass. 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: RELAXNGCompiler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void mapToClass(DElementPattern p) {
    NameClass nc = p.getName();
    if(nc.isOpen())
        return;   // infinite name. can't map to a class.

    Set<QName> names = nc.listNames();

    CClassInfo[] types = new CClassInfo[names.size()];
    int i=0;
    for( QName n : names ) {
        // TODO: read class names from customization
        String name = model.getNameConverter().toClassName(n.getLocalPart());

        bindQueue.put(
            types[i++] = new CClassInfo(model,pkg,name,p.getLocation(),null,n,null,null/*TODO*/),
            p.getChild() );
    }

    classes.put(p,types);
}
 
Example #2
Source File: AttributePattern.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
AttributePattern(NameClass nameClass, Pattern value, Locator loc) {
  super(false,
        EMPTY_CONTENT_TYPE,
        combineHashCode(ATTRIBUTE_HASH_CODE,
                        nameClass.hashCode(),
                        value.hashCode()));
  this.nameClass = nameClass;
  this.p = value;
  this.loc = loc;
}
 
Example #3
Source File: ElementPattern.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
Pattern expand(SchemaPatternBuilder b) {
  if (!expanded) {
    expanded = true;
    p = p.expand(b);
    if (p.isNotAllowed())
      nameClass = NameClass.NULL;
  }
  return this;
}
 
Example #4
Source File: ElementPattern.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
Pattern expand(SchemaPatternBuilder b) {
  if (!expanded) {
    expanded = true;
    p = p.expand(b);
    if (p.isNotAllowed())
      nameClass = NameClass.NULL;
  }
  return this;
}
 
Example #5
Source File: AttributePattern.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
AttributePattern(NameClass nameClass, Pattern value, Locator loc) {
  super(false,
        EMPTY_CONTENT_TYPE,
        combineHashCode(ATTRIBUTE_HASH_CODE,
                        nameClass.hashCode(),
                        value.hashCode()));
  this.nameClass = nameClass;
  this.p = value;
  this.loc = loc;
}
 
Example #6
Source File: DXMLPrinter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Void visitNsNameExcept(String ns, NameClass nc) {
    start("nsName");
    attr("ns", ns);
    start("except");
    nc.accept(this);
    end();
    end();
    return null;
}
 
Example #7
Source File: AbstractExtendedComplexTypeBuilder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a {@link NameClass} that represents all the terms in the given content type.
 * If t is not a particle, just return an empty name class.
 */
private NameClass getNameClass(XSContentType t) {
    if(t==null) return NameClass.NULL;
    XSParticle p = t.asParticle();
    if(p==null) return NameClass.NULL;
    else        return p.getTerm().apply(contentModelNameClassBuilder);
}
 
Example #8
Source File: AttributePattern.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
AttributePattern(NameClass nameClass, Pattern value, Locator loc) {
  super(false,
        EMPTY_CONTENT_TYPE,
        combineHashCode(ATTRIBUTE_HASH_CODE,
                        nameClass.hashCode(),
                        value.hashCode()));
  this.nameClass = nameClass;
  this.p = value;
  this.loc = loc;
}
 
Example #9
Source File: DXMLPrinter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Void visitAnyNameExcept(NameClass nc) {
    start("anyName");
    start("except");
    nc.accept(this);
    end();
    end();
    return null;
}
 
Example #10
Source File: AbstractExtendedComplexTypeBuilder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a {@link NameClass} that represents all the terms in the given content type.
 * If t is not a particle, just return an empty name class.
 */
private NameClass getNameClass(XSContentType t) {
    if(t==null) return NameClass.NULL;
    XSParticle p = t.asParticle();
    if(p==null) return NameClass.NULL;
    else        return p.getTerm().apply(contentModelNameClassBuilder);
}
 
Example #11
Source File: DXMLPrinter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prints XML fragment for the given name class.
 *
 * @throws XMLStreamException
 */
public void print(NameClass nc) throws XMLStreamException {
    try {
        nc.accept(ncVisitor);
    } catch (XMLWriterException e) {
        if (e.getCause() instanceof XMLStreamException) {
            throw (XMLStreamException) e.getCause();
        } else {
            throw new XMLStreamException(e);
        }
    }
}
 
Example #12
Source File: DXMLPrinter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Void visitChoice(NameClass nc1, NameClass nc2) {
    // TODO: flatten nested choices
    start("choice");
    nc1.accept(this);
    nc2.accept(this);
    end();
    return null;
}
 
Example #13
Source File: DuplicateAttributeDetector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
boolean addAttribute(NameClass nc) {
    int lim = nameClasses.size();
    for (Alternative a = alternatives; a != null; a = a.parent) {
        for (int i = a.endIndex; i < lim; i++)
            if (nc.hasOverlapWith((NameClass) nameClasses.get(i)))
                return false;
        lim = a.startIndex;
    }
    for (int i = 0; i < lim; i++)
        if (nc.hasOverlapWith((NameClass) nameClasses.get(i)))
            return false;
    nameClasses.add(nc);
    return true;
}
 
Example #14
Source File: AbstractExtendedComplexTypeBuilder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a {@link NameClass} that represents all the terms in the given content type.
 * If t is not a particle, just return an empty name class.
 */
private NameClass getNameClass(XSContentType t) {
    if(t==null) return NameClass.NULL;
    XSParticle p = t.asParticle();
    if(p==null) return NameClass.NULL;
    else        return p.getTerm().apply(contentModelNameClassBuilder);
}
 
Example #15
Source File: ElementPattern.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
Pattern expand(SchemaPatternBuilder b) {
  if (!expanded) {
    expanded = true;
    p = p.expand(b);
    if (p.isNotAllowed())
      nameClass = NameClass.NULL;
  }
  return this;
}
 
Example #16
Source File: ElementPattern.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
ElementPattern(NameClass nameClass, Pattern p, Locator loc) {
  super(false,
        ELEMENT_CONTENT_TYPE,
        combineHashCode(ELEMENT_HASH_CODE,
                        nameClass.hashCode(),
                        p.hashCode()));
  this.nameClass = nameClass;
  this.origNameClass = nameClass;
  this.p = p;
  this.loc = loc;
}
 
Example #17
Source File: DXMLPrinter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prints XML fragment for the given name class.
 *
 * @throws XMLStreamException
 */
public void print(NameClass nc) throws XMLStreamException {
    try {
        nc.accept(ncVisitor);
    } catch (XMLWriterException e) {
        if (e.getCause() instanceof XMLStreamException) {
            throw (XMLStreamException) e.getCause();
        } else {
            throw new XMLStreamException(e);
        }
    }
}
 
Example #18
Source File: DXMLPrinter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prints XML fragment for the given name class.
 *
 * @throws XMLStreamException
 */
public void print(NameClass nc) throws XMLStreamException {
    try {
        nc.accept(ncVisitor);
    } catch (XMLWriterException e) {
        if (e.getCause() instanceof XMLStreamException) {
            throw (XMLStreamException) e.getCause();
        } else {
            throw new XMLStreamException(e);
        }
    }
}
 
Example #19
Source File: WildcardNameClassBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public NameClass union(XSWildcard.Union wc) {
    NameClass nc = null;
    for (Iterator itr = wc.iterateNamespaces(); itr.hasNext();) {
        String ns = (String) itr.next();

        if(nc==null)    nc = new NsNameClass(ns);
        else
            nc = new ChoiceNameClass(nc,new NsNameClass(ns));
    }

    // there should be at least one.
    assert nc!=null;

    return nc;
}
 
Example #20
Source File: AttributePattern.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
AttributePattern(NameClass nameClass, Pattern value, Locator loc) {
  super(false,
        EMPTY_CONTENT_TYPE,
        combineHashCode(ATTRIBUTE_HASH_CODE,
                        nameClass.hashCode(),
                        value.hashCode()));
  this.nameClass = nameClass;
  this.p = value;
  this.loc = loc;
}
 
Example #21
Source File: AttributePattern.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
AttributePattern(NameClass nameClass, Pattern value, Locator loc) {
  super(false,
        EMPTY_CONTENT_TYPE,
        combineHashCode(ATTRIBUTE_HASH_CODE,
                        nameClass.hashCode(),
                        value.hashCode()));
  this.nameClass = nameClass;
  this.p = value;
  this.loc = loc;
}
 
Example #22
Source File: AbstractExtendedComplexTypeBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a {@link NameClass} that represents all the terms in the given content type.
 * If t is not a particle, just return an empty name class.
 */
private NameClass getNameClass(XSContentType t) {
    if(t==null) return NameClass.NULL;
    XSParticle p = t.asParticle();
    if(p==null) return NameClass.NULL;
    else        return p.getTerm().apply(contentModelNameClassBuilder);
}
 
Example #23
Source File: DXMLPrinter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Void visitAnyNameExcept(NameClass nc) {
    start("anyName");
    start("except");
    nc.accept(this);
    end();
    end();
    return null;
}
 
Example #24
Source File: DXMLPrinter.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Prints XML fragment for the given name class.
 *
 * @throws XMLStreamException
 */
public void print(NameClass nc) throws XMLStreamException {
    try {
        nc.accept(ncVisitor);
    } catch (XMLWriterException e) {
        if (e.getCause() instanceof XMLStreamException) {
            throw (XMLStreamException) e.getCause();
        } else {
            throw new XMLStreamException(e);
        }
    }
}
 
Example #25
Source File: WildcardNameClassBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public NameClass union(XSWildcard.Union wc) {
    NameClass nc = null;
    for (Iterator itr = wc.iterateNamespaces(); itr.hasNext();) {
        String ns = (String) itr.next();

        if(nc==null)    nc = new NsNameClass(ns);
        else
            nc = new ChoiceNameClass(nc,new NsNameClass(ns));
    }

    // there should be at least one.
    assert nc!=null;

    return nc;
}
 
Example #26
Source File: AbstractExtendedComplexTypeBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets a {@link NameClass} that represents all the terms in the given content type.
 * If t is not a particle, just return an empty name class.
 */
private NameClass getNameClass(XSContentType t) {
    if(t==null) return NameClass.NULL;
    XSParticle p = t.asParticle();
    if(p==null) return NameClass.NULL;
    else        return p.getTerm().apply(contentModelNameClassBuilder);
}
 
Example #27
Source File: WildcardNameClassBuilder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public NameClass union(XSWildcard.Union wc) {
    NameClass nc = null;
    for (Iterator itr = wc.iterateNamespaces(); itr.hasNext();) {
        String ns = (String) itr.next();

        if(nc==null)    nc = new NsNameClass(ns);
        else
            nc = new ChoiceNameClass(nc,new NsNameClass(ns));
    }

    // there should be at least one.
    assert nc!=null;

    return nc;
}
 
Example #28
Source File: AttributePattern.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
AttributePattern(NameClass nameClass, Pattern value, Locator loc) {
  super(false,
        EMPTY_CONTENT_TYPE,
        combineHashCode(ATTRIBUTE_HASH_CODE,
                        nameClass.hashCode(),
                        value.hashCode()));
  this.nameClass = nameClass;
  this.p = value;
  this.loc = loc;
}
 
Example #29
Source File: AbstractExtendedComplexTypeBuilder.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public NameClass modelGroupDecl(XSModelGroupDecl decl) {
    return modelGroup(decl.getModelGroup());
}
 
Example #30
Source File: AbstractExtendedComplexTypeBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public NameClass wildcard(XSWildcard wc) {
    return WildcardNameClassBuilder.build(wc);
}