Skip to content

Commit 3f400ab

Browse files
committed
fix: svd-parser parse xs:noNamespaceSchemaLocation
close #204
1 parent b7d8ee1 commit 3f400ab

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

svd-parser/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## Unreleased
99

10+
- Fix parsing `xs:noNamespaceSchemaLocation`
11+
1012
## [v0.13.4] - 2022-05-13
1113

1214
- Support nested `derivedFrom` for `expand`

svd-parser/src/device.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ impl Parse for Device {
4545
if let Some(width) = optional::<u32>("width", tree, &())? {
4646
device = device.width(width)
4747
}
48-
if let Some(xmlns_xs) = tree.attribute("xmlns:xs") {
48+
// TODO: accept namespace other than `xs`
49+
// Now assert `xs` exists and `noNamespaceSchemaLocation` is under `xs`
50+
if let Some(xmlns_xs) = tree.lookup_namespace_uri(Some("xs")) {
4951
device = device.xmlns_xs(xmlns_xs.to_string());
50-
}
51-
if let Some(location) = tree.attribute("xs:noNamespaceSchemaLocation") {
52-
device = device.no_namespace_schema_location(location.to_string());
52+
if let Some(location) = tree.attribute((xmlns_xs, "noNamespaceSchemaLocation")) {
53+
device = device.no_namespace_schema_location(location.to_string());
54+
}
5355
}
5456
if let Some(schema_version) = tree.attribute("schemaVersion") {
5557
device = device.schema_version(schema_version.to_string());

0 commit comments

Comments
 (0)