Class DTDElement


  • public final class DTDElement
    extends Object
    Class that contains element definitions from DTD.

    Notes about thread-safety: this class is not thread-safe, since it does not have to be, in general case. That is, the only instances that can be shared are external subset instances, and those are used in read-only manner (with the exception of temporary arrays constructed on-demand).

    • Method Detail

      • createPlaceholder

        public static DTDElement createPlaceholder​(ReaderConfig cfg,
                                                   Location loc,
                                                   PrefixedName name)
        Method called to create a "placeholder" element definition, needed to contain attribute definitions.
      • define

        public DTDElement define​(Location loc,
                                 StructValidator val,
                                 int allowedContent)
        Method called on placeholder element, to create a real instance that has all attribute definitions placeholder had (it'll always have at least one -- otherwise no placeholder was needed).
      • addNsDefault

        public DTDAttribute addNsDefault​(InputProblemReporter rep,
                                         PrefixedName attrName,
                                         int valueType,
                                         DefaultAttrValue defValue,
                                         boolean fullyValidate)
                                  throws XMLStreamException
        Method called to add a definition of a namespace-declaration pseudo-attribute with a default value.
        Parameters:
        rep - Reporter to use to report non-fatal problems
        fullyValidate - Whether this is being invoked for actual DTD validation, or just the "typing non-validator"
        Returns:
        Attribute that acts as the placeholder, if the declaration was added; null to indicate it was a dup (there was an earlier declaration)
        Throws:
        XMLStreamException
      • getDisplayName

        public String getDisplayName()
      • getLocation

        public Location getLocation()
      • isDefined

        public boolean isDefined()
      • getAllowedContent

        public int getAllowedContent()
        Returns:
        Constant that identifies what kind of nodes are in general allowed inside this element.
      • getAllowedContentIfSpace

        public int getAllowedContentIfSpace()
        Specialized accessor used by non-validating but typing 'validator': essentially, used to figure out whether #PCDATA is allowed or not; and based on that, return one of 2 allowable text values (only space, or anything). This is the relevant subset in non-validating modes, needed to properly type resulting character events.
      • getSpecialCount

        public int getSpecialCount()
      • attrsNeedValidation

        public boolean attrsNeedValidation()
        Returns:
        True if at least one of the attributes has type other than CDATA; false if not
      • hasFixedAttrs

        public boolean hasFixedAttrs()
      • hasAttrDefaultValues

        public boolean hasAttrDefaultValues()
      • getNotationAttribute

        public DTDAttribute getNotationAttribute()
      • hasNsDefaults

        public boolean hasNsDefaults()