package tyxml

  1. Overview
  2. Docs

Signature of typesafe constructors for SVG documents.

type +'a elt

SVG elements.

Element constructors are in section Elements. Most elements constructors are either nullary, unary or star, depending on the number of children they accept. Children are usually given as a list of elements. pcdata is used for text.

The type variable 'a is used to track the element's type. This allows the OCaml typechecker to check SVG validity.

Note that the concrete implementation of this type can vary. See Xml for details.

type doc = [ `Svg ] elt

A complete SVG document.

type +'a attrib

SVG attributes

Attribute constructors are in section Attributes and their name starts with a_. Attributes are given to elements with the ~a optional argument.

Similarly to elt, attributes use the OCaml type system to enforce Html validity.

In some cases, attributes have to be disambiguated. The max attribute has two version, a_fill and a_animation_fill, depending on the element. Such disambiguated attribute will contain the name of the associated element.

module Xml : Xml_sigs.T

Underlying XML data-structure

type 'a wrap = 'a Xml.W.t

wrap is a container for elements and values.

In most cases, 'a wrap = 'a. For R modules (in eliom or js_of_ocaml), It will be React.S.t.

type 'a list_wrap = 'a Xml.W.tlist

list_wrap is a containre for list of elements.

In most cases, 'a list_wrap = 'a list. For R modules (in eliom or js_of_ocaml), It will be ReactiveData.RList.t.

type ('a, 'b) nullary = ?a:'a attrib list -> unit -> 'b elt

A nullary element is an element that doesn't have any children.

type ('a, 'b, 'c) unary = ?a:'a attrib list -> 'b elt wrap -> 'c elt

A unary element is an element that have exactly one children.

type ('a, 'b, 'c) star = ?a:'a attrib list -> 'b elt list_wrap -> 'c elt

A star element is an element that has any number of children, including zero.

Various information about SVG, such as the doctype, ...

Uri

type uri = Xml.uri
val string_of_uri : (uri, string) Xml.W.ft
val uri_of_string : (string, uri) Xml.W.ft

Attributes

val a_version : string wrap -> [> `Version ] attrib
  • deprecated

    Removed in SVG2

val a_baseProfile : string wrap -> [> `BaseProfile ] attrib
  • deprecated

    Removed in SVG2

val a_x : Svg_types.coord wrap -> [> `X ] attrib
val a_y : Svg_types.coord wrap -> [> `Y ] attrib
val a_width : Svg_types.Unit.length wrap -> [> `Width ] attrib
val a_height : Svg_types.Unit.length wrap -> [> `Height ] attrib
val a_preserveAspectRatio : string wrap -> [> `PreserveAspectRatio ] attrib
val a_contentScriptType : string wrap -> [> `ContentScriptType ] attrib
  • deprecated

    Removed in SVG2

val a_contentStyleType : string wrap -> [> `ContentStyleType ] attrib
  • deprecated

    Removed in SVG2

val a_zoomAndPan : [< `Disable | `Magnify ] wrap -> [> `ZoomAndSpan ] attrib
val a_href : Svg_types.iri wrap -> [> `Xlink_href ] attrib
  • deprecated

    Use a_href

val a_requiredFeatures : Svg_types.spacestrings wrap -> [> `RequiredFeatures ] attrib
  • deprecated

    Removed in SVG2

val a_requiredExtensions : Svg_types.spacestrings wrap -> [> `RequiredExtension ] attrib
val a_systemLanguage : Svg_types.commastrings wrap -> [> `SystemLanguage ] attrib
val a_externalRessourcesRequired : bool wrap -> [> `ExternalRessourcesRequired ] attrib
val a_id : string wrap -> [> `Id ] attrib
val a_xml_base : Svg_types.iri wrap -> [> `Xml_Base ] attrib
  • deprecated

    Removed in SVG2

val a_xml_lang : Svg_types.iri wrap -> [> `Xml_Lang ] attrib
val a_xml_space : [< `Default | `Preserve ] wrap -> [> `Xml_Space ] attrib
  • deprecated

    Use CSS white-space

