public void endContentModel(String elementName, short contentModelType) throws SAXException { assert modelGroups.size()==1; Term term = modelGroups.pop().wrapUp(); Element e = getOrCreateElement(elementName); e.define( contentModelType, term, copyLocator() ); }
public void attributeDecl(String elementName, String attributeName, String attributeType, String[] enumeration, short attributeUse, String defaultValue) throws SAXException { getOrCreateElement(elementName).attributes.add( createAttribute(elementName, attributeName, attributeType, enumeration, attributeUse, defaultValue) ); }
/** * Parses a DTD file into an annotated grammar. * * @param source * DTD file * @param bindFile * External binding file. */ private Model loadDTD( InputSource source, InputSource bindFile) { // parse the schema as a DTD. return TDTDReader.parse( source, bindFile, errorReceiver, opt); }
public void endDTD() throws SAXException { // bind them all. // we need to know how elements are referencing each other before we do this, // so this can be only done at the endDTD method for( Element e : elements.values() ) e.bind(); // if there was an error by now, just abort. if (errorReceiver.hadError()) return; processInterfaceDeclarations(); // check XJC extensions and realize them model.serialVersionUID = bindInfo.getSerialVersionUID(); if(model.serialVersionUID!=null) model.serializable=true; model.rootClass = bindInfo.getSuperClass(); model.rootInterface = bindInfo.getSuperInterface(); // TODO: do we need to reimplement them? // // performs annotation // Annotator.annotate(model, this); // FieldCollisionChecker.check( model, this ); processConstructorDeclarations(); }
bindInfo.getTargetPackage(), decl.name(), copyLocator() ); decls.put(decl,intf); fromName.put(decl.name(),new InterfaceAcceptor() { error(decl.getSourceLocation(), Messages.ERR_BINDINFO_NON_EXISTENT_INTERFACE_MEMBER, member);
/** * Define its content model. */ void define(short contentModelType, Term contentModel, Locator locator) { assert this.contentModel==null; // may not be called twice this.contentModelType = contentModelType; this.contentModel = contentModel; this.locator = locator; contentModel.normalize(normalizedBlocks,false); for( Block b : normalizedBlocks ) { if(b.isRepeated || b.elements.size()>1) { for( Element e : b.elements ) { owner.getOrCreateElement(e.name).mustBeClass = true; } } } }
private CClassInfo createDefaultClass() { String className = owner.model.getNameConverter().toClassName(name); QName tagName = new QName("",name); return new CClassInfo(owner.model,owner.getTargetPackage(),className,locator,null,tagName,null,null/*TODO*/); }
/** * Creates constructor declarations as specified in the * binding information. * * <p> * Also checks that the binding file does not contain * declarations for non-existent elements. */ private void processConstructorDeclarations() { for( BIElement decl: bindInfo.elements() ) { Element e = elements.get(decl.name()); if(e==null) { error(decl.getSourceLocation(), Messages.ERR_BINDINFO_NON_EXISTENT_ELEMENT_DECLARATION,decl.name()); continue; // continue to process next declaration } if(!decl.isClass()) // only element-class declaration has constructor definitions continue; decl.declareConstructors(e.getClassInfo()); } }
protected CPropertyInfo createAttribute( String elementName, String attributeName, String attributeType, String[] enums, short attributeUse, String defaultValue ) throws SAXException { boolean required = attributeUse==USE_REQUIRED; // get the attribute-property declaration BIElement edecl = bindInfo.element(elementName); BIAttribute decl=null; if(edecl!=null) decl=edecl.attribute(attributeName); String propName; if(decl==null) propName = model.getNameConverter().toPropertyName(attributeName); else propName = decl.getPropertyName(); QName qname = new QName("",attributeName); // if no declaration is specified, just wrap it by // a FieldItem and let the normalizer handle its content. TypeUse use; if(decl!=null && decl.getConversion()!=null) use = decl.getConversion().getTransducer(); else use = builtinConversions.get(attributeType); CPropertyInfo r = new CAttributePropertyInfo( propName, null,null/*TODO*/, copyLocator(), qname, use, null, required ); if(defaultValue!=null) r.defaultValue = CDefaultValue.create( use, new XmlString(defaultValue) ); return r; }
Ring.add(ErrorReceiver.class,ef); TDTDReader reader = new TDTDReader( ef, opts, bindingInfo);
public void endDTD() throws SAXException { // bind them all. // we need to know how elements are referencing each other before we do this, // so this can be only done at the endDTD method for( Element e : elements.values() ) e.bind(); // if there was an error by now, just abort. if (errorReceiver.hadError()) return; processInterfaceDeclarations(); // check XJC extensions and realize them model.serialVersionUID = bindInfo.getSerialVersionUID(); if(model.serialVersionUID!=null) model.serializable=true; model.rootClass = bindInfo.getSuperClass(); model.rootInterface = bindInfo.getSuperInterface(); // TODO: do we need to reimplement them? // // performs annotation // Annotator.annotate(model, this); // FieldCollisionChecker.check( model, this ); processConstructorDeclarations(); }
bindInfo.getTargetPackage(), decl.name(), copyLocator() ); decls.put(decl,intf); fromName.put(decl.name(),new InterfaceAcceptor() { error(decl.getSourceLocation(), Messages.ERR_BINDINFO_NON_EXISTENT_INTERFACE_MEMBER, member);
/** * Define its content model. */ void define(short contentModelType, Term contentModel, Locator locator) { assert this.contentModel==null; // may not be called twice this.contentModelType = contentModelType; this.contentModel = contentModel; this.locator = locator; contentModel.normalize(normalizedBlocks,false); for( Block b : normalizedBlocks ) { if(b.isRepeated || b.elements.size()>1) { for( Element e : b.elements ) { owner.getOrCreateElement(e.name).mustBeClass = true; } } } }
private CClassInfo createDefaultClass() { String className = owner.model.getNameConverter().toClassName(name); QName tagName = new QName("",name); return new CClassInfo(owner.model,owner.getTargetPackage(),className,locator,null,tagName,null,null/*TODO*/); }
/** * Creates constructor declarations as specified in the * binding information. * * <p> * Also checks that the binding file does not contain * declarations for non-existent elements. */ private void processConstructorDeclarations() { for( BIElement decl: bindInfo.elements() ) { Element e = elements.get(decl.name()); if(e==null) { error(decl.getSourceLocation(), Messages.ERR_BINDINFO_NON_EXISTENT_ELEMENT_DECLARATION,decl.name()); continue; // continue to process next declaration } if(!decl.isClass()) // only element-class declaration has constructor definitions continue; decl.declareConstructors(e.getClassInfo()); } }
protected CPropertyInfo createAttribute( String elementName, String attributeName, String attributeType, String[] enums, short attributeUse, String defaultValue ) throws SAXException { boolean required = attributeUse==USE_REQUIRED; // get the attribute-property declaration BIElement edecl = bindInfo.element(elementName); BIAttribute decl=null; if(edecl!=null) decl=edecl.attribute(attributeName); String propName; if(decl==null) propName = model.getNameConverter().toPropertyName(attributeName); else propName = decl.getPropertyName(); QName qname = new QName("",attributeName); // if no declaration is specified, just wrap it by // a FieldItem and let the normalizer handle its content. TypeUse use; if(decl!=null && decl.getConversion()!=null) use = decl.getConversion().getTransducer(); else use = builtinConversions.get(attributeType); CPropertyInfo r = new CAttributePropertyInfo( propName, null,null/*TODO*/, copyLocator(), qname, use, null, required ); if(defaultValue!=null) r.defaultValue = CDefaultValue.create( use, new XmlString(defaultValue) ); return r; }
Ring.add(ErrorReceiver.class,ef); TDTDReader reader = new TDTDReader( ef, opts, bindingInfo);
public void endContentModel(String elementName, short contentModelType) throws SAXException { assert modelGroups.size()==1; Term term = modelGroups.pop().wrapUp(); Element e = getOrCreateElement(elementName); e.define( contentModelType, term, copyLocator() ); }
public void attributeDecl(String elementName, String attributeName, String attributeType, String[] enumeration, short attributeUse, String defaultValue) throws SAXException { getOrCreateElement(elementName).attributes.add( createAttribute(elementName, attributeName, attributeType, enumeration, attributeUse, defaultValue) ); }
public void endDTD() throws SAXException { // bind them all. // we need to know how elements are referencing each other before we do this, // so this can be only done at the endDTD method for( Element e : elements.values() ) e.bind(); // if there was an error by now, just abort. if (errorReceiver.hadError()) return; processInterfaceDeclarations(); // check XJC extensions and realize them model.serialVersionUID = bindInfo.getSerialVersionUID(); if(model.serialVersionUID!=null) model.serializable=true; model.rootClass = bindInfo.getSuperClass(); model.rootInterface = bindInfo.getSuperInterface(); // TODO: do we need to reimplement them? // // performs annotation // Annotator.annotate(model, this); // FieldCollisionChecker.check( model, this ); processConstructorDeclarations(); }