SvgSpriteBuilderAddSymbol Method

Adds an SVG document as a symbol to current SVG document.

Definition

Namespace: DotMake.SvgSprite
Assembly: DotMake.SvgSprite (in DotMake.SvgSprite.dll) Version: 1.0.0
C#
public XElement AddSymbol(
	SvgDocument svgDocument,
	string symbolId = null,
	SvgSymbolOptions svgSymbolOptions = null
)

Parameters

svgDocument  SvgDocument
The input SVG document to add as a symbol.
symbolId  String  (Optional)
The symbol id. If not specified, existing id attribute will be used. If no existing id attribute, IdForMissing will be used.

The resulting id will be prefixed with IdPrefix if it was set.

The resulting id will be converted to lowercase if IdLowerCased was set.

When there are duplicates, the id will be incremented like "symbol-2", "symbol-3" etc.

The disallowed characters will be replaced with IdReplacementChar if it was set.
SVG uses XML rules for id attributes, so the allowed characters are:

  1. Start Character
    • Must begin with a letter (A–Z, a–z) or underscore (_)
    • Cannot start with a number or hyphen (-)
  2. Subsequent Characters
    • Letters (A–Z, a–z)
    • Digits (0–9)
    • Underscore (_)
    • Hyphen (-)
    • Period (.)

svgSymbolOptions  SvgSymbolOptions  (Optional)
The options to use when converting an <svg> tag to an <symbol> tag or vice versa.

Return Value

XElement
A XElement for the added <symbol> tag.

See Also