val a_type : string wrap -> [> `Type ] attrib
val a_media : Svg_types.commastrings wrap -> [> `Media ] attrib
  • deprecated

    Use a child title element

val a_class : Svg_types.spacestrings wrap -> [> `Class ] attrib
val a_style : string wrap -> [> `Style ] attrib
val a_transform : Svg_types.transforms wrap -> [> `Transform ] attrib
val a_viewBox : Svg_types.fourfloats wrap -> [> `ViewBox ] attrib
val a_d : string wrap -> [> `D ] attrib
val a_pathLength : float wrap -> [> `PathLength ] attrib
val a_rx : Svg_types.Unit.length wrap -> [> `Rx ] attrib
val a_ry : Svg_types.Unit.length wrap -> [> `Ry ] attrib
val a_cx : Svg_types.Unit.length wrap -> [> `Cx ] attrib
val a_cy : Svg_types.Unit.length wrap -> [> `Cy ] attrib
val a_r : Svg_types.Unit.length wrap -> [> `R ] attrib
val a_x1 : Svg_types.coord wrap -> [> `X1 ] attrib
val a_y1 : Svg_types.coord wrap -> [> `Y1 ] attrib
val a_x2 : Svg_types.coord wrap -> [> `X2 ] attrib
val a_y2 : Svg_types.coord wrap -> [> `Y2 ] attrib
val a_points : Svg_types.coords wrap -> [> `Points ] attrib
val a_x_list : Svg_types.lengths wrap -> [> `X_list ] attrib
val a_y_list : Svg_types.lengths wrap -> [> `Y_list ] attrib
val a_dx : Svg_types.number wrap -> [> `Dx ] attrib
val a_dy : Svg_types.number wrap -> [> `Dy ] attrib
val a_dx_list : Svg_types.lengths wrap -> [> `Dx_list ] attrib
val a_dy_list : Svg_types.lengths wrap -> [> `Dy_list ] attrib
val a_lengthAdjust : [< `Spacing | `SpacingAndGlyphs ] wrap -> [> `LengthAdjust ] attrib
val a_textLength : Svg_types.Unit.length wrap -> [> `TextLength ] attrib
val a_text_anchor : [< `Start | `Middle | `End | `Inherit ] wrap -> [> `Text_Anchor ] attrib
val a_text_decoration : [< `None | `Underline | `Overline | `Line_through | `Blink | `Inherit ] wrap -> [> `Text_Decoration ] attrib
val a_text_rendering : [< `Auto | `OptimizeSpeed | `OptimizeLegibility | `GeometricPrecision | `Inherit ] wrap -> [> `Text_Rendering ] attrib
val a_rotate : Svg_types.numbers wrap -> [> `Rotate ] attrib
val a_startOffset : Svg_types.Unit.length wrap -> [> `StartOffset ] attrib
val a_method : [< `Align | `Stretch ] wrap -> [> `Method ] attrib
val a_spacing : [< `Auto | `Exact ] wrap -> [> `Spacing ] attrib
val a_glyphRef : string wrap -> [> `GlyphRef ] attrib
val a_format : string wrap -> [> `Format ] attrib
val a_markerUnits : [< `StrokeWidth | `UserSpaceOnUse ] wrap -> [> `MarkerUnits ] attrib
val a_refX : Svg_types.coord wrap -> [> `RefX ] attrib
val a_refY : Svg_types.coord wrap -> [> `RefY ] attrib
val a_markerWidth : Svg_types.Unit.length wrap -> [> `MarkerWidth ] attrib
val a_markerHeight : Svg_types.Unit.length wrap -> [> `MarkerHeight ] attrib
val a_orient : Svg_types.Unit.angle option wrap -> [> `Orient ] attrib
val a_local : string wrap -> [> `Local ] attrib
val a_rendering_intent : [< `Auto | `Perceptual | `Relative_colorimetric | `Saturation | `Absolute_colorimetric ] wrap -> [> `Rendering_Indent ] attrib
val a_gradientUnits : [< `UserSpaceOnUse | `ObjectBoundingBox ] wrap -> [ `GradientUnits ] attrib
val a_gradientTransform : Svg_types.transforms wrap -> [> `Gradient_Transform ] attrib
val a_spreadMethod : [< `Pad | `Reflect | `Repeat ] wrap -> [> `SpreadMethod ] attrib
val a_fx : Svg_types.coord wrap -> [> `Fx ] attrib
val a_fy : Svg_types.coord wrap -> [> `Fy ] attrib
val a_offset : [< `Number of Svg_types.number | `Percentage of Svg_types.percentage ] wrap -> [> `Offset ] attrib
val a_patternUnits : [< `UserSpaceOnUse | `ObjectBoundingBox ] wrap -> [> `PatternUnits ] attrib
val a_patternContentUnits : [< `UserSpaceOnUse | `ObjectBoundingBox ] wrap -> [> `PatternContentUnits ] attrib
val a_patternTransform : Svg_types.transforms wrap -> [> `PatternTransform ] attrib
val a_clipPathUnits : [< `UserSpaceOnUse | `ObjectBoundingBox ] wrap -> [> `ClipPathUnits ] attrib
val a_maskUnits : [< `UserSpaceOnUse | `ObjectBoundingBox ] wrap -> [> `MaskUnits ] attrib
val a_maskContentUnits : [< `UserSpaceOnUse | `ObjectBoundingBox ] wrap -> [> `MaskContentUnits ] attrib
val a_primitiveUnits : [< `UserSpaceOnUse | `ObjectBoundingBox ] wrap -> [> `PrimitiveUnits ] attrib
val a_filterRes : Svg_types.number_optional_number wrap -> [> `FilterResUnits ] attrib
val a_result : string wrap -> [> `Result ] attrib
val a_in : [< `SourceGraphic | `SourceAlpha | `BackgroundImage | `BackgroundAlpha | `FillPaint | `StrokePaint | `Ref of string ] wrap -> [> `In ] attrib
val a_in2 : [< `SourceGraphic | `SourceAlpha | `BackgroundImage | `BackgroundAlpha | `FillPaint | `StrokePaint | `Ref of string ] wrap -> [> `In2 ] attrib
val a_azimuth : float wrap -> [> `Azimuth ] attrib
val a_elevation : float wrap -> [> `Elevation ] attrib
val a_pointsAtX : float wrap -> [> `PointsAtX ] attrib
val a_pointsAtY : float wrap -> [> `PointsAtY ] attrib
val a_pointsAtZ : float wrap -> [> `PointsAtZ ] attrib
val a_specularExponent : float wrap -> [> `SpecularExponent ] attrib
val a_specularConstant : float wrap -> [> `SpecularConstant ] attrib
val a_limitingConeAngle : float wrap -> [> `LimitingConeAngle ] attrib
val a_mode : [< `Normal | `Multiply | `Screen | `Darken | `Lighten ] wrap -> [> `Mode ] attrib
val a_feColorMatrix_type : [< `Matrix | `Saturate | `HueRotate | `LuminanceToAlpha ] wrap -> [> `Typefecolor ] attrib
val a_values : Svg_types.numbers wrap -> [> `Values ] attrib
val a_transfer_type : [< `Identity | `Table | `Discrete | `Linear | `Gamma ] wrap -> [> `Type_transfert ] attrib
val a_tableValues : Svg_types.numbers wrap -> [> `TableValues ] attrib
val a_intercept : Svg_types.number wrap -> [> `Intercept ] attrib
val a_amplitude : Svg_types.number wrap -> [> `Amplitude ] attrib
val a_exponent : Svg_types.number wrap -> [> `Exponent ] attrib
val a_transfer_offset : Svg_types.number wrap -> [> `Offset_transfer ] attrib
val a_feComposite_operator : [< `Over | `In | `Out | `Atop | `Xor | `Arithmetic ] wrap -> [> `OperatorComposite ] attrib
val a_k1 : Svg_types.number wrap -> [> `K1 ] attrib
val a_k2 : Svg_types.number wrap -> [> `K2 ] attrib
val a_k3 : Svg_types.number wrap -> [> `K3 ] attrib
val a_k4 : Svg_types.number wrap -> [> `K4 ] attrib
val a_order : Svg_types.number_optional_number wrap -> [> `Order ] attrib
val a_kernelMatrix : Svg_types.numbers wrap -> [> `KernelMatrix ] attrib
val a_divisor : Svg_types.number wrap -> [> `Divisor ] attrib
val a_bias : Svg_types.number wrap -> [> `Bias ] attrib
val a_kernelUnitLength : Svg_types.number_optional_number wrap -> [> `KernelUnitLength ] attrib
val a_targetX : int wrap -> [> `TargetX ] attrib
val a_targetY : int wrap -> [> `TargetY ] attrib
val a_edgeMode : [< `Duplicate | `Wrap | `None ] wrap -> [> `TargetY ] attrib
val a_preserveAlpha : bool wrap -> [> `TargetY ] attrib
val a_surfaceScale : Svg_types.number wrap -> [> `SurfaceScale ] attrib
val a_diffuseConstant : Svg_types.number wrap -> [> `DiffuseConstant ] attrib
val a_scale : Svg_types.number wrap -> [> `Scale ] attrib
val a_xChannelSelector : [< `R | `G | `B | `A ] wrap -> [> `XChannelSelector ] attrib
val a_yChannelSelector : [< `R | `G | `B | `A ] wrap -> [> `YChannelSelector ] attrib
val a_stdDeviation : Svg_types.number_optional_number wrap -> [> `StdDeviation ] attrib
val a_feMorphology_operator : [< `Erode | `Dilate ] wrap -> [> `OperatorMorphology ] attrib
val a_radius : Svg_types.number_optional_number wrap -> [> `Radius ] attrib
val a_baseFrenquency : Svg_types.number_optional_number wrap -> [> `BaseFrequency ] attrib
val a_numOctaves : int wrap -> [> `NumOctaves ] attrib
val a_seed : Svg_types.number wrap -> [> `Seed ] attrib
val a_stitchTiles : [< `Stitch | `NoStitch ] wrap -> [> `StitchTiles ] attrib
val a_feTurbulence_type : [< `FractalNoise | `Turbulence ] wrap -> [> `TypeStitch ] attrib
  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

