public SpineItemref(XELement itemref, Dictionary <string, ManifestItem> items) { this.item = items[itemref.tag.GetAttribute("idref")]; properties = itemref.tag.GetAttribute("properties"); id = itemref.tag.GetAttribute("id"); if (itemref.tag.GetAttribute("linear") == "no") { linear = false; } }
public ManifestItem(XELement e, EpubFile belongTo) { this.belongTo = belongTo; XTag tag = e.tag; href = tag.GetAttribute("href");//Will be Add opf path in ReadSpine() id = tag.GetAttribute("id"); mediaType = tag.GetAttribute("media-type"); properties = tag.GetAttribute("properties"); }
public void AddIfExist(XELement e, string property_name) { string t = e.tag.GetAttribute(property_name); if (t != "") { int pre = property_name.IndexOf(':'); if (pre > 0) { property_name = property_name.Substring(pre + 1); } var a = new MetaRecord(); a.name = property_name; a.value = t; refines.Add(a); } }
public XFragment(string text, int start) { if (text[start] != '<') { throw new XMLException("XFragment Error:Unexpect Start."); } indexInSource = start; Regex reg_tag = new Regex("<[^\\!]*?>"); int count = 0, pos = start; Match m; do { m = reg_tag.Match(text, pos); if (!m.Success) { new XMLException("XFragment Error:Unexpect end."); } XTag tag = new XTag(m.Value); if (tag.type == PartType.tag_start) { count++; } if (tag.type == PartType.tag_end) { count--; } if (m.Index > pos) { parts.Add(new XText(text.Substring(pos, m.Index - pos))); } parts.Add(tag); pos = m.Index + m.Value.Length; }while (count > 0); originalLength = m.Index - start + m.Value.Length; root = new XELement(this, 0); }
public XELement(XFragment frag, int start) { doc = frag; this.tagStartRef = start; if (doc.parts[tagStartRef].type == PartType.tag_single) { this.tagEndRef = start; return; } for (int i = start + 1; i < doc.parts.Count; i++) { if (doc.parts[i].type == PartType.tag_start) { XELement ele = new XELement(doc, i); ele.parent = this; childs.Add(ele); i = ele.tagEndRef; continue; } if (doc.parts[i].type == PartType.tag_end) { if (((XTag)doc.parts[i]).tagname == ((XTag)doc.parts[start]).tagname) { tagEndRef = i; break; } else { throw new XMLException("dismatched end tag:" + doc.parts[start] + "..." + doc.parts[i]); } } } if (tagEndRef == -1) { throw new XMLException("Failure when close tag."); } }
public MetaRecord(XELement e) { name = e.tag.tagname; value = e.innerXHTML; id = e.tag.GetAttribute("id"); }