Class SVGDocument
Namespace: Aspose.Html.Dom.Svg
Assembly: Aspose.HTML.dll (25.2.0)
An SVGDocument
is the root of the SVG hierarchy and holds the entire content. Besides providing access to the hierarchy, it also provides some convenience methods for accessing certain sets of information from the document.
When an ‘svg’ element is embedded inline as a component of a document from another namespace, such as when an ‘svg’ element is embedded inline within an XHTML document [XHTML], then an SVGDocument object will not exist; instead, the root object in the document object hierarchy will be a Document object of a different type, such as an HTMLDocument object.
However, an SVGDocument object will indeed exist when the root element of the XML document hierarchy is an ‘svg’ element, such as when viewing a stand-alone SVG file(i.e., a file with MIME type “image/svg+xml”). In this case, the SVGDocument object will be the root object of the document object model hierarchy.
[DOMObject]
[ComVisible(true)]
[DOMName("SVGDocument")]
public class SVGDocument : Document, INotifyPropertyChanged, IEventTarget, IDisposable, IXPathNSResolver, IDocumentTraversal, IXPathEvaluator, IParentNode, IElementTraversal, INonElementParentNode, IGlobalEventHandlers, IDocumentEvent, IDocumentCSS, IDocumentStyle
Inheritance
object ← DOMObject ← EventTarget ← Node ← Document ← SVGDocument
Implements
INotifyPropertyChanged, IEventTarget, IDisposable, IXPathNSResolver, IDocumentTraversal, IXPathEvaluator, IParentNode, IElementTraversal, INonElementParentNode, IGlobalEventHandlers, IDocumentEvent, IDocumentCSS, IDocumentStyle
Inherited Members
Document.Navigate(string), Document.Navigate(Url), Document.Navigate(string, string), Document.Navigate(string, Url), Document.Navigate(Stream, string), Document.Navigate(Stream, Url), Document.Navigate(RequestMessage), Document.CreateElement(string), Document.CreateElementNS(string, string), Document.CreateDocumentFragment(), Document.CreateTextNode(string), Document.CreateComment(string), Document.CreateCDATASection(string), Document.CreateProcessingInstruction(string, string), Document.CreateAttribute(string), Document.CreateAttributeNS(string, string), Document.CreateEntityReference(string), Document.CreateDocumentType(string, string, string, string), Document.GetElementsByTagName(string), Document.GetElementsByTagNameNS(string, string), Document.GetElementById(string), Document.GetElementsByClassName(string), Document.CreateNodeIterator(Node), Document.CreateNodeIterator(Node, long), Document.CreateNodeIterator(Node, long, INodeFilter), Document.CreateTreeWalker(Node), Document.CreateTreeWalker(Node, long), Document.CreateTreeWalker(Node, long, INodeFilter), Document.QuerySelectorAll(string), Document.QuerySelector(string), Document.ImportNode(Node, bool), Document.CreateEvent(string), Document.Write(params string[]), Document.WriteLn(params string[]), Document.CreateExpression(string, IXPathNSResolver), Document.CreateNSResolver(Node), Document.Evaluate(string, Node, IXPathNSResolver, XPathResultType, object), Document.RenderTo(IDevice), Document.Dispose(bool), Document.OwnerDocument, Document.Context, Document.Implementation, Document.Location, Document.DocumentURI, Document.Origin, Document.BaseURI, Document.NodeName, Document.NodeType, Document.CharacterSet, Document.Charset, Document.InputEncoding, Document.ContentType, Document.ReadyState, Document.Doctype, Document.DocumentElement, Document.FirstElementChild, Document.LastElementChild, Document.PreviousElementSibling, Document.NextElementSibling, Document.ChildElementCount, Document.Children, Document.XmlStandalone, Document.XmlVersion, Document.StrictErrorChecking, Document.DefaultView, Document.StyleSheets, Document.OnReadyStateChange, Document.OnAbort, Document.OnBlur, Document.OnCancel, Document.OnCanplay, Document.OnCanPlayThrough, Document.OnChange, Document.OnClick, Document.OnCueChange, Document.OnDblClick, Document.OnDurationChange, Document.OnEmptied, Document.OnEnded, Document.OnError, Document.OnFocus, Document.OnInput, Document.OnInvalid, Document.OnKeyDown, Document.OnKeyPress, Document.OnKeyUp, Document.OnLoad, Document.OnLoadedData, Document.OnLoadedMetadata, Document.OnLoadStart, Document.OnMouseDown, Document.OnMouseEnter, Document.OnMouseLeave, Document.OnMouseMove, Document.OnMouseOut, Document.OnMouseOver, Document.OnMouseUp, Document.OnMouseWheel, Document.OnPause, Document.OnPlay, Document.OnPlaying, Document.OnProgress, Document.OnRateChange, Document.OnReset, Document.OnResize, Document.OnScroll, Document.OnSeeked, Document.OnSeeking, Document.OnSelect, Document.OnShow, Document.OnStalled, Document.OnSubmit, Document.OnSuspend, Document.OnTimeUpdate, Document.OnToggle, Document.OnVolumeChange, Document.OnWaiting, Node.ELEMENT_NODE, Node.ATTRIBUTE_NODE, Node.TEXT_NODE, Node.CDATA_SECTION_NODE, Node.ENTITY_REFERENCE_NODE, Node.ENTITY_NODE, Node.PROCESSING_INSTRUCTION_NODE, Node.COMMENT_NODE, Node.DOCUMENT_NODE, Node.DOCUMENT_TYPE_NODE, Node.DOCUMENT_FRAGMENT_NODE, Node.NOTATION_NODE, Node.HasChildNodes(), Node.Normalize(), Node.CloneNode(), Node.CloneNode(bool), Node.IsEqualNode(Node), Node.IsSameNode(Node), Node.LookupPrefix(string), Node.LookupNamespaceURI(string), Node.IsDefaultNamespace(string), Node.InsertBefore(Node, Node), Node.ReplaceChild(Node, Node), Node.RemoveChild(Node), Node.AppendChild(Node), Node.Dispose(bool), Node.ToString(), Node.NodeType, Node.LocalName, Node.NamespaceURI, Node.Prefix, Node.NodeName, Node.BaseURI, Node.OwnerDocument, Node.ParentNode, Node.ParentElement, Node.ChildNodes, Node.FirstChild, Node.LastChild, Node.PreviousSibling, Node.NextSibling, Node.NodeValue, Node.TextContent, EventTarget.AddEventListener(string, DOMEventHandler, bool), EventTarget.AddEventListener(string, IEventListener), EventTarget.AddEventListener(string, IEventListener, bool), EventTarget.RemoveEventListener(string, DOMEventHandler, bool), EventTarget.RemoveEventListener(string, IEventListener), EventTarget.RemoveEventListener(string, IEventListener, bool), EventTarget.DispatchEvent(Event), EventTarget.Dispose(), EventTarget.Dispose(bool), DOMObject.GetPlatformType(), object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
SVGDocument()
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class.
public SVGDocument()
SVGDocument(Configuration)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class.
public SVGDocument(Configuration configuration)
Parameters
configuration
Configuration
The configuration.
SVGDocument(string)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(System.String) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security.
public SVGDocument(string address)
Parameters
address
string
The document address. It will be combined with the current directory path to form an absolute URL.
SVGDocument(Url)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(Aspose.Html.Url) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security.
public SVGDocument(Url url)
Parameters
url
Url
The document URL.
SVGDocument(string, Configuration)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(System.String) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security.
public SVGDocument(string address, Configuration configuration)
Parameters
address
string
The document address. It will be combined with the current directory path to form an absolute URL.
configuration
Configuration
The configuration.
SVGDocument(Url, Configuration)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(Aspose.Html.Url) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security.
public SVGDocument(Url url, Configuration configuration)
Parameters
url
Url
The document URL.
configuration
Configuration
The configuration.
SVGDocument(Stream, string)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(System.IO.Stream,System.String) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security. Document loading starts from the current position in the stream.
public SVGDocument(Stream content, string baseUri)
Parameters
content
Stream
The document content.
baseUri
string
The base URI of the document. It will be combined with the current directory path to form an absolute URL.
Exceptions
baseUri
is null
.
SVGDocument(Stream, string, Configuration)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(System.IO.Stream,System.String) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security. Document loading starts from the current position in the stream.
public SVGDocument(Stream content, string baseUri, Configuration configuration)
Parameters
content
Stream
The document content.
baseUri
string
The base URI of the document. It will be combined with the current directory path to form an absolute URL.
configuration
Configuration
The configuration.
Exceptions
baseUri
is null
.
SVGDocument(Stream, Url)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(System.IO.Stream,Aspose.Html.Url) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security. Document loading starts from the current position in the stream.
public SVGDocument(Stream content, Url baseUri)
Parameters
content
Stream
The document content.
baseUri
Url
The base URI of the document.
Exceptions
baseUri
is null
.
SVGDocument(Stream, Url, Configuration)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(System.IO.Stream,Aspose.Html.Url) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security. Document loading starts from the current position in the stream.
public SVGDocument(Stream content, Url baseUri, Configuration configuration)
Parameters
content
Stream
The document content.
baseUri
Url
The base URI of the document.
configuration
Configuration
The configuration.
Exceptions
baseUri
is null
.
SVGDocument(string, string)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(System.String,System.String) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security.
public SVGDocument(string content, string baseUri)
Parameters
content
string
The document content.
baseUri
string
The base URI of the document. It will be combined with the current directory path to form an absolute URL.
Exceptions
baseUri
is null
.
SVGDocument(string, string, Configuration)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(System.String,System.String) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security.
public SVGDocument(string content, string baseUri, Configuration configuration)
Parameters
content
string
The document content.
baseUri
string
The base URI of the document. It will be combined with the current directory path to form an absolute URL.
configuration
Configuration
The configuration.
Exceptions
baseUri
is null
.
SVGDocument(string, Url)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(System.String,Aspose.Html.Url) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security.
public SVGDocument(string content, Url baseUri)
Parameters
content
string
The document content.
baseUri
Url
The base URI of the document.
Exceptions
baseUri
is null
.
SVGDocument(string, Url, Configuration)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(System.String,Aspose.Html.Url) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security.
public SVGDocument(string content, Url baseUri, Configuration configuration)
Parameters
content
string
The document content.
baseUri
Url
The base URI of the document.
configuration
Configuration
The configuration.
Exceptions
baseUri
is null
.
SVGDocument(RequestMessage)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(Aspose.Html.Net.RequestMessage) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security.
public SVGDocument(RequestMessage request)
Parameters
request
RequestMessage
The request.
SVGDocument(RequestMessage, Configuration)
Initializes a new instance of the Aspose.Html.Dom.Svg.SVGDocument class. Constructor works synchronously, it waits for loading of all the external resources (images, scripts, etc.). To load document asynchronously use method Aspose.Html.Dom.Document.Navigate(Aspose.Html.Net.RequestMessage) or its overloads. Or you can disable loading of some external resources by setting appropriate flags in Aspose.Html.Dom.IBrowsingContext.Security.
public SVGDocument(RequestMessage request, Configuration configuration)
Parameters
request
RequestMessage
The request.
configuration
Configuration
The configuration.
Properties
Domain
The domain name of the server that served the document, or a null string if the server cannot be identified by a domain name.
[DOMName("domain")]
public string Domain { get; }
Property Value
Referrer
Returns the URI of the page that linked to this page. The value is an empty string if the user navigated to the page directly (not through a link, but, for example, via a bookmark).
[DOMName("referrer")]
public string Referrer { get; }
Property Value
RootElement
The root ‘svg’ in the document hierarchy.
[DOMName("rootElement")]
public SVGSVGElement RootElement { get; }
Property Value
Title
The title of a document as specified by the ‘title’ sub-element of the ‘svg’ root element (i.e., )
[DOMName("title")]
public string Title { get; }
Property Value
URL
The complete URI of the document.
[DOMName("URL")]
public string URL { get; }
Property Value
Methods
GetOverrideStyle(Element, string)
This method is used to retrieve the override style declaration for a specified element and a specified pseudo-element.
public ICSSStyleDeclaration GetOverrideStyle(Element elt, string pseudoElt)
Parameters
elt
Element
The element whose style is to be modified. This parameter cannot be null.
pseudoElt
string
The pseudo-element or null if none.
Returns
The override style declaration
RenderTo(IDevice)
This method is used to print the contents of the current document to the specified device.
public override void RenderTo(IDevice device)
Parameters
device
IDevice
The user device.
Save(Url)
Saves the document to local file specified by url
. All resources used in this document will be saved in
to adjacent folder, whose name will be constructed as: output_file_name + “_files”.
public void Save(Url url)
Parameters
url
Url
Local URL to output file.
Exceptions
Raised if the specified url
is not a valid local file URL.
Save(string)
Saves the document to local file specified by path
. All resources used in this document will be saved in
to adjacent folder, whose name will be constructed as: output_file_name + “_files”.
public void Save(string path)
Parameters
path
string
Local path to output file.
Exceptions
Raised if the specified path
is not a valid local file path.
Save(ResourceHandler)
Saves the document content and resources using the Aspose.Html.Saving.ResourceHandlers.ResourceHandler.
public void Save(ResourceHandler resourceHandler)
Parameters
resourceHandler
ResourceHandler
The resource handler Aspose.Html.Saving.ResourceHandlers.ResourceHandler.
Save(string, SVGSaveFormat)
Saves the document to local file specified by path
. All resources used in this document will be saved in
to adjacent folder, whose name will be constructed as: output_file_name + “_files”.
public void Save(string path, SVGSaveFormat saveFormat)
Parameters
path
string
Local path to output file.
saveFormat
SVGSaveFormat
Format in which document is saved.
Exceptions
Raised if the specified path
is not a valid local file path.
Save(ResourceHandler, SVGSaveFormat)
Saves the document content and resources using the Aspose.Html.Saving.ResourceHandlers.ResourceHandler.
public void Save(ResourceHandler resourceHandler, SVGSaveFormat saveFormat)
Parameters
resourceHandler
ResourceHandler
The resource handler Aspose.Html.Saving.ResourceHandlers.ResourceHandler.
saveFormat
SVGSaveFormat
Format in which document is saved.
Save(string, SVGSaveOptions)
Saves the document to local file specified by path
. All resources used in this document will be saved in
to adjacent folder, whose name will be constructed as: output_file_name + “_files”.
public void Save(string path, SVGSaveOptions saveOptions)
Parameters
path
string
Local path to output file.
saveOptions
SVGSaveOptions
SVG save options.
Exceptions
Raised if the specified path
is not a valid local file path.
Save(ResourceHandler, SVGSaveOptions)
Saves the document content and resources using the Aspose.Html.Saving.ResourceHandlers.ResourceHandler.
public void Save(ResourceHandler resourceHandler, SVGSaveOptions saveOptions)
Parameters
resourceHandler
ResourceHandler
The resource handler Aspose.Html.Saving.ResourceHandlers.ResourceHandler.
saveOptions
SVGSaveOptions
SVG save options.
Save(Url, SVGSaveFormat)
Saves the document to local file specified by url
. All resources used in this document will be saved in
to adjacent folder, whose name will be constructed as: output_file_name + “_files”.
public void Save(Url url, SVGSaveFormat saveFormat)
Parameters
url
Url
Local URL to output file.
saveFormat
SVGSaveFormat
Format in which document is saved.
Exceptions
Raised if the specified url
is not a valid local file URL.
Save(Url, SVGSaveOptions)
Saves the document to local file specified by url
. All resources used in this document will be saved in
to adjacent folder, whose name will be constructed as: output_file_name + “_files”.
public void Save(Url url, SVGSaveOptions saveOptions)
Parameters
url
Url
Local URL to output file.
saveOptions
SVGSaveOptions
SVG save options.
Exceptions
Raised if the specified url
is not a valid local file URL.