DTHTMLElement Class Reference
| Inherits from | DTHTMLParserNode : NSObject | 
| Declared in | DTHTMLElement.h | 
Overview
Class to represent a element (aka “tag”) in a HTML document. Structure information - like parent or children - is inherited from its superclass DTHTMLParserNode.
Tasks
Creating HTML Elements
Creating Attributed Strings
Getting Element Information
- 
	
		fontDescriptorproperty
- 
	
		paragraphStyleproperty
- 
	
		textAttachmentproperty
- 
	
		linkproperty
- 
	
		anchorNameproperty
- 
	
		textColorproperty
- 
	
		backgroundColorproperty
- 
	
		backgroundStrokeColorproperty
- 
	
		backgroundStrokeWidthproperty
- 
	
		backgroundCornerRadiusproperty
- 
	
		letterSpacingproperty
- 
	
		beforeContentproperty
- 
	
		shadowsproperty
- 
	
		underlineStyleproperty
- 
	
		strikeOutproperty
- 
	
		superscriptStyleproperty
- 
	
		headerLevelproperty
- 
	
		displayStyleproperty
- 
	
		floatStyleproperty
- 
	
		isColorInheritedproperty
- 
	
		preserveNewlinesproperty
- 
	
		fontVariantproperty
- 
	
		currentTextSizeproperty
- 
	
		textScaleproperty
- 
	
		sizeproperty
- 
	
		marginsproperty
- 
	
		paddingproperty
- 
	
		containsAppleConvertedSpaceproperty
- 
	
		shouldProcessCustomHTMLAttributesproperty
Working with HTML Attributes
- 
	
		– attributeForKey:
- 
	
		– inheritAttributesFromElement:
- 
	
		– interpretAttributes
- 
	
		+ attributesToIgnoreForCustomAttributesAttribute
- 
	
		CSSClassNamesToIgnoreForCustomAttributesproperty
Working with CSS Styles
HTML Node Hierarchy
Output State (Internal)
- 
	
		didOutputproperty
- 
	
		– needsOutput
