Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
INMOST
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Terekhov
INMOST
Commits
5fd1e890
Commit
5fd1e890
authored
Oct 21, 2016
by
Kirill Terekhov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature for XML reader
FindAttrib function to search attribute by name
parent
ac5edf33
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
Source/Headers/inmost_xml.h
Source/Headers/inmost_xml.h
+5
-2
Source/Misc/xml.cpp
Source/Misc/xml.cpp
+9
-1
No files found.
Source/Headers/inmost_xml.h
View file @
5fd1e890
...
...
@@ -162,7 +162,7 @@ namespace INMOST
{
std
::
string
name
;
//<Name of the XML tag.
std
::
vector
<
XMLAttrib
>
attributes
;
//<List of attributes.
int
finish
;
//<Whether to close the ta
.g
int
finish
;
//<Whether to close the ta
g.
///This is data without ![CDATA[ wrap.
...
...
@@ -200,6 +200,9 @@ namespace INMOST
///Return next occurance of XML tag with the specified
///name. Returns NumChildren() if not found.
int
FindChild
(
std
::
string
name
,
int
offset
=
-
1
)
const
;
///Return next occurance of XML attribute with the specified
///name. Returns NumAttrib() if not found.
int
FindAttrib
(
std
::
string
name
,
int
offset
=
-
1
)
const
;
///Retrive a child of current XML tag with number n.
const
XMLTree
&
GetChild
(
int
n
)
const
{
return
children
[
n
];}
///Retrive number of children.
...
...
@@ -207,7 +210,7 @@ namespace INMOST
///Retrive attribute of current XML tag with number n.
const
XMLAttrib
&
GetAttrib
(
int
n
)
const
{
return
tag
.
GetAttib
(
n
);}
///Retrive number of attributes.
int
NumAttrib
()
const
{
return
(
int
)
tag
.
NumAttrib
();}
int
NumAttrib
()
const
{
return
tag
.
NumAttrib
();}
///Retrive the name of the tag.
std
::
string
GetName
()
const
{
return
tag
.
GetName
();}
///Retrive contents of the tag.
...
...
Source/Misc/xml.cpp
View file @
5fd1e890
...
...
@@ -1616,7 +1616,15 @@ namespace INMOST
return
NumChildren
();
}
int
XMLReader
::
XMLTree
::
FindAttrib
(
std
::
string
name
,
int
offset
)
const
{
for
(
int
k
=
offset
+
1
;
k
<
NumAttrib
();
++
k
)
if
(
GetAttrib
(
k
).
name
==
name
)
return
k
;
return
NumAttrib
();
}
void
WriteXML
(
const
XMLReader
::
XMLTree
&
t
,
std
::
ostream
&
output
,
int
offset
)
{
Tabs
(
output
,
offset
)
<<
"<"
<<
t
.
GetName
();
...
...
Write
Preview
Markdown
is supported
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