Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mmt-errorView
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christian Maeder
mmt-errorView
Commits
980e7ecf
Commit
980e7ecf
authored
Jan 13, 2015
by
Christian Maeder
Browse files
Options
Downloads
Patches
Plain Diff
parsing all files
parent
46adf004
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/scala/ParseXML.scala
+42
-0
42 additions, 0 deletions
src/test/scala/ParseXML.scala
with
42 additions
and
0 deletions
src/test/scala/ParseXML.scala
0 → 100644
+
42
−
0
View file @
980e7ecf
package
scala
import
java.io.File
import
scala.xml._
/**
* Created by maeder on 13.01.15.
* try parsing <error> tags
*/
object
ParseXML
{
def
readXml
(
f
:
File
)
:
NodeSeq
=
{
try
{
val
xml
=
XML
.
loadFile
(
f
.
getPath
)
xml
\\
"error"
}
catch
{
case
e
:
SAXParseException
=>
Nil
}
}
def
getAttrs
(
attrs
:
List
[
String
],
x
:
Node
)
:
List
[
String
]
=
{
attrs
map
(
a
=>
(
x
\
(
"@"
+
a
)).
toString
())
}
def
traverse
(
dir
:
File
,
proc
:
File
=>
Unit
)
:
Unit
=
dir
.
listFiles
foreach
{
f
=>
if
(
f
.
isDirectory
)
traverse
(
f
,
proc
)
else
proc
(
f
)}
def
procFile
(
f
:
File
)
:
Unit
=
{
val
errs
=
readXml
(
f
)
if
(
errs
.
isEmpty
)
println
(
"NOERR: "
+
f
)
else
errs
map
(
x
=>
{
println
(
f
)
getAttrs
(
List
(
"type"
,
"shortMsg"
,
"level"
),
x
)
map
println
}
)
}
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
dir
=
new
File
(
"/local/maeder/tptp/Distribution/errors"
)
traverse
(
dir
,
procFile
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment