public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (Name != null) { result.AddRange(Name.Validate()); } if (HeaderElement != null) { result.AddRange(HeaderElement.Validate()); } if (TextElement != null) { result.AddRange(TextElement.Validate()); } if (Subject != null) { result.AddRange(Subject.Validate()); } if (Question != null) { Question.ForEach(elem => result.AddRange(elem.Validate())); } if (Group != null) { Group.ForEach(elem => result.AddRange(elem.Validate())); } return(result); }
private void ParseNextElement() { // loop while there are headers left to parse while (this.headerIt.HasNext() || this.cursor != null) { if (this.cursor == null || this.cursor.AtEnd()) { // get next header value BufferHeaderValue(); } // Anything buffered? if (this.cursor != null) { // loop while there is data in the buffer while (!this.cursor.AtEnd()) { HeaderElement e = this.parser.ParseHeaderElement(this.buffer, this.cursor); if (!(e.GetName().Length == 0 && e.GetValue() == null)) { // Found something this.currentElement = e; return; } } // if at the end of the buffer if (this.cursor.AtEnd()) { // discard it this.cursor = null; this.buffer = null; } } } }
/// <summary>Estimates the length of a formatted header element.</summary> /// <remarks>Estimates the length of a formatted header element.</remarks> /// <param name="elem">the header element to format, or <code>null</code></param> /// <returns>a length estimate, in number of characters</returns> protected internal virtual int EstimateHeaderElementLen(HeaderElement elem) { if (elem == null) { return(0); } int result = elem.GetName().Length; // name string value = elem.GetValue(); if (value != null) { // assume quotes, but no escaped characters result += 3 + value.Length; } // ="value" int parcnt = elem.GetParameterCount(); if (parcnt > 0) { for (int i = 0; i < parcnt; i++) { result += 2 + EstimateNameValuePairLen(elem.GetParameter(i)); } } // ; <param> return(result); }
public void Constructor() { HeaderElement he; AssertExtensions.Throws <ArgumentNullException> (() => { he = new HeaderElement(null, String.Empty); }, "#A1"); AssertExtensions.Throws <ArgumentNullException> (() => { he = new HeaderElement("Header", null); }, "#A2"); he = new HeaderElement("Header", String.Empty); Assert.AreEqual("Header", he.Name, "#B1-1"); Assert.AreEqual(String.Empty, he.Value, "#B1-2"); he = new HeaderElement("Header", "Value"); Assert.AreEqual("Header", he.Name, "#C1-1"); Assert.AreEqual("Value", he.Value, "#C1-2"); he = new HeaderElement(String.Empty, String.Empty); Assert.AreEqual(String.Empty, he.Name, "#D1-1"); Assert.AreEqual(String.Empty, he.Value, "#D1-2"); }
public virtual long GetKeepAliveDuration(HttpResponse response, HttpContext context ) { Args.NotNull(response, "HTTP response"); HeaderElementIterator it = new BasicHeaderElementIterator(response.HeaderIterator (HTTP.ConnKeepAlive)); while (it.HasNext()) { HeaderElement he = it.NextElement(); string param = he.GetName(); string value = he.GetValue(); if (value != null && Sharpen.Runtime.EqualsIgnoreCase(param, "timeout")) { try { return(long.Parse(value) * 1000); } catch (FormatException) { } } } return(-1); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as ChannelComponent; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (TypeElement != null) { dest.TypeElement = (Code <Hl7.Fhir.Model.Subscription.SubscriptionChannelType>)TypeElement.DeepCopy(); } if (EndpointElement != null) { dest.EndpointElement = (Hl7.Fhir.Model.FhirUri)EndpointElement.DeepCopy(); } if (PayloadElement != null) { dest.PayloadElement = (Hl7.Fhir.Model.FhirString)PayloadElement.DeepCopy(); } if (HeaderElement != null) { dest.HeaderElement = (Hl7.Fhir.Model.FhirString)HeaderElement.DeepCopy(); } return(dest); }
public static void Run() { // ExStart:CreateStructureElements // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); // Create Pdf Document Document document = new Document(); // Get Content for work with TaggedPdf ITaggedContent taggedContent = document.TaggedContent; // Set Title and Language for Documnet taggedContent.SetTitle("Tagged Pdf Document"); taggedContent.SetLanguage("en-US"); // Create Grouping Elements PartElement partElement = taggedContent.CreatePartElement(); ArtElement artElement = taggedContent.CreateArtElement(); SectElement sectElement = taggedContent.CreateSectElement(); DivElement divElement = taggedContent.CreateDivElement(); BlockQuoteElement blockQuoteElement = taggedContent.CreateBlockQuoteElement(); CaptionElement captionElement = taggedContent.CreateCaptionElement(); TOCElement tocElement = taggedContent.CreateTOCElement(); TOCIElement tociElement = taggedContent.CreateTOCIElement(); IndexElement indexElement = taggedContent.CreateIndexElement(); NonStructElement nonStructElement = taggedContent.CreateNonStructElement(); PrivateElement privateElement = taggedContent.CreatePrivateElement(); // Create Text Block-Level Structure Elements ParagraphElement paragraphElement = taggedContent.CreateParagraphElement(); HeaderElement headerElement = taggedContent.CreateHeaderElement(); HeaderElement h1Element = taggedContent.CreateHeaderElement(1); // Create Text Inline-Level Structure Elements SpanElement spanElement = taggedContent.CreateSpanElement(); QuoteElement quoteElement = taggedContent.CreateQuoteElement(); NoteElement noteElement = taggedContent.CreateNoteElement(); // Create Illustration Structure Elements FigureElement figureElement = taggedContent.CreateFigureElement(); FormulaElement formulaElement = taggedContent.CreateFormulaElement(); // Methods are under development ListElement listElement = taggedContent.CreateListElement(); TableElement tableElement = taggedContent.CreateTableElement(); ReferenceElement referenceElement = taggedContent.CreateReferenceElement(); BibEntryElement bibEntryElement = taggedContent.CreateBibEntryElement(); CodeElement codeElement = taggedContent.CreateCodeElement(); LinkElement linkElement = taggedContent.CreateLinkElement(); AnnotElement annotElement = taggedContent.CreateAnnotElement(); RubyElement rubyElement = taggedContent.CreateRubyElement(); WarichuElement warichuElement = taggedContent.CreateWarichuElement(); FormElement formElement = taggedContent.CreateFormElement(); // Save Tagged Pdf Document document.Save(dataDir + "StructureElements.pdf"); // ExEnd:CreateStructureElements }
/// <exception cref="Apache.Http.Cookie.MalformedCookieException"></exception> public virtual IList <Apache.Http.Cookie.Cookie> Parse(Header header, CookieOrigin origin) { Args.NotNull(header, "Header"); Args.NotNull(origin, "Cookie origin"); HeaderElement[] helems = header.GetElements(); bool versioned = false; bool netscape = false; foreach (HeaderElement helem in helems) { if (helem.GetParameterByName("version") != null) { versioned = true; } if (helem.GetParameterByName("expires") != null) { netscape = true; } } if (netscape || !versioned) { // Need to parse the header again, because Netscape style cookies do not correctly // support multiple header elements (comma cannot be treated as an element separator) NetscapeDraftHeaderParser parser = NetscapeDraftHeaderParser.Default; CharArrayBuffer buffer; ParserCursor cursor; if (header is FormattedHeader) { buffer = ((FormattedHeader)header).GetBuffer(); cursor = new ParserCursor(((FormattedHeader)header).GetValuePos(), buffer.Length( )); } else { string s = header.GetValue(); if (s == null) { throw new MalformedCookieException("Header value is null"); } buffer = new CharArrayBuffer(s.Length); buffer.Append(s); cursor = new ParserCursor(0, buffer.Length()); } helems = new HeaderElement[] { parser.ParseHeader(buffer, cursor) }; return(GetCompat().Parse(helems, origin)); } else { if (SM.SetCookie2.Equals(header.GetName())) { return(GetStrict().Parse(helems, origin)); } else { return(GetObsoleteStrict().Parse(helems, origin)); } } }
public override void Draw() { if (HeaderElement != null) { HeaderElement.Draw(); } base.Draw(); }
private static Org.Apache.Http.Entity.ContentType Create(HeaderElement helem) { string mimeType = helem.GetName(); NameValuePair[] @params = helem.GetParameters(); return(new Org.Apache.Http.Entity.ContentType(mimeType, @params != null && @params .Length > 0 ? @params : null)); }
public void Update(int id, HeaderElement entity) { var existing = GetById(id); existing.PostedAt = DateTime.Now; existing.Title = entity.Title; existing.Text = entity.Text; }
private void CreateHeader(string headerName) { HeaderElement headerElement = Instantiate(_headerPrefab); headerElement.Initialize(headerName); headerElement.transform.SetParent(_headerContentRoot); _headers.Add(headerName, headerElement); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Endpoint; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.Endpoint.EndpointStatus>)StatusElement.DeepCopy(); } if (ConnectionType != null) { dest.ConnectionType = (Hl7.Fhir.Model.Coding)ConnectionType.DeepCopy(); } if (NameElement != null) { dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy(); } if (ManagingOrganization != null) { dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopy(); } if (Contact != null) { dest.Contact = new List <Hl7.Fhir.Model.ContactPoint>(Contact.DeepCopy()); } if (Period != null) { dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy(); } if (PayloadType != null) { dest.PayloadType = new List <Hl7.Fhir.Model.CodeableConcept>(PayloadType.DeepCopy()); } if (PayloadMimeTypeElement != null) { dest.PayloadMimeTypeElement = new List <Hl7.Fhir.Model.Code>(PayloadMimeTypeElement.DeepCopy()); } if (AddressElement != null) { dest.AddressElement = (Hl7.Fhir.Model.FhirUrl)AddressElement.DeepCopy(); } if (HeaderElement != null) { dest.HeaderElement = new List <Hl7.Fhir.Model.FhirString>(HeaderElement.DeepCopy()); } return(dest); }
static void Main() { var header = new HeaderElement() { HeaderTop = "TOP HEADER", HeaderContent = "TABLE HEADER" }; var table = new TableElement <Product>(new List <Product>() { new Product() { Description = "Pizza", UnitValue = 10.5m, SaleValue = 10.5m * 1.3m }, new Product() { Description = "Homebread", UnitValue = 10.5m, SaleValue = 10.5m * 1.3m }, new Product() { Description = "Pasta", UnitValue = 10.5m, SaleValue = 10.5m * 1.3m }, new Product() { Description = "Cheese", UnitValue = 10.5m, SaleValue = 10.5m * 1.3m }, new Product() { Description = "Bacon", UnitValue = 10.5m, SaleValue = 10.5m * 1.3m }, new Product() { Description = "Nuts", UnitValue = 10.5m, SaleValue = 10.5m * 1.3m }, new Product() { Description = "Sugar", UnitValue = 10.5m, SaleValue = 10.5m * 1.3m }, new Product() { Description = "Milk", UnitValue = 10.5m, SaleValue = 10.5m * 1.3m }, }); var document = new DocumentElement(header); document.AppendContent(table.Render()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new ORDocumentViewer(document)); }
public void Initialize(List <DebugManager.AttributeEntry> attributes) { foreach (DebugManager.AttributeEntry attribute in attributes) { HeaderElement header = GetHeader(attribute.Attribute.Header); DebugElement attributeObject = CreateAttribute(attribute); attributeObject.Initialize(this); header.AddElement(attributeObject.gameObject); _elements.Add(attributeObject); } }
public static void Run() { // ExStart:TextBlockStructureElements // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); // Create Pdf Document Document document = new Document(); // Get Content for work with TaggedPdf ITaggedContent taggedContent = document.TaggedContent; // Set Title and Language for Documnet taggedContent.SetTitle("Tagged Pdf Document"); taggedContent.SetLanguage("en-US"); // Get Root Structure Element StructureElement rootElement = taggedContent.RootElement; HeaderElement h1 = taggedContent.CreateHeaderElement(1); HeaderElement h2 = taggedContent.CreateHeaderElement(2); HeaderElement h3 = taggedContent.CreateHeaderElement(3); HeaderElement h4 = taggedContent.CreateHeaderElement(4); HeaderElement h5 = taggedContent.CreateHeaderElement(5); HeaderElement h6 = taggedContent.CreateHeaderElement(6); h1.SetText("H1. Header of Level 1"); h2.SetText("H2. Header of Level 2"); h3.SetText("H3. Header of Level 3"); h4.SetText("H4. Header of Level 4"); h5.SetText("H5. Header of Level 5"); h6.SetText("H6. Header of Level 6"); rootElement.AppendChild(h1); rootElement.AppendChild(h2); rootElement.AppendChild(h3); rootElement.AppendChild(h4); rootElement.AppendChild(h5); rootElement.AppendChild(h6); ParagraphElement p = taggedContent.CreateParagraphElement(); p.SetText("P. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nec lectus ac sem faucibus imperdiet. Sed ut erat ac magna ullamcorper hendrerit. Cras pellentesque libero semper, gravida magna sed, luctus leo. Fusce lectus odio, laoreet nec ullamcorper ut, molestie eu elit. Interdum et malesuada fames ac ante ipsum primis in faucibus. Aliquam lacinia sit amet elit ac consectetur. Donec cursus condimentum ligula, vitae volutpat sem tristique eget. Nulla in consectetur massa. Vestibulum vitae lobortis ante. Nulla ullamcorper pellentesque justo rhoncus accumsan. Mauris ornare eu odio non lacinia. Aliquam massa leo, rhoncus ac iaculis eget, tempus et magna. Sed non consectetur elit. Sed vulputate, quam sed lacinia luctus, ipsum nibh fringilla purus, vitae posuere risus odio id massa. Cras sed venenatis lacus."); rootElement.AppendChild(p); // Save Tagged Pdf Document document.Save(dataDir + "TextBlockStructureElements.pdf"); // ExEnd:TextBlockStructureElements }
/// <exception cref="Sharpen.NoSuchElementException"></exception> public virtual HeaderElement NextElement() { if (this.currentElement == null) { ParseNextElement(); } if (this.currentElement == null) { throw new NoSuchElementException("No more header elements available"); } HeaderElement element = this.currentElement; this.currentElement = null; return(element); }
private static HeaderElement CreateHeaderElement(SerializationContext context) { var element = new HeaderElement(); Snippet snippet = context.Snippet; if (!string.IsNullOrEmpty(snippet.Title)) { element.Title = snippet.Title; } if (!string.IsNullOrEmpty(snippet.Author)) { element.Author = snippet.Author; } if (!string.IsNullOrEmpty(snippet.Description)) { element.Description = snippet.Description; } if (!string.IsNullOrEmpty(snippet.Shortcut)) { element.Shortcut = snippet.Shortcut; } if (snippet.HelpUrl != null) { element.HelpUrl = snippet.HelpUrl.ToString(); } if (snippet.SnippetTypes != SnippetTypes.None) { element.SnippetTypes = GetSnippetTypes(snippet.SnippetTypes).ToArray(); } if (snippet.Keywords.Count > 0) { element.Keywords = snippet.Keywords.ToArray(); } if (snippet.HasAlternativeShortcuts) { element.AlternativeShortcuts = snippet.AlternativeShortcuts.ToArray(); } return(element); }
// non-javadoc, see interface HeaderValueParser public virtual HeaderElement[] ParseElements(CharArrayBuffer buffer, ParserCursor cursor) { Args.NotNull(buffer, "Char array buffer"); Args.NotNull(cursor, "Parser cursor"); IList <HeaderElement> elements = new AList <HeaderElement>(); while (!cursor.AtEnd()) { HeaderElement element = ParseHeaderElement(buffer, cursor); if (!(element.GetName().Length == 0 && element.GetValue() == null)) { elements.AddItem(element); } } return(Sharpen.Collections.ToArray(elements, new HeaderElement[elements.Count])); }
public static void Run() { // ExStart:CreatePDFwithTaggedText // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); // Create Pdf Document Document document = new Document(); // Get Content for work with TaggedPdf ITaggedContent taggedContent = document.TaggedContent; // Set Title and Language for Documnet taggedContent.SetTitle("Tagged Pdf Document"); taggedContent.SetLanguage("en-US"); // Create Text Block-Level Structure Elements HeaderElement headerElement = taggedContent.CreateHeaderElement(); headerElement.ActualText = "Heading 1"; ParagraphElement paragraphElement1 = taggedContent.CreateParagraphElement(); paragraphElement1.ActualText = "test1"; ParagraphElement paragraphElement2 = taggedContent.CreateParagraphElement(); paragraphElement2.ActualText = "test 2"; ParagraphElement paragraphElement3 = taggedContent.CreateParagraphElement(); paragraphElement3.ActualText = "test 3"; ParagraphElement paragraphElement4 = taggedContent.CreateParagraphElement(); paragraphElement4.ActualText = "test 4"; ParagraphElement paragraphElement5 = taggedContent.CreateParagraphElement(); paragraphElement5.ActualText = "test 5"; ParagraphElement paragraphElement6 = taggedContent.CreateParagraphElement(); paragraphElement6.ActualText = "test 6"; ParagraphElement paragraphElement7 = taggedContent.CreateParagraphElement(); paragraphElement7.ActualText = "test 7"; // Save PDF Document document.Save(dataDir + "PDFwithTaggedText.pdf"); // ExEnd:CreatePDFwithTaggedText }
private static HeaderElement ExtractToHeaderElement(ITaggedContent taggedContent, Page page, int textIndex, int headerLevel = 1) { TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(); page.Accept(textFragmentAbsorber); TextFragment originalHeaderText = textFragmentAbsorber.TextFragments[textIndex]; HeaderElement h1 = taggedContent.CreateHeaderElement(headerLevel); h1.StructureTextState.ForegroundColor = originalHeaderText.TextState.ForegroundColor; Font headerFont = FontRepository.FindFont(originalHeaderText.TextState.Font.FontName); headerFont.IsEmbedded = true; h1.StructureTextState.Font = headerFont; h1.SetText(originalHeaderText.Text); return(h1); }
static void Main() { var inputFileName = "non-compliant.pdf"; var outputFileName = "compliant.pdf"; // Use some helper functions to create an example non-PDf/UA-compliant PDF Helpers.CreateDemoNonCompliantPdfFile(inputFileName); using (var d = new Document(inputFileName)) { bool isValid = d.Validate("non-compliant-validation-log.xml", Aspose.Pdf.PdfFormat.PDF_UA_1); } var originalDocument = new Document(inputFileName); var pageOne = originalDocument.Pages[1]; // Create our new tagged document var taggedDocument = new Document(); ITaggedContent taggedContent = taggedDocument.TaggedContent; StructureElement rootElement = taggedContent.RootElement; // Set meta data required by PDF/UA taggedContent.SetTitle("Our compliant document."); taggedContent.SetLanguage("en-US"); // Extract from original PDF and create new structured elements for tagged PDF HeaderElement h1 = ExtractToHeaderElement(taggedContent, pageOne, 1, 1); ParagraphElement p = ExtractToParagraphElement(taggedContent, pageOne, 2); FigureElement figureElement = ExtractToFigureElement(taggedContent, pageOne, 1); // Append to new tagged content in desired order, which will build structure tree up from the 'root' rootElement.AppendChild(h1); rootElement.AppendChild(figureElement); rootElement.AppendChild(p); // Save and validate the compliant PDF taggedDocument.Save(outputFileName); using (var d = new Document(outputFileName)) { bool isValid = d.Validate("compliant-validation-log.xml", Aspose.Pdf.PdfFormat.PDF_UA_1); } }
private static void LoadHeaderElement(HeaderElement element, Snippet snippet) { snippet.Author = element.Author; snippet.Description = element.Description; snippet.Shortcut = element.Shortcut; snippet.Title = element.Title; if (element.AlternativeShortcuts != null) { foreach (string shortcut in element.AlternativeShortcuts) { snippet.AlternativeShortcuts.Add(shortcut); } } if (element.HelpUrl != null && Uri.TryCreate(element.HelpUrl, UriKind.RelativeOrAbsolute, out Uri uri)) { snippet.HelpUrl = uri; } if (element.Keywords != null) { foreach (string keyword in element.Keywords) { snippet.Keywords.Add(keyword); } } if (element.SnippetTypes != null) { foreach (string value in element.SnippetTypes) { if (Enum.TryParse(value, out SnippetTypes snippetTypes)) { snippet.SnippetTypes |= snippetTypes; } } } }
public static void Run() { // ExStart:StructureElementsProperties // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); // Create Pdf Document Document document = new Document(); // Get Content for work with TaggedPdf ITaggedContent taggedContent = document.TaggedContent; // Set Title and Language for Documnet taggedContent.SetTitle("Tagged Pdf Document"); taggedContent.SetLanguage("en-US"); // Create Structure Elements StructureElement rootElement = taggedContent.RootElement; SectElement sect = taggedContent.CreateSectElement(); rootElement.AppendChild(sect); HeaderElement h1 = taggedContent.CreateHeaderElement(1); sect.AppendChild(h1); h1.SetText("The Header"); h1.Title = "Title"; h1.Language = "en-US"; h1.AlternativeText = "Alternative Text"; h1.ExpansionText = "Expansion Text"; h1.ActualText = "Actual Text"; // Save Tagged Pdf Document document.Save(dataDir + "StructureElementsProperties.pdf"); // ExEnd:StructureElementsProperties }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as GroupComponent; if (dest != null) { base.CopyTo(dest); if (Name != null) { dest.Name = (Hl7.Fhir.Model.CodeableConcept)Name.DeepCopy(); } if (HeaderElement != null) { dest.HeaderElement = (Hl7.Fhir.Model.FhirString)HeaderElement.DeepCopy(); } if (TextElement != null) { dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopy(); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (Group != null) { dest.Group = new List <Hl7.Fhir.Model.Questionnaire.GroupComponent>(Group.DeepCopy()); } if (Question != null) { dest.Question = new List <Hl7.Fhir.Model.Questionnaire.QuestionComponent>(Question.DeepCopy()); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
protected abstract void Render(HeaderElement element);
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Subscription; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (NameElement != null) { dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy(); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.SubscriptionState>)StatusElement.DeepCopy(); } if (Topic != null) { dest.Topic = (Hl7.Fhir.Model.ResourceReference)Topic.DeepCopy(); } if (Contact != null) { dest.Contact = new List <Hl7.Fhir.Model.ContactPoint>(Contact.DeepCopy()); } if (EndElement != null) { dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopy(); } if (ReasonElement != null) { dest.ReasonElement = (Hl7.Fhir.Model.FhirString)ReasonElement.DeepCopy(); } if (FilterBy != null) { dest.FilterBy = new List <Hl7.Fhir.Model.Subscription.FilterByComponent>(FilterBy.DeepCopy()); } if (Error != null) { dest.Error = new List <Hl7.Fhir.Model.CodeableConcept>(Error.DeepCopy()); } if (ChannelType != null) { dest.ChannelType = (Hl7.Fhir.Model.Coding)ChannelType.DeepCopy(); } if (EndpointElement != null) { dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)EndpointElement.DeepCopy(); } if (HeaderElement != null) { dest.HeaderElement = new List <Hl7.Fhir.Model.FhirString>(HeaderElement.DeepCopy()); } if (HeartbeatPeriodElement != null) { dest.HeartbeatPeriodElement = (Hl7.Fhir.Model.UnsignedInt)HeartbeatPeriodElement.DeepCopy(); } if (TimeoutElement != null) { dest.TimeoutElement = (Hl7.Fhir.Model.UnsignedInt)TimeoutElement.DeepCopy(); } if (ContentTypeElement != null) { dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopy(); } if (ContentElement != null) { dest.ContentElement = (Code <Hl7.Fhir.Model.Subscription.SubscriptionPayloadContent>)ContentElement.DeepCopy(); } return(dest); }
public void Add(HeaderElement entity) { Context.HeaderElementSet.AddObject(entity); }
public void Head(_GithubMarkdown_Memo _memo, int _index, _GithubMarkdown_Args _args) { _GithubMarkdown_Item symbol = null; _GithubMarkdown_Item text = null; // AND 1 int _start_i1 = _index; // CALLORVAR HeadSymbol _GithubMarkdown_Item _r3; _r3 = _MemoCall(_memo, "HeadSymbol", _index, HeadSymbol, null); if (_r3 != null) { _index = _r3.NextIndex; } // BIND symbol symbol = _memo.Results.Peek(); // AND shortcut if (_memo.Results.Peek() == null) { _memo.Results.Push(null); goto label1; } // CALLORVAR HeadText _GithubMarkdown_Item _r5; _r5 = _MemoCall(_memo, "HeadText", _index, HeadText, null); if (_r5 != null) { _index = _r5.NextIndex; } // BIND text text = _memo.Results.Peek(); label1: // AND var _r1_2 = _memo.Results.Pop(); var _r1_1 = _memo.Results.Pop(); if (_r1_1 != null && _r1_2 != null) { _memo.Results.Push(new _GithubMarkdown_Item(_start_i1, _index, _memo.InputEnumerable, _r1_1.Results.Concat(_r1_2.Results).Where(_NON_NULL), true)); } else { _memo.Results.Push(null); _index = _start_i1; } // ACT var _r0 = _memo.Results.Peek(); if (_r0 != null) { _memo.Results.Pop(); _memo.Results.Push(new _GithubMarkdown_Item(_r0.StartIndex, _r0.NextIndex, _memo.InputEnumerable, _Thunk(_IM_Result => { HeaderElement head = new HeaderElement(); head.Size = symbol.Results.First().TextContent.Length; head.TextContent = text.Results.First().TextContent; //remove the tailing # head.TextContent = head.TextContent.TrimEnd('#'); return(head); }, _r0), true)); } }
/// <summary>Formats a header element.</summary> /// <remarks>Formats a header element.</remarks> /// <param name="elem">the header element to format</param> /// <param name="quote"> /// <code>true</code> to always format with quoted values, /// <code>false</code> to use quotes only when necessary /// </param> /// <param name="formatter"> /// the formatter to use, or <code>null</code> /// for the /// <see cref="Instance">default</see> /// </param> /// <returns>the formatted header element</returns> public static string FormatHeaderElement(HeaderElement elem, bool quote, HeaderValueFormatter formatter) { return((formatter != null ? formatter : Org.Apache.Http.Message.BasicHeaderValueFormatter .Instance).FormatHeaderElement(null, elem, quote).ToString()); }
// non-javadoc, see interface HeaderValueFormatter public virtual CharArrayBuffer FormatHeaderElement(CharArrayBuffer charBuffer, HeaderElement elem, bool quote) { Args.NotNull(elem, "Header element"); int len = EstimateHeaderElementLen(elem); CharArrayBuffer buffer = charBuffer; if (buffer == null) { buffer = new CharArrayBuffer(len); } else { buffer.EnsureCapacity(len); } buffer.Append(elem.GetName()); string value = elem.GetValue(); if (value != null) { buffer.Append('='); DoFormatValue(buffer, value, quote); } int parcnt = elem.GetParameterCount(); if (parcnt > 0) { for (int i = 0; i < parcnt; i++) { buffer.Append("; "); FormatNameValuePair(buffer, elem.GetParameter(i), quote); } } return(buffer); }
public static void Run() { // ExStart:InlineStructureElements // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments(); // Create Pdf Document Document document = new Document(); // Get Content for work with TaggedPdf ITaggedContent taggedContent = document.TaggedContent; // Set Title and Language for Documnet taggedContent.SetTitle("Tagged Pdf Document"); taggedContent.SetLanguage("en-US"); // Get Root Structure Element StructureElement rootElement = taggedContent.RootElement; HeaderElement h1 = taggedContent.CreateHeaderElement(1); HeaderElement h2 = taggedContent.CreateHeaderElement(2); HeaderElement h3 = taggedContent.CreateHeaderElement(3); HeaderElement h4 = taggedContent.CreateHeaderElement(4); HeaderElement h5 = taggedContent.CreateHeaderElement(5); HeaderElement h6 = taggedContent.CreateHeaderElement(6); rootElement.AppendChild(h1); rootElement.AppendChild(h2); rootElement.AppendChild(h3); rootElement.AppendChild(h4); rootElement.AppendChild(h5); rootElement.AppendChild(h6); SpanElement spanH11 = taggedContent.CreateSpanElement(); spanH11.SetText("H1. "); h1.AppendChild(spanH11); SpanElement spanH12 = taggedContent.CreateSpanElement(); spanH12.SetText("Level 1 Header"); h1.AppendChild(spanH12); SpanElement spanH21 = taggedContent.CreateSpanElement(); spanH21.SetText("H2. "); h2.AppendChild(spanH21); SpanElement spanH22 = taggedContent.CreateSpanElement(); spanH22.SetText("Level 2 Header"); h2.AppendChild(spanH22); SpanElement spanH31 = taggedContent.CreateSpanElement(); spanH31.SetText("H3. "); h3.AppendChild(spanH31); SpanElement spanH32 = taggedContent.CreateSpanElement(); spanH32.SetText("Level 3 Header"); h3.AppendChild(spanH32); SpanElement spanH41 = taggedContent.CreateSpanElement(); spanH41.SetText("H4. "); h4.AppendChild(spanH41); SpanElement spanH42 = taggedContent.CreateSpanElement(); spanH42.SetText("Level 4 Header"); h4.AppendChild(spanH42); SpanElement spanH51 = taggedContent.CreateSpanElement(); spanH51.SetText("H5. "); h5.AppendChild(spanH51); SpanElement spanH52 = taggedContent.CreateSpanElement(); spanH52.SetText("Level 5 Header"); h5.AppendChild(spanH52); SpanElement spanH61 = taggedContent.CreateSpanElement(); spanH61.SetText("H6. "); h6.AppendChild(spanH61); SpanElement spanH62 = taggedContent.CreateSpanElement(); spanH62.SetText("Level 6 Header"); h6.AppendChild(spanH62); ParagraphElement p = taggedContent.CreateParagraphElement(); p.SetText("P. "); rootElement.AppendChild(p); SpanElement span1 = taggedContent.CreateSpanElement(); span1.SetText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. "); p.AppendChild(span1); SpanElement span2 = taggedContent.CreateSpanElement(); span2.SetText("Aenean nec lectus ac sem faucibus imperdiet. "); p.AppendChild(span2); SpanElement span3 = taggedContent.CreateSpanElement(); span3.SetText("Sed ut erat ac magna ullamcorper hendrerit. "); p.AppendChild(span3); SpanElement span4 = taggedContent.CreateSpanElement(); span4.SetText("Cras pellentesque libero semper, gravida magna sed, luctus leo. "); p.AppendChild(span4); SpanElement span5 = taggedContent.CreateSpanElement(); span5.SetText("Fusce lectus odio, laoreet nec ullamcorper ut, molestie eu elit. "); p.AppendChild(span5); SpanElement span6 = taggedContent.CreateSpanElement(); span6.SetText("Interdum et malesuada fames ac ante ipsum primis in faucibus. "); p.AppendChild(span6); SpanElement span7 = taggedContent.CreateSpanElement(); span7.SetText("Aliquam lacinia sit amet elit ac consectetur. Donec cursus condimentum ligula, vitae volutpat sem tristique eget. "); p.AppendChild(span7); SpanElement span8 = taggedContent.CreateSpanElement(); span8.SetText("Nulla in consectetur massa. Vestibulum vitae lobortis ante. Nulla ullamcorper pellentesque justo rhoncus accumsan. "); p.AppendChild(span8); SpanElement span9 = taggedContent.CreateSpanElement(); span9.SetText("Mauris ornare eu odio non lacinia. Aliquam massa leo, rhoncus ac iaculis eget, tempus et magna. Sed non consectetur elit. "); p.AppendChild(span9); SpanElement span10 = taggedContent.CreateSpanElement(); span10.SetText("Sed vulputate, quam sed lacinia luctus, ipsum nibh fringilla purus, vitae posuere risus odio id massa. Cras sed venenatis lacus."); p.AppendChild(span10); // Save Tagged Pdf Document document.Save(dataDir + "InlineStructureElements.pdf"); // ExEnd:InlineStructureElements }