val a_target : string wrap -> [> `Xlink_target ] attrib
val a_viewTarget : string wrap -> [> `ViewTarget ] attrib
  • deprecated

    Removed in SVG2

val a_attributeName : string wrap -> [> `AttributeName ] attrib
val a_attributeType : [< `CSS | `XML | `Auto ] wrap -> [> `AttributeType ] attrib
val a_begin : string wrap -> [> `Begin ] attrib
val a_dur : string wrap -> [> `Dur ] attrib
val a_min : string wrap -> [> `Min ] attrib
val a_max : string wrap -> [> `Max ] attrib
val a_restart : [< `Always | `WhenNotActive | `Never ] wrap -> [> `Restart ] attrib
val a_repeatCount : string wrap -> [> `RepeatCount ] attrib
val a_repeatDur : string wrap -> [> `RepeatDur ] attrib
val a_fill : Svg_types.paint wrap -> [> `Fill ] attrib
val a_animation_fill : [< `Freeze | `Remove ] wrap -> [> `Fill_Animation ] attrib
val a_calcMode : [< `Discrete | `Linear | `Paced | `Spline ] wrap -> [> `CalcMode ] attrib
val a_animation_values : Svg_types.strings wrap -> [> `Valuesanim ] attrib
val a_keyTimes : Svg_types.strings wrap -> [> `KeyTimes ] attrib
val a_keySplines : Svg_types.strings wrap -> [> `KeySplines ] attrib
val a_from : string wrap -> [> `From ] attrib
val a_to : string wrap -> [> `To ] attrib
val a_by : string wrap -> [> `By ] attrib
val a_additive : [< `Replace | `Sum ] wrap -> [> `Additive ] attrib
val a_accumulate : [< `None | `Sum ] wrap -> [> `Accumulate ] attrib
val a_keyPoints : Svg_types.numbers_semicolon wrap -> [> `KeyPoints ] attrib
val a_path : string wrap -> [> `Path ] attrib
val a_animateTransform_type : [ `Translate | `Scale | `Rotate | `SkewX | `SkewY ] wrap -> [ `Typeanimatetransform ] attrib
val a_horiz_origin_x : Svg_types.number wrap -> [> `HorizOriginX ] attrib
val a_horiz_origin_y : Svg_types.number wrap -> [> `HorizOriginY ] attrib
val a_horiz_adv_x : Svg_types.number wrap -> [> `HorizAdvX ] attrib
val a_vert_origin_x : Svg_types.number wrap -> [> `VertOriginX ] attrib
val a_vert_origin_y : Svg_types.number wrap -> [> `VertOriginY ] attrib
val a_vert_adv_y : Svg_types.number wrap -> [> `VertAdvY ] attrib
val a_unicode : string wrap -> [> `Unicode ] attrib
val a_glyph_name : string wrap -> [> `glyphname ] attrib
val a_orientation : [< `H | `V ] wrap -> [> `Orientation ] attrib
val a_arabic_form : [< `Initial | `Medial | `Terminal | `Isolated ] wrap -> [> `Arabicform ] attrib
val a_lang : string wrap -> [> `Lang ] attrib
val a_u1 : string wrap -> [> `U1 ] attrib
val a_u2 : string wrap -> [> `U2 ] attrib
val a_g1 : string wrap -> [> `G1 ] attrib
val a_g2 : string wrap -> [> `G2 ] attrib
val a_k : string wrap -> [> `K ] attrib
val a_font_family : string wrap -> [> `Font_Family ] attrib
val a_font_style : string wrap -> [> `Font_Style ] attrib
val a_font_variant : string wrap -> [> `Font_Variant ] attrib
val a_font_weight : string wrap -> [> `Font_Weight ] attrib
val a_font_stretch : string wrap -> [> `Font_Stretch ] attrib
val a_font_size : string wrap -> [> `Font_Size ] attrib
val a_unicode_range : string wrap -> [> `UnicodeRange ] attrib
val a_units_per_em : string wrap -> [> `UnitsPerEm ] attrib
val a_stemv : Svg_types.number wrap -> [> `Stemv ] attrib
val a_stemh : Svg_types.number wrap -> [> `Stemh ] attrib
val a_slope : Svg_types.number wrap -> [> `Slope ] attrib
val a_cap_height : Svg_types.number wrap -> [> `CapHeight ] attrib
val a_x_height : Svg_types.number wrap -> [> `XHeight ] attrib
val a_accent_height : Svg_types.number wrap -> [> `AccentHeight ] attrib
val a_ascent : Svg_types.number wrap -> [> `Ascent ] attrib
val a_widths : string wrap -> [> `Widths ] attrib
val a_bbox : string wrap -> [> `Bbox ] attrib
val a_ideographic : Svg_types.number wrap -> [> `Ideographic ] attrib
val a_alphabetic : Svg_types.number wrap -> [> `Alphabetic ] attrib
val a_mathematical : Svg_types.number wrap -> [> `Mathematical ] attrib
val a_hanging : Svg_types.number wrap -> [> `Hanging ] attrib
val a_videographic : Svg_types.number wrap -> [> `VIdeographic ] attrib
val a_v_alphabetic : Svg_types.number wrap -> [> `VAlphabetic ] attrib
val a_v_mathematical : Svg_types.number wrap -> [> `VMathematical ] attrib
val a_v_hanging : Svg_types.number wrap -> [> `VHanging ] attrib
val a_underline_position : Svg_types.number wrap -> [> `UnderlinePosition ] attrib
val a_underline_thickness : Svg_types.number wrap -> [> `UnderlineThickness ] attrib
val a_strikethrough_position : Svg_types.number wrap -> [> `StrikethroughPosition ] attrib
val a_strikethrough_thickness : Svg_types.number wrap -> [> `StrikethroughThickness ] attrib
val a_overline_position : Svg_types.number wrap -> [> `OverlinePosition ] attrib
val a_overline_thickness : Svg_types.number wrap -> [> `OverlineThickness ] attrib
val a_string : string wrap -> [> `String ] attrib
val a_name : string wrap -> [> `Name ] attrib
val a_alignment_baseline : [< `Auto | `Baseline | `Before_edge | `Text_before_edge | `Middle | `Central | `After_edge | `Text_after_edge | `Ideographic | `Alphabetic | `Hanging | `Mathematical | `Inherit ] wrap -> [> `Alignment_Baseline ] attrib
val a_dominant_baseline : [< `Auto | `Use_script | `No_change | `Reset_size | `Ideographic | `Alphabetic | `Hanging | `Mathematical | `Central | `Middle | `Text_after_edge | `Text_before_edge | `Inherit ] wrap -> [> `Dominant_Baseline ] attrib
val a_stop_color : Svg_types.color wrap -> [> `Stop_Color ] attrib
val a_stop_opacity : Svg_types.number wrap -> [> `Stop_Opacity ] attrib
val a_stroke : Svg_types.paint wrap -> [> `Stroke ] attrib
val a_stroke_width : Svg_types.Unit.length wrap -> [> `Stroke_Width ] attrib
val a_stroke_linecap : [< `Butt | `Round | `Square ] wrap -> [> `Stroke_Linecap ] attrib
val a_stroke_linejoin : [< `Miter | `Round | `Bever ] wrap -> [> `Stroke_Linejoin ] attrib
val a_stroke_miterlimit : float wrap -> [> `Stroke_Miterlimit ] attrib
val a_stroke_dasharray : Svg_types.Unit.length list wrap -> [> `Stroke_Dasharray ] attrib
val a_stroke_dashoffset : Svg_types.Unit.length wrap -> [> `Stroke_Dashoffset ] attrib
val a_stroke_opacity : float wrap -> [> `Stroke_Opacity ] attrib

Events

Javascript events

val a_onabort : Xml.event_handler -> [> `OnAbort ] attrib
val a_onactivate : Xml.event_handler -> [> `OnActivate ] attrib
val a_onbegin : Xml.event_handler -> [> `OnBegin ] attrib
val a_onend : Xml.event_handler -> [> `OnEnd ] attrib
val a_onerror : Xml.event_handler -> [> `OnError ] attrib
val a_onfocusin : Xml.event_handler -> [> `OnFocusIn ] attrib
val a_onfocusout : Xml.event_handler -> [> `OnFocusOut ] attrib
val a_onload : Xml.event_handler -> [> `OnLoad ] attrib
  • deprecated

    Removed in SVG2

val a_onrepeat : Xml.event_handler -> [> `OnRepeat ] attrib
val a_onresize : Xml.event_handler -> [> `OnResize ] attrib
val a_onscroll : Xml.event_handler -> [> `OnScroll ] attrib
val a_onunload : Xml.event_handler -> [> `OnUnload ] attrib
val a_onzoom : Xml.event_handler -> [> `OnZoom ] attrib

