Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
be-esb-core
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
be-esb-ecosystem-maven
be-esb-core
Commits
99728b0e
Commit
99728b0e
authored
Sep 19, 2022
by
WeiCong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化xmlutil的xpath获取元素函数
parent
648d574e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
XmlUtil.java
src/main/src/com/brilliance/eibs/util/XmlUtil.java
+7
-2
No files found.
src/main/src/com/brilliance/eibs/util/XmlUtil.java
View file @
99728b0e
...
...
@@ -322,9 +322,14 @@ public class XmlUtil {
public
static
String
getXmlNodeValueByXpath
(
Document
document
,
String
path
)
{
String
[]
paths
=
path
.
split
(
"#"
);
String
xpath
=
paths
[
0
];
Element
curElement
=
getNodesByXpath
(
document
,
xpath
,
"xpath"
).
get
(
0
);
if
(
paths
.
length
>
1
)
List
<
Element
>
lst
=
getNodesByXpath
(
document
,
xpath
,
"xpath"
);
if
(
lst
.
isEmpty
()){
return
null
;
}
Element
curElement
=
lst
.
get
(
0
);
if
(
paths
.
length
>
1
){
return
curElement
.
attributeValue
(
paths
[
paths
.
length
-
1
]);
}
return
curElement
.
getText
();
}
...
...
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