⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtdgrammar.java

📁 java1.6众多例子参考
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        else if ( type.equals("ID") ) {            fSimpleType.type = XMLSimpleType.TYPE_ID;        }        else if ( type.startsWith("IDREF") ) {            fSimpleType.type = XMLSimpleType.TYPE_IDREF;            if (type.indexOf("S") > 0) {                fSimpleType.list = true;            }        }        else if (type.equals("ENTITIES")) {            fSimpleType.type = XMLSimpleType.TYPE_ENTITY;            fSimpleType.list = true;        }        else if (type.equals("ENTITY")) {            fSimpleType.type = XMLSimpleType.TYPE_ENTITY;        }        else if (type.equals("NMTOKENS")) {            fSimpleType.type = XMLSimpleType.TYPE_NMTOKEN;            fSimpleType.list = true;        }        else if (type.equals("NMTOKEN")) {            fSimpleType.type = XMLSimpleType.TYPE_NMTOKEN;        }        else if (type.startsWith("NOTATION") ) {            fSimpleType.type = XMLSimpleType.TYPE_NOTATION;        }        else if (type.startsWith("ENUMERATION") ) {            fSimpleType.type = XMLSimpleType.TYPE_ENUMERATION;        }        else {            // REVISIT: Report error message. -Ac            System.err.println("!!! unknown attribute type "+type);        }        // REVISIT: The datatype should be stored with the attribute value        //          and not special-cased in the XMLValidator. -Ac        //fSimpleType.datatypeValidator = fDatatypeValidatorFactory.createDatatypeValidator(type, null, facets, fSimpleType.list);        fQName.setValues(null, attributeName, attributeName, null);        fAttributeDecl.setValues( fQName, fSimpleType, false );        setAttributeDecl(elementIndex, fCurrentAttributeIndex, fAttributeDecl);        int chunk = fCurrentAttributeIndex >> CHUNK_SHIFT;        int index = fCurrentAttributeIndex & CHUNK_MASK;        ensureAttributeDeclCapacity(chunk);        fAttributeDeclIsExternal[chunk][index] = fReadingExternalDTD ?  1 : 0;    } // attributeDecl(String,String,String,String[],String,XMLString,XMLString, Augmentations)    /**     * An internal entity declaration.     *     * @param name The name of the entity. Parameter entity names start with     *             '%', whereas the name of a general entity is just the     *             entity name.     * @param text The value of the entity.     * @param nonNormalizedText The non-normalized value of the entity. This     *             value contains the same sequence of characters that was in     *             the internal entity declaration, without any entity     *             references expanded.     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     */    public void internalEntityDecl(String name, XMLString text,                                   XMLString nonNormalizedText,                                   Augmentations augs) throws XNIException {        int entityIndex = getEntityDeclIndex(name);        if( entityIndex == -1){            entityIndex = createEntityDecl();            boolean isPE = name.startsWith("%");            boolean inExternal = fReadingExternalDTD;            XMLEntityDecl  entityDecl = new XMLEntityDecl();            entityDecl.setValues(name,null,null, null, null,                                 text.toString(), isPE, inExternal);            setEntityDecl(entityIndex, entityDecl);        }    } // internalEntityDecl(String,XMLString,XMLString)    /**     * An external entity declaration.     *     * @param name     The name of the entity. Parameter entity names start     *                 with '%', whereas the name of a general entity is just     *                 the entity name.     * @param identifier    An object containing all location information     *                      pertinent to this external entity declaration.     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     */    public void externalEntityDecl(String name,                                   XMLResourceIdentifier identifier,                                   Augmentations augs) throws XNIException {        int entityIndex = getEntityDeclIndex(name);        if( entityIndex == -1){            entityIndex = createEntityDecl();            boolean isPE = name.startsWith("%");            boolean inExternal = fReadingExternalDTD;            XMLEntityDecl  entityDecl = new XMLEntityDecl();            entityDecl.setValues(name, identifier.getPublicId(), identifier.getLiteralSystemId(),                                identifier.getBaseSystemId(),                                null, null, isPE, inExternal);            setEntityDecl(entityIndex, entityDecl);        }    } // externalEntityDecl(String, XMLResourceIdentifier, Augmentations)    /**     * An unparsed entity declaration.     *     * @param name     The name of the entity.     * @param identifier    An object containing all location information     *                      pertinent to this entity.     * @param notation The name of the notation.     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     */    public void unparsedEntityDecl(String name, XMLResourceIdentifier identifier,                                   String notation,                                   Augmentations augs) throws XNIException {        XMLEntityDecl  entityDecl = new XMLEntityDecl();        boolean isPE = name.startsWith("%");        boolean inExternal = fReadingExternalDTD;        entityDecl.setValues(name,identifier.getPublicId(),identifier.getLiteralSystemId(),                            identifier.getBaseSystemId(), notation,                            null, isPE, inExternal);        int entityIndex = getEntityDeclIndex(name);        if (entityIndex == -1) {            entityIndex = createEntityDecl();            setEntityDecl(entityIndex, entityDecl);        }    } // unparsedEntityDecl(String,StringXMLResourceIdentifier,Augmentations)    /**     * A notation declaration     *     * @param name     The name of the notation.     * @param identifier    An object containing all location information     *                      pertinent to this notation.     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     */    public void notationDecl(String name, XMLResourceIdentifier identifier,                             Augmentations augs) throws XNIException {        XMLNotationDecl  notationDecl = new XMLNotationDecl();        notationDecl.setValues(name,identifier.getPublicId(),identifier.getLiteralSystemId(),                identifier.getBaseSystemId());        int notationIndex = getNotationDeclIndex(name);        if (notationIndex == -1) {            notationIndex = createNotationDecl();            setNotationDecl(notationIndex, notationDecl);        }    } // notationDecl(String,XMLResourceIdentifier,Augmentations)    /**     * The end of the DTD.     *     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     */    public void endDTD(Augmentations augs) throws XNIException {        fIsImmutable = true;        // make sure our description contains useful stuff...        if(fGrammarDescription.getRootName() == null) {            // we don't know what the root is; so use possibleRoots...            int chunk, index = 0;            String currName = null;            Vector elements = new Vector();            for (int i=0; i < fElementDeclCount; i++) {                chunk = i >> CHUNK_SHIFT;                index = i & CHUNK_MASK;                currName = fElementDeclName[chunk][index].rawname;                elements.addElement(currName);            }            fGrammarDescription.setPossibleRoots(elements);        }    } // endDTD()    // sets the source of this handler    public void setDTDSource(XMLDTDSource source) {        fDTDSource = source;    } // setDTDSource(XMLDTDSource)    // returns the source of this handler    public XMLDTDSource getDTDSource() {        return fDTDSource;    } // getDTDSource():  XMLDTDSource    // no-op methods    /**     * Notifies of the presence of a TextDecl line in an entity. If present,     * this method will be called immediately following the startEntity call.     * <p>     * <strong>Note:</strong> This method is only called for external     * parameter entities referenced in the DTD.     *     * @param version  The XML version, or null if not specified.     * @param encoding The IANA encoding name of the entity.     *     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     */    public void textDecl(String version, String encoding, Augmentations augs)        throws XNIException {}    /**     * A comment.     *     * @param text The text in the comment.     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by application to signal an error.     */    public void comment(XMLString text, Augmentations augs) throws XNIException {}    /**     * A processing instruction. Processing instructions consist of a     * target name and, optionally, text data. The data is only meaningful     * to the application.     * <p>     * Typically, a processing instruction's data will contain a series     * of pseudo-attributes. These pseudo-attributes follow the form of     * element attributes but are <strong>not</strong> parsed or presented     * to the application as anything other than text. The application is     * responsible for parsing the data.     *     * @param target The target.     * @param data   The data or null if none specified.     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     */    public void processingInstruction(String target, XMLString data,                                      Augmentations augs) throws XNIException {}    /**     * The start of an attribute list.     *     * @param elementName The name of the element that this attribute     *                    list is associated with.     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     */    public void startAttlist(String elementName, Augmentations augs)        throws XNIException {}    /**     * The end of an attribute list.     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     */    public void endAttlist(Augmentations augs) throws XNIException {}    /**     * The start of a conditional section.     *     * @param type The type of the conditional section. This value will     *             either be CONDITIONAL_INCLUDE or CONDITIONAL_IGNORE.     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     *     * @see XMLDTDHandler#CONDITIONAL_INCLUDE     * @see XMLDTDHandler#CONDITIONAL_IGNORE     */    public void startConditional(short type, Augmentations augs)        throws XNIException {}    /**     * Characters within an IGNORE conditional section.     *     * @param text The ignored text.     * @param augs Additional information that may include infoset     *                      augmentations.     */    public void ignoredCharacters(XMLString text, Augmentations augs)        throws XNIException {}    /**     * The end of a conditional section.     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     */    public void endConditional(Augmentations augs) throws XNIException {}    //    // XMLDTDContentModelHandler methods    //    // set content model source    public void setDTDContentModelSource(XMLDTDContentModelSource source) {        fDTDContentModelSource = source;    }    // get content model source    public XMLDTDContentModelSource getDTDContentModelSource() {        return fDTDContentModelSource;    }    /**     * The start of a content model. Depending on the type of the content     * model, specific methods may be called between the call to the     * startContentModel method and the call to the endContentModel method.     *     * @param elementName The name of the element.     * @param augs Additional information that may include infoset     *                      augmentations.     * @throws XNIException Thrown by handler to signal an error.     */    public void startContentModel(String elementName, Augmentations augs)        throws XNIException {        XMLElementDecl elementDecl = (XMLElementDecl) this.fElementDeclTab.get( elementName);        if ( elementDecl != null ) {            fElementDecl = elementDecl;        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -