Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftMtMx
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
isc-v3.1-tmp
swiftMtMx
Commits
56176fbd
Commit
56176fbd
authored
Aug 26, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复xpath代码
parent
4c384059
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
AbstractMx2MtCreator.java
...java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
+11
-3
No files found.
swiftCore/src/main/java/com/brilliance/swift/mx2mt/AbstractMx2MtCreator.java
View file @
56176fbd
...
...
@@ -26,6 +26,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.util.*
;
public
abstract
class
AbstractMx2MtCreator
implements
Mx2MtCreator
{
...
...
@@ -197,7 +198,9 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
try
{
String
[]
paths
=
path
.
split
(
"\\."
);
SAXReader
saxReader
=
new
SAXReader
();
Document
document
=
saxReader
.
read
(
AbstractMx2MtCreator
.
class
.
getResource
(
"/xsd/"
+
xsdName
+
".xsd"
));
URL
resource
=
AbstractMx2MtCreator
.
class
.
getResource
(
"/xsd/"
+
xsdName
+
".xsd"
);
if
(
resource
==
null
)
return
false
;
Document
document
=
saxReader
.
read
(
resource
);
Element
element
=
document
.
getRootElement
();
String
minOccurs
=
null
;
for
(
int
i
=
0
;
i
<
paths
.
length
;
i
++)
{
...
...
@@ -205,7 +208,10 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
if
(
p
.
indexOf
(
"@"
)
>
-
1
)
{
p
=
p
.
substring
(
0
,
p
.
indexOf
(
"@"
));
}
List
<
Node
>
nodeList
=
element
.
selectNodes
(
"//xs:element[@name='"
+
p
+
"']"
);
if
(
p
.
indexOf
(
"("
)
>
-
1
)
{
p
=
p
.
substring
(
0
,
p
.
indexOf
(
"("
));
}
List
<
Node
>
nodeList
=
element
.
selectNodes
(
".//xs:element[@name='"
+
p
+
"']"
);
if
(
nodeList
==
null
||
nodeList
.
size
()
==
0
)
{
continue
;
}
...
...
@@ -215,7 +221,9 @@ public abstract class AbstractMx2MtCreator implements Mx2MtCreator {
}
else
{
String
type
=
element
.
attributeValue
(
"type"
);
nodeList
=
element
.
selectNodes
(
"//xs:complexType[@name='"
+
type
+
"']"
);
element
=
(
Element
)
nodeList
.
get
(
0
);
if
(
nodeList
!=
null
&&
nodeList
.
size
()
>
0
)
{
element
=
(
Element
)
nodeList
.
get
(
0
);
}
}
}
if
(
minOccurs
==
null
||
Integer
.
parseInt
(
minOccurs
)
>
0
)
{
...
...
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