#include "ParsingXml.h"
namespace
{
namespace
{
namespace
{
using
namespace
stream
;
using
namespace
collections
;
using
namespace
regex
;
void
(
vl
::
collections
::
<
vl
::
<
>>&
,
const
vl
::
collections
::
<
vl
::
regex
::
>&
)
{
=-
1
;
=-
1
;
for
(
=
.
()-
1
;
i
>=-
1
;
i
--)
{
if
(
i
==-
1
)
{
if
(
end
!=-
1
)
begin
=
0
;
}
else
if
(
i
].
<
>())
{
if
(
end
==-
1
)
end
=
i
;
}
else
{
if
(
end
!=-
1
)
begin
=
i
+
1
;
}
if
(
begin
!=-
1
&&
end
!=-
1
)
{
=
begin
].
<
>()
.
;
=
end
].
<
>()
.
;
while
(
tokenBegin
>
0
)
{
if
(
.
(
tokenBegin
-
1
).
==(
)
::
||
.
(
tokenBegin
-
1
).
==-
1
)
{
tokenBegin
--;
}
else
{
break
;
}
}
while
(
tokenEnd
<
.
()-
1
)
{
if
(
.
(
tokenEnd
+
1
).
==(
)
::
||
.
(
tokenEnd
+
1
).
==-
1
)
{
tokenEnd
++;
}
else
{
break
;
}
}
const
&
=
.
(
tokenBegin
);
const
&
=
.
(
tokenEnd
);
const
wchar_t
*
=
beginToken
.
;
const
wchar_t
*
=
endToken
.
+
endToken
.
;
(
textBegin
,
(
textEnd
-
textBegin
));
(&
beginToken
, &
endToken
);
<
>
=
new
;
xmlText
range
;
xmlText
.
range
;
xmlText
.
(
text
);
.
(
begin
,
end
-
begin
+
1
);
.
(
begin
,
xmlText
);
begin
=-
1
;
end
=-
1
;
}
}
}
void
XmlUnescapeAttributeValue
(
vl
::
parsing
::
&
,
const
vl
::
collections
::
<
vl
::
regex
::
>&
)
{
.
(
.
.
(
1
,
.
.
()-
2
));
}
void
(
vl
::
parsing
::
&
,
const
vl
::
collections
::
<
vl
::
regex
::
>&
)
{
.
(
.
);
}
void
(
vl
::
parsing
::
& ,
const
vl
::
collections
::
<
vl
::
regex
::
>& )
{
.
(
.
);
}
class
:
public
,
public
::
{
public
:
&
;
(
&
)
:writer(
)
{
}
void
(
*
)
{
.
(
(
->
.
));
}
void
(
*
)
{
.
(
(
->
.
));
}
void
(
*
)
{
.
(
->
.
);
.
(
L"=\""
);
.
(
(
->
.
));
.
(
L"\""
);
}
void
(
* )
{
.
(
(
->
.
));
}
void
(
*
)
{
.
(
L'<'
);
.
(
->
.
);
FOREACH(Ptr<XmlAttribute>, att, node->attributes)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
att
);)
{
.
(
L' '
);
att
(
this
);
}
if
(
->
.
()==
0
)
{
.
(
L"/>"
);
}
else
{
.
(
L'>'
);
FOREACH(Ptr<XmlNode>, subNode, node->subNodes)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
subNode
);)
{
subNode
(
this
);
}
.
(
L"</"
);
.
(
->
.
);
.
(
L'>'
);
}
}
void
(
*
)
{
.
(
L"<?"
);
.
(
->
.
);
FOREACH(Ptr<XmlAttribute>, att, node->attributes)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
att
);)
{
.
(
L' '
);
att
(
this
);
}
.
(
L"?>"
);
}
void
(
*
)
{
FOREACH(Ptr<XmlNode>, prolog, node->prologs)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
prolog
);)
{
prolog
(
this
);
}
->
(
this
);
}
};
(
const
&
)
{
;
const
wchar_t
*
=
.
();
while
(
wchar_t
=*
reading
++)
{
switch
(
c
)
{
case
L'<'
:
result
+=
L"<"
;
break
;
case
L'>'
:
result
+=
L">"
;
break
;
case
L'&'
:
result
+=
L"&"
;
break
;
case
L'\''
:
result
+=
L"'"
;
break
;
case
L'\"'
:
result
+=
L"""
;
break
;
default
:
result
c
;
}
}
return
result
;
}
(
const
&
)
{
;
const
wchar_t
*
=
.
();
while
(*
reading
)
{
if
(
(
reading
,
L"<"
,
4
)==
0
)
{
result
L'<'
;
reading
+=
4
;
}
else
if
(
(
reading
,
L">"
,
4
)==
0
)
{
result
L'>'
;
reading
+=
4
;
}
else
if
(
(
reading
,
L"&"
,
5
)==
0
)
{
result
L'&'
;
reading
+=
5
;
}
else
if
(
(
reading
,
L"'"
,
6
)==
0
)
{
result
L'\''
;
reading
+=
6
;
}
else
if
(
(
reading
,
L"""
,
6
)==
0
)
{
result
L'\"'
;
reading
+=
6
;
}
else
{
result
*
reading
++;
}
}
return
result
;
}
(
const
&
)
{
return
L"<![CDATA["
+
+
L"]]>"
;
}
(
const
&
)
{
return
.
(
9
,
.
()-
12
);
}
(
const
& )
{
return
L"<!--"
+
+
L"-->"
;
}
(
const
& )
{
return
.
(
4
,
.
()-
7
);
}
void
(
<
>
,
stream
::
&
)
{
(
);
(&
visitor
);
}
void
(
<
>
,
stream
::
&
)
{
(
);
FOREACH(Ptr<XmlNode>, node, element->subNodes)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
node
);)
{
node
(&
visitor
);
}
}
(
<
>
)
{
return
([&](
&
)
{
(
,
writer
);
});
}
<
>
(
<
>
,
const
&
)
{
return
(
.
(),
);
}
<
>
(
<
>
,
const
&
)
{
return
(
.
(),
);
}
collections
::
<
<
>>
(
<
>
)
{
return
(
.
());
}
collections
::
<
<
>>
(
<
>
,
const
&
)
{
return
(
.
(),
);
}
(
<
>
)
{
return
(
.
());
}
<
>
(
*
,
const
&
)
{
FOREACH(Ptr<XmlAttribute>, att, element->attributes)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
att
);)
{
if
(
att
.
==
)
{
return
att
;
}
}
return
0
;
}
<
>
(
*
,
const
&
)
{
FOREACH(Ptr<XmlNode>, node, element->subNodes)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
node
);)
{
<
>
=
node
.
<
>();
if
(
subElement
&&
subElement
.
==
)
{
return
subElement
;
}
}
return
0
;
}
collections
::
<
<
>>
(
*
)
{
return
(
->
)
.FindType<
>();
}
collections
::
<
<
>>
(
*
,
const
&
)
{
return
(
->
)
.FindType<
>()
.Where([name](
<
>
){
return
e
.
==
;});
}
(
*
)
{
;
FOREACH(Ptr<XmlNode>, node, element->subNodes)
if
(
bool
=
true
)
for
(
const
::
vl
::
collections
::
<
<
>>&
= ::
vl
::
collections
::
(
->
);
__scope_variable_flag__
;
__scope_variable_flag__
=
false
)
for
(
<
>
;
__foreach_iterator__
.
(
node
);)
{
if
(
<
>
=
node
.
<
>())
{
result
text
.
;
}
else
if
(
<
>
=
node
.
<
>())
{
result
text
.
;
}
}
return
result
;
}
::
(
<
>
,
const
*
)
:element(
)
,previousWriter(
)
{
}
::
()
{
}
const
&
::
(
const
&
,
const
&
)
const
{
<
>
=
new
;
node
.
;
node
.
;
.
(
node
);
return
*
this
;
}
::
(
const
&
)
const
{
<
>
=
new
;
node
.
;
.
(
node
);
return
(
node
,
this
);
}
const
&
::
()
const
{
return
*
;
}
const
&
::
(
const
&
)
const
{
<
>
=
new
;
node
.
;
.
(
node
);
return
*
this
;
}
const
&
::
(
const
&
)
const
{
<
>
=
new
;
node
.
;
.
(
node
);
return
*
this
;
}
const
&
::(
const
& )
const
{
<
> =
new
;
node
.
;
.
(
node
);
return
*
this
;
}
}
}
}