Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wiktionary2xml
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
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
quizreader
wiktionary2xml
Commits
e22f8b89
Commit
e22f8b89
authored
Sep 02, 2019
by
jhammen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
define attribute tags, set MAX_ARTICLES to unlimited
parent
557abbfa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
src/main/java/org/quizreader/wiktionary2xml/Wiktionary2XML.java
...in/java/org/quizreader/wiktionary2xml/Wiktionary2XML.java
+14
-7
No files found.
src/main/java/org/quizreader/wiktionary2xml/Wiktionary2XML.java
View file @
e22f8b89
...
...
@@ -23,10 +23,12 @@ import java.io.PrintStream;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Properties
;
import
java.util.Set
;
import
javax.xml.bind.JAXBException
;
import
javax.xml.stream.XMLOutputFactory
;
...
...
@@ -65,13 +67,14 @@ import de.fau.cs.osr.ptk.common.jxpath.AstNodePointerFactory;
public
class
Wiktionary2XML
implements
ExpansionCallback
{
private
static
final
int
MAX_ARTICLES
=
14095
;
//
Integer.MAX_VALUE;
private
static
final
int
MAX_ARTICLES
=
Integer
.
MAX_VALUE
;
private
final
WikiXMLReader
wikiXMLReader
;
private
final
WikiConfig
wikiConfig
;
private
final
WtEngineImpl
engine
;
private
final
Map
<
String
,
FullPage
>
templateMap
=
new
HashMap
<
String
,
FullPage
>();
private
final
List
<
String
>
pagePrefix2Ignore
;
private
final
Set
<
String
>
attributeTags
;
private
XMLStreamWriter
xmlWriter
;
private
String
singleArticleTitle
=
null
;
...
...
@@ -89,6 +92,8 @@ public class Wiktionary2XML implements ExpansionCallback {
pagePrefix2Ignore
.
add
(
"Index:"
);
pagePrefix2Ignore
.
add
(
"Template:"
);
pagePrefix2Ignore
.
add
(
"Wiktionary:"
);
attributeTags
=
new
HashSet
<
String
>();
attributeTags
.
add
(
"root"
);
}
public
String
fileUrl
(
PageTitle
pageTitle
,
int
width
,
int
height
)
{
...
...
@@ -400,13 +405,15 @@ public class Wiktionary2XML implements ExpansionCallback {
}
else
if
(
child
instanceof
WtXmlElement
)
{
WtXmlElement
element
=
(
WtXmlElement
)
child
;
String
name
=
element
.
getName
();
String
existing
=
attributeMap
.
get
(
name
);
String
tagContent
=
renderText
(
element
.
getBody
());
if
(
existing
==
null
)
{
attributeMap
.
put
(
name
,
tagContent
);
}
else
{
attributeMap
.
put
(
name
,
existing
+
","
+
tagContent
);
String
name
=
element
.
getName
();
if
(
attributeTags
.
contains
(
name
))
{
String
existing
=
attributeMap
.
get
(
name
);
if
(
existing
==
null
)
{
attributeMap
.
put
(
name
,
tagContent
);
}
else
{
attributeMap
.
put
(
name
,
existing
+
","
+
tagContent
);
}
}
ret
.
append
(
tagContent
);
}
...
...
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