Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
697d0bbe
Commit
697d0bbe
authored
Feb 26, 2014
by
Tibor Peluch
Browse files
added namespace check
parent
31a24ea2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/SvgElementFactory.cs
View file @
697d0bbe
...
@@ -14,6 +14,7 @@ namespace Svg
...
@@ -14,6 +14,7 @@ namespace Svg
internal
class
SvgElementFactory
internal
class
SvgElementFactory
{
{
private
static
List
<
ElementInfo
>
availableElements
;
private
static
List
<
ElementInfo
>
availableElements
;
private
const
string
svgNS
=
"http://www.w3.org/2000/svg"
;
/// <summary>
/// <summary>
/// Gets a list of available types that can be used when creating an <see cref="SvgElement"/>.
/// Gets a list of available types that can be used when creating an <see cref="SvgElement"/>.
...
@@ -77,25 +78,29 @@ namespace Svg
...
@@ -77,25 +78,29 @@ namespace Svg
{
{
SvgElement
createdElement
=
null
;
SvgElement
createdElement
=
null
;
string
elementName
=
reader
.
LocalName
;
string
elementName
=
reader
.
LocalName
;
string
elementNS
=
reader
.
NamespaceURI
;
//Trace.TraceInformation("Begin CreateElement: {0}", elementName);
//Trace.TraceInformation("Begin CreateElement: {0}", elementName);
if
(
elementN
ame
==
"
svg
"
)
if
(
elementN
S
==
svg
NS
)
{
{
createdElement
=
(
fragmentIsDocument
)
?
new
T
()
:
new
SvgFragment
();
if
(
elementName
==
"svg"
)
}
else
{
ElementInfo
validType
=
AvailableElements
.
SingleOrDefault
(
e
=>
e
.
ElementName
==
elementName
);
if
(
validType
!=
null
)
{
{
createdElement
=
(
SvgElement
)
Activator
.
CreateInstance
(
validType
.
ElementType
);
createdElement
=
(
fragmentIsDocument
)
?
new
T
()
:
new
SvgFragment
();
}
else
{
ElementInfo
validType
=
AvailableElements
.
SingleOrDefault
(
e
=>
e
.
ElementName
==
elementName
);
if
(
validType
!=
null
)
{
createdElement
=
(
SvgElement
)
Activator
.
CreateInstance
(
validType
.
ElementType
);
}
}
}
}
if
(
createdElement
!=
null
)
if
(
createdElement
!=
null
)
{
{
SetAttributes
(
createdElement
,
reader
,
document
);
SetAttributes
(
createdElement
,
reader
,
document
);
}
}
}
//Trace.TraceInformation("End CreateElement");
//Trace.TraceInformation("End CreateElement");
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment