diff --git a/src/Schema/Schema.php b/src/Schema/Schema.php
index 1c6d22a2..2a86dcfc 100644
--- a/src/Schema/Schema.php
+++ b/src/Schema/Schema.php
@@ -32,7 +32,7 @@ protected function findSomethingNoThrow(
return $this->typeCache[$cid];
}
- if ($this->getTargetNamespace() === $namespace) {
+ if ($this->getTargetNamespace() === $namespace || $namespace === null) {
/**
* @var SchemaItem|null $item
*/
diff --git a/src/SchemaReader.php b/src/SchemaReader.php
index 76dbf2d4..d106275c 100644
--- a/src/SchemaReader.php
+++ b/src/SchemaReader.php
@@ -1042,7 +1042,7 @@ private static function splitParts(\DOMElement $node, string $typeName): array
// If no namespace is found, throw an exception only if a prefix was provided.
// If no prefix was provided and the above lookup failed, this means that there
- // was no defalut namespace defined, making the element part of no namespace.
+ // was no default namespace defined, making the element part of no namespace.
// In this case, we should not throw an exception since this is valid xml.
if (!$namespace && null !== $prefix) {
throw new TypeException(sprintf("Can't find namespace for prefix '%s', at line %d in %s ", $prefix, $node->getLineNo(), $node->ownerDocument->documentURI));
diff --git a/tests/ImportTest.php b/tests/ImportTest.php
index 483d278a..d9aac704 100644
--- a/tests/ImportTest.php
+++ b/tests/ImportTest.php
@@ -121,4 +121,11 @@ public function testDependentImport(): void
self::assertInstanceOf(ElementDef::class, $schema->findElement('outerEl', 'http://tempuri.org/1'));
}
+
+ public function testDefaultNamespaceImport(): void
+ {
+ $schema = $this->reader->readfile(__DIR__ . '/schema/schema.xsd');
+
+ self::assertInstanceOf(Schema::class, $schema);
+ }
}
diff --git a/tests/schema/schema.xsd b/tests/schema/schema.xsd
new file mode 100644
index 00000000..79abbbb2
--- /dev/null
+++ b/tests/schema/schema.xsd
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/schema/schema2.xsd b/tests/schema/schema2.xsd
new file mode 100644
index 00000000..29596b28
--- /dev/null
+++ b/tests/schema/schema2.xsd
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+