Namespaces and their Assemblies

Scryber relies on the xml namespaces (xmlns) to identify the classes it should use when parsing an XML or XHTML file. This is based on a mapping of xmlns value to a fully qualified assembly name and namespace.

Declared Namespaces

The 3 base namespaces that are automatically added are:

The html and svg namespaces are also automatically added.

    • The html components used in scryber. e.g. div, span, section etc.
    • It refers to the Scryber.Html.Components namespace in the Scryber.Components assembly (Version=, Culture=neutral, PublicKeyToken=872cbeb81db952fe)
    • The svg drawing components used in scryber. e.g. ellipse, circle, rect etc.
    • It refers to the Scryber.Svg.Components namespace in the Scryber.Components assembly (Version=, Culture=neutral, PublicKeyToken=872cbeb81db952fe)


If a file or stream of content does not have a namespace, then the classes cannot be found and therefore parsed.

Class attributes

Within the assembly namespaces, referred to above, are actual classes decorated with attributes for each of their properties and contents.

namespace Scryber.Html.Components
    public class HTMLBody : Scryber.Components.Section

        public override string StyleClass
            get => base.StyleClass;
            set => base.StyleClass = value;

        public override Style Style
            get => base.Style;
            set => base.Style = value;

        public override ComponentList Contents
            get { return base.Contents; }

        [PDFTemplate(IsBlock= true)]
        public override IPDFTemplate Header
            get => base.Header;
            set => base.Header = value;

        [PDFTemplate(IsBlock = true)]
        public override IPDFTemplate Footer
            get => base.Footer;
            set => base.Footer = value;

        public string Hidden
            get { return (this.Visible) ? string.Empty : "hidden" }
            set { this.Visible = (string.IsNullOrEmpty(value) || value != "hidden") ? true : false; }

        public override string OutlineTitle
            get => base.OutlineTitle;
            set => base.OutlineTitle = value;

        public HTMLBody()
            : base()

Here we can see the html body class decorated with the PDFParsableComponent attribute, so the parser know when it gets to a <body> tag in the content stream in namespace Scryber.Html.Components it create an instance of the HTMLBody class.

The class inherits from the Scryber.Components.Section (an overflowing page), and overrides some of the base functionality to support the standard html attributes. For example the [PDFAttribute(“class”)] maps the @class attribute in the content stream to the StyleClass string property in the instance.

The explicitly named [PDFElement(“head”)] if found will be assigned to the Header property, in this case as a template so it can be used multiple times (See Dynamic content in your template)

Finally the empty PDFElement attribute with the PDFArray attribute tells the parser it should expect inner child components (that are not nested within another element) of type Component, and they should be added to this collection.


Scryber has an explicit parser, rather than implicit. So if classes or properties are not decorated, then they will not be used.

Parsing the content

Considerring the below content we can see the namespace mapping to the classes

<html xmlns=''>
    <body style='padding:20pt;' title='Top Level' >
        <head><p>This is the header</p><head>
        <p class='main'>This is the content</p>

When parsed this will give us an object graph of the below. The content in the header is kept as a string and will be parsed when used each time.


See Extending Scryber - td to understand how to add your own classes and namespaces.