Properties
CSSClassNamesToIgnoreForCustomAttributes
The CSS class names that are not to be added to the “class” custom attribute in the DTCustomAttributesAttribute key. Those are usually the class names
@property (nonatomic, strong) NSSet *CSSClassNamesToIgnoreForCustomAttributesDeclared In
DTHTMLElement.hanchorName
Anchor name, used by hyperlinks, of the receiver that can be used to scroll to.
@property (nonatomic, copy) NSString *anchorNameDeclared In
DTHTMLElement.hbackgroundColor
Background color of text in the receiver
@property (nonatomic, strong) DTColor *backgroundColorDeclared In
DTHTMLElement.hbackgroundCornerRadius
Background stroke width in the receiver
@property (nonatomic, assign) CGFloat backgroundCornerRadiusDeclared In
DTHTMLElement.hbackgroundStrokeColor
Background stroke color in the receiver
@property (nonatomic, strong) DTColor *backgroundStrokeColorDeclared In
DTHTMLElement.hbackgroundStrokeWidth
Background stroke width in the receiver
@property (nonatomic, assign) CGFloat backgroundStrokeWidthDeclared In
DTHTMLElement.hbeforeContent
Additional text to be inserted before the text content of the receiver
@property (nonatomic, copy) NSString *beforeContentDeclared In
DTHTMLElement.hcontainsAppleConvertedSpace
Specifies that whitespace contained in the receiver’s text has been converted with Apple’s algorithm.
@property (nonatomic, assign) BOOL containsAppleConvertedSpaceDeclared In
DTHTMLElement.hcurrentTextSize
The current unscaled font size (used when inheriting font size). You’re probably looking for fontDescriptor.pointSize.
@property (nonatomic, assign) CGFloat currentTextSizeDeclared In
DTHTMLElement.hdidOutput
Internal state during string building to mark the receiver als having been flushed
@property (nonatomic, assign) BOOL didOutputDeclared In
DTHTMLElement.hdisplayStyle
The display style of the receiver.
@property (nonatomic, assign) DTHTMLElementDisplayStyle displayStyleDeclared In
DTHTMLElement.hfloatStyle
Whether the receiver is marked as float. While floating is not currently supported this can be used to add additional paragraph breaks.
@property (nonatomic, readonly) DTHTMLElementFloatStyle floatStyleDeclared In
DTHTMLElement.hfontDescriptor
Font Descriptor describing the font state of the receiver
@property (nonatomic, copy) DTCoreTextFontDescriptor *fontDescriptorDeclared In
DTHTMLElement.hfontVariant
The current font variant of the receiver, normal or small caps.
@property (nonatomic, assign) DTHTMLElementFontVariant fontVariantDeclared In
DTHTMLElement.hheaderLevel
The header level of the receiver, or 0 if it is not a header
@property (nonatomic, assign) NSInteger headerLevelDeclared In
DTHTMLElement.hletterSpacing
The custom letter spacing of the receiver, default is 0px
@property (nonatomic, assign) CGFloat letterSpacingDeclared In
DTHTMLElement.hlink
Hyperlink URL of the receiver, or nil if there is no hyperlink
@property (nonatomic, copy) NSURL *linkDeclared In
DTHTMLElement.hmargins
The value of the CSS margins. Margin support is incomplete.
@property (nonatomic, assign) DTEdgeInsets marginsDeclared In
DTHTMLElement.hpadding
The value of the CSS padding. Padding are added to DTTextBlock instances for block-level elements.
@property (nonatomic, assign) DTEdgeInsets paddingDeclared In
DTHTMLElement.hparagraphStyle
Paragraph Style describing the paragraph state of the receiver
@property (nonatomic, copy) DTCoreTextParagraphStyle *paragraphStyleDeclared In
DTHTMLElement.hpreserveNewlines
Specifies that whitespace and new lines should be preserved. Default is to compress white space.
@property (nonatomic, assign) BOOL preserveNewlinesDeclared In
DTHTMLElement.hshadows
Array of shadows attached to the text contents of the receiver
@property (nonatomic, copy) NSArray *shadowsDeclared In
DTHTMLElement.hshouldProcessCustomHTMLAttributes
Prevents adding custom HTML attributes to output
@property (nonatomic, assign) BOOL shouldProcessCustomHTMLAttributesDeclared In
DTHTMLElement.hsize
The size of the receiver, either from width/height attributes or width/hight styles.
@property (nonatomic, assign) CGSize sizeDeclared In
DTHTMLElement.hstrikeOut
The strike-out style of the receiver
@property (nonatomic, assign) BOOL strikeOutDeclared In
DTHTMLElement.hsuperscriptStyle
The superscript style of the receiver or 0 if it does not have superscript text.
@property (nonatomic, assign) NSInteger superscriptStyleDeclared In
DTHTMLElement.htextAttachment
Text Attachment of the receiver, or nil if there is no attachment
@property (nonatomic, strong) DTTextAttachment *textAttachmentDeclared In
DTHTMLElement.htextColor
Foreground text color of the receiver
@property (nonatomic, strong) DTColor *textColorDeclared In
DTHTMLElement.hClass Methods
attributesToIgnoreForCustomAttributesAttribute
The HTML attributes that should be attached to the generated attributed string. Typically all attributes that were processed by interpretAttributes are in this list. All other attributes get added to the generated attributed string with the DTCustomAttributesAttribute key.
+ (NSSet *)attributesToIgnoreForCustomAttributesAttributeDeclared In
DTHTMLElement.helementWithName:attributes:options:
Designed initializer, creates the appropriate element sub type
+ (DTHTMLElement *)elementWithName:(NSString *)name attributes:(NSDictionary *)attributes options:(NSDictionary *)optionsParameters
- name
- The element name 
- attributes
- The attributes dictionary of the tag 
- options
- The parsing options dictionary 
Return Value
the initialized element
Declared In
DTHTMLElement.hInstance Methods
applyStyleDictionary:
Applies the style information contained in a styles dictionary to the receiver
- (void)applyStyleDictionary:(NSDictionary *)stylesParameters
- styles
- A style dictionary 
Declared In
DTHTMLElement.hattributeForKey:
Retrieves an attribute with a given key
- (NSString *)attributeForKey:(NSString *)keyParameters
- key
- The attribute name to retrieve 
Return Value
the attribute string
Declared In
DTHTMLElement.hattributedString
Creates an NSAttributedString that represents the receiver including all its children. This method is typically overwritten in subclasses of 
- (NSAttributedString *)attributedStringReturn Value
An attributed string that also contains the children
Declared In
DTHTMLElement.hattributesForAttributedStringRepresentation
The dictionary of Core Text attributes for creating an NSAttributedString representation for the receiver
- (NSDictionary *)attributesForAttributedStringRepresentationReturn Value
The dictionary of attributes
Declared In
DTHTMLElement.hinheritAttributesFromElement:
Copies and inherits relevant attributes from the given parent element
- (void)inheritAttributesFromElement:(DTHTMLElement *)elementParameters
- element
- The element to inherit attributes from 
Declared In
DTHTMLElement.hinterpretAttributes
Interprets the tag attributes for e.g. writing direction. Usually you would call this after inheritAttributesFromElement:.
- (void)interpretAttributesDeclared In
DTHTMLElement.hlistStyle
Creates a DTCSSListStyle to match the CSS styles
- (DTCSSListStyle *)listStyleDeclared In
DTHTMLElement.h