Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
4e89a1be
Commit
4e89a1be
authored
Oct 18, 2009
by
Tiago Peixoto
Browse files
Slightly improve xml escaping of strings
parent
b3212a66
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph/graphml.cpp
View file @
4e89a1be
...
...
@@ -13,18 +13,20 @@
#include
<expat.h>
#include
<boost/graph/graphml.hpp>
#include
<boost/algorithm/string/replace.hpp>
#include
<boost/archive/iterators/xml_escape.hpp>
#include
<boost/archive/iterators/ostream_iterator.hpp>
using
namespace
boost
;
namespace
boost
{
std
::
string
protect_xml_string
(
const
std
::
string
&
os
)
{
using
namespace
boost
::
a
lgorithm
;
std
::
string
s
(
os
)
;
replace_all
(
s
,
"&"
,
"&"
);
replace_all
(
s
,
"<"
,
"<"
);
replace_all
(
s
,
">"
,
">"
);
return
s
;
using
namespace
boost
::
a
rchive
::
iterators
;
std
::
string
stream
s
;
std
::
copy
(
xml_escape
<
const
char
*>
(
os
.
c_str
()),
xml_escape
<
const
char
*>
(
os
.
c_str
()
+
os
.
size
()),
ostream_iterator
<
char
>
(
s
)
);
return
s
.
str
()
;
}
}
...
...
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