本文整理汇总了C#中IHTMLItem类的典型用法代码示例。如果您正苦于以下问题:C# IHTMLItem类的具体用法?C# IHTMLItem怎么用?C# IHTMLItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IHTMLItem类属于命名空间,在下文中一共展示了IHTMLItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsValidSubType
protected override bool IsValidSubType(IHTMLItem item)
{
if (!base.IsValidSubType(item))
{
return false;
}
if (item is Image ||
item is SmallText ||
item is Sub ||
item is Sup)
{
return false;
}
if (item.SubElements().FindAll(x => x is Image).Count > 0)
{
return false;
}
if (item.SubElements().FindAll(x => x is SmallText).Count > 0)
{
return false;
}
if (item.SubElements().FindAll(x => x is Sub).Count > 0)
{
return false;
}
if (item.SubElements().FindAll(x => x is Sup).Count > 0)
{
return false;
}
return true;
}
示例2: IsValidSubType
protected override bool IsValidSubType(IHTMLItem item)
{
if (item is IBlockElement)
{
return item.IsValid();
}
return false;
}
示例3: IsValidSubType
protected override bool IsValidSubType(IHTMLItem item)
{
if (item is Frame)
{
return true;
}
return false;
}
示例4: IsValidSubType
protected override bool IsValidSubType(IHTMLItem item)
{
if (item is SimpleHTML5Text)
{
return item.IsValid();
}
return false;
}
示例5: IsValidSubType
protected override bool IsValidSubType(IHTMLItem item)
{
if (item is Option)
{
return item.IsValid();
}
return false;
}
示例6: IsValidSubType
protected override bool IsValidSubType(IHTMLItem item)
{
// TODO: full check for ruby sequence
if (item is IRubyItem)
{
return item.IsValid();
}
return false;
}
示例7: IsValidSubType
protected override bool IsValidSubType(IHTMLItem item)
{
if (item is IInlineItem ||
item is IBlockElement ||
item is SimpleHTML5Text)
{
return item.IsValid();
}
return false;
}
示例8: LinkReMapperV2
public LinkReMapperV2(KeyValuePair<string, List<Anchor>> link, Dictionary<string, IHTMLItem> ids, BookStructureManager structureManager)
{
_link = link;
_structureManager = structureManager;
_idString = ReferencesUtils.GetIdFromLink(link.Key); // Get ID of a link target;
_linkTargetItem = ids[_idString]; // get object targeted by link
_linkTargetDocument = GetIDParentDocument(structureManager, _linkTargetItem); // get parent document (file) containing targeted object
if (_linkTargetDocument != null)
{
_linkParentContainer = DetectItemParentContainer(_linkTargetItem); // get parent container of link target item
}
}
示例9: IsValidSubType
protected override bool IsValidSubType(IHTMLItem item)
{
if (item is DefinitionDescription)
{
return item.IsValid();
}
if (item is DefinitionTerms)
{
return item.IsValid();
}
return false;
}
示例10: IsValidSubType
protected override bool IsValidSubType(IHTMLItem item)
{
if (item is Title ||
item is Base ||
item is Link ||
item is Meta ||
item is Script ||
item is Style ||
item is NoScript
)
{
return item.IsValid();
}
return false;
}
示例11: IsValidSubType
protected override bool IsValidSubType(IHTMLItem item)
{
if (item is IInlineItem)
{
// TODO: check for label presence at depth
if (item is Label)
{
return false;
}
return item.IsValid();
}
if (item is SimpleHTML5Text)
{
return item.IsValid();
}
return false;
}
示例12: PartOfDocument
/// <summary>
/// Checks if XHTML element is part of current document
/// </summary>
/// <param name="value">elemenrt to check</param>
/// <returns>true idf part of this document, false otherwise</returns>
public override bool PartOfDocument(IHTMLItem value)
{
if (BookAnnotation == null)
{
return false;
}
IHTMLItem parent = value;
while (parent.Parent != null)
{
parent = parent.Parent;
}
if (parent == BookAnnotation)
{
return true;
}
return false;
}
示例13: AddIdUsed
/// <summary>
/// Add used ID to the list
/// </summary>
/// <param name="id">Id to list as used</param>
/// <param name="item">item that ID belong to</param>
/// <returns>returns and registers the id if available, empty string if ID already exists</returns>
public string AddIdUsed(string id,IHTMLItem item)
{
if (string.IsNullOrEmpty(id))
{
return id;
}
string newid = EnsureGoodId(id);
if (_ids.ContainsKey(newid))
{
// we get here if in file same ID used twice
// The assumption here that since the text located in FB2 main body we should not have same ID used more than once
// otherwise we would not know how (and where to) go back
Logger.Log.InfoFormat("item with ID {0} already defined, ignoring to avoid inconsistences", newid);
return string.Empty;
}
_ids.Add(newid, item);
return newid;
}
示例14: DetectItemParentContainer
/// <summary>
/// Detect parent container of the element
/// </summary>
/// <param name="referencedItem"></param>
/// <returns></returns>
private IHTMLItem DetectItemParentContainer(IHTMLItem referencedItem)
{
if (referencedItem is IBlockElement) // if item itself is container - return it
{
return referencedItem;
}
if (referencedItem.Parent != null)
{
if (referencedItem.Parent is IBlockElement) // if item is located inside container
{
return referencedItem.Parent;
}
if (referencedItem.Parent is TextBasedElement) // if parent is text, i's ok for container
{
return referencedItem.Parent;
}
return DetectItemParentContainer(referencedItem.Parent); // go up the inclusion chain
}
return null;
}
示例15: IsValidSubType
protected override bool IsValidSubType(IHTMLItem item)
{
if (Subitems.Count >= 2) // no more than two sub elements
{
return false;
}
if (Subitems.Count == 0) // head have to be first
{
if (!(item is Head) )
{
return false;
}
}
if (Subitems.Count == 1) // body have to be second
{
if (!(item is Body) )
{
return false;
}
}
return item.IsValid();
}