-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor schema root into its own module.
- Loading branch information
Showing
5 changed files
with
55 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// This file is part of fast-xml, copyright (c) 2015 BusFaster Ltd. | ||
// Released under the MIT license, see LICENSE. | ||
|
||
import {State} from '../../XsdState'; | ||
import * as types from '../types'; | ||
|
||
/** Schema root element */ | ||
|
||
export class Root extends types.Base { | ||
static mayContain = () => [ | ||
Schema | ||
]; | ||
} | ||
|
||
/** <xsd:schema> */ | ||
|
||
export class Schema extends types.Base { | ||
static mayContain = () => [ | ||
types.XsdImport, | ||
types.XsdInclude, | ||
types.XsdAttributeGroup, | ||
types.XsdSimpleType, | ||
types.XsdComplexType, | ||
types.XsdGroup, | ||
types.XsdAttribute, | ||
types.XsdElement | ||
]; | ||
|
||
init(state: State) { | ||
// Ultimately the schema exports elements and types in the global scope | ||
// (meaning they are children of this, the root element). | ||
|
||
state.source.parse(state.attributeTbl); | ||
var scope = state.source.targetNamespace.getScope(); | ||
|
||
state.setScope(scope); | ||
this.scope = scope; | ||
} | ||
} |