예제 #1
0
 internal Element(GumboElementNode node, Node parent, GumboFactory factory)
     : base(node, parent)
 {
     _children         = factory.CreateLazy(() => ImmutableArray.CreateRange(node.GetChildren().OrderBy(x => x.index_within_parent).Select(x => factory.CreateNode(x, this))));
     _attributes       = factory.CreateLazy(() => ImmutableArray.CreateRange(node.GetAttributes().Select(x => factory.CreateAttribute(x, this))));
     _value            = factory.CreateLazy(() => string.Concat(Children.Select(x => x is Element ? ((Element)x).Value : ((Text)x).Value)));
     StartPosition     = node.element.start_pos;
     EndPosition       = node.element.end_pos;
     Tag               = node.element.tag;
     TagNamespace      = node.element.tag_namespace;
     OriginalTag       = NativeUtf8.StringFromNativeUtf8(node.element.original_tag.data, (int)node.element.original_tag.length);
     OriginalTagName   = GetTagNameFromOriginalTag(node.element);
     OriginalEndTag    = NativeUtf8.StringFromNativeUtf8(node.element.original_end_tag.data, (int)node.element.original_end_tag.length);
     NormalizedTagName = NativeUtf8.StringFromNativeUtf8(NativeMethods.gumbo_normalized_tagname(node.element.tag));
 }
예제 #2
0
파일: Document.cs 프로젝트: h3ml/gumbo.net
 internal Document(GumboDocumentNode node, GumboFactory factory)
     : base(node, null)
 {
     _children         = factory.CreateLazy(() => ImmutableArray.CreateRange(node.GetChildren().OrderBy(x => x.index_within_parent).Select(x => factory.CreateNode(x, this))));
     HasDocType        = node.document.has_doctype;
     Name              = NativeUtf8.StringFromNativeUtf8(node.document.name);
     PublicIdentifier  = NativeUtf8.StringFromNativeUtf8(node.document.public_identifier);
     SystemIdentifier  = NativeUtf8.StringFromNativeUtf8(node.document.system_identifier);
     DocTypeQuirksMode = node.document.doc_type_quirks_mode;
 }