Javascript mouse events

val a_onclick : Xml.mouse_event_handler -> [> `OnClick ] attrib
val a_onmousedown : Xml.mouse_event_handler -> [> `OnMouseDown ] attrib
val a_onmouseup : Xml.mouse_event_handler -> [> `OnMouseUp ] attrib
val a_onmouseover : Xml.mouse_event_handler -> [> `OnMouseOver ] attrib
val a_onmouseout : Xml.mouse_event_handler -> [> `OnMouseOut ] attrib
val a_onmousemove : Xml.mouse_event_handler -> [> `OnMouseMove ] attrib

Elements

val pcdata : string wrap -> [> `PCDATA ] elt
  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

type altglyphdef_content = [
  1. | `Ref of Svg_types.glyphref elt list
  2. | `Item of Svg_types.altglyphitem elt list
]
  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

  • deprecated

    Removed in SVG2

Conversion with untyped representation

val tot : Xml.elt -> 'a elt
val totl : Xml.elt list_wrap -> 'a elt list_wrap
val toelt : 'a elt -> Xml.elt
val toeltl : 'a elt list_wrap -> Xml.elt list_wrap
val doc_toelt : doc -> Xml.elt
val to_xmlattribs : 'a attrib list -> Xml.attrib list
val to_attrib : Xml.attrib -> 'a attrib
module Unsafe : sig ... end

Unsafe features.

OCaml

Innovation. Community. Security.