Skip to content

Commit

Permalink
Move rest of the XSD parser inside the xsd directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
jjrv committed Dec 19, 2015
1 parent d12ce72 commit 822f52c
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 29 deletions.
1 change: 0 additions & 1 deletion src/xsd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {ExporterTS} from './xsd/ExporterTS'

Cache.patchRequest();

Namespace.register('http://www.w3.org/2001/XMLSchema', 'http://www.w3.org/2009/XMLSchema/XMLSchema.xsd', 'xsd');
Namespace.register('http://www.w3.org/XML/1998/namespace', 'http://www.w3.org/2001/xml.xsd', 'xml');

var loader = new Loader({
Expand Down
6 changes: 3 additions & 3 deletions src/xsd/Loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import {FetchOptions, Cache, CacheResult, util} from 'cget'
import {Namespace} from './Namespace'
import {Source} from './Source'
import {XsdParser} from '../XsdParser'
import {Parser} from './Parser'

export class Loader {
constructor(options?: FetchOptions) {
this.options = util.clone(options);
this.parser = new XsdParser();
this.parser = new Parser();
}

import(urlRemote: string) {
Expand Down Expand Up @@ -65,7 +65,7 @@ export class Loader {
private static sourceTbl: {[url: string]: Source} = {};

private options: FetchOptions;
private parser: XsdParser;
private parser: Parser;

private targetNamespace: Namespace;
private pendingCount = 0;
Expand Down
14 changes: 7 additions & 7 deletions src/XsdParser.ts → src/xsd/Parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import * as expat from 'node-expat';
import * as Promise from 'bluebird';

import {FetchOptions, Cache, CacheResult} from 'cget';
import * as types from './xsd/types';
import {State, Rule} from './XsdState';
import {Namespace} from './xsd/Namespace';
import {Loader} from './xsd/Loader';
import {Source} from './xsd/Source';
import {QName} from './xsd/QName'
import * as types from './types';
import {State, Rule} from './State';
import {Namespace} from './Namespace';
import {Loader} from './Loader';
import {Source} from './Source';
import {QName} from './QName'

import * as util from 'util';

Expand All @@ -37,7 +37,7 @@ function parseRule(ctor: types.BaseClass) {
return(rule);
}

export class XsdParser {
export class Parser {
constructor() {
this.rootRule = parseRule(types.Root);
}
Expand Down
12 changes: 6 additions & 6 deletions src/XsdState.ts → src/xsd/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import * as expat from 'node-expat';
import {FetchOptions, Cache} from 'cget'

import * as types from './xsd/types'
import {XsdParser} from './XsdParser'
import {Namespace} from './xsd/Namespace'
import {Source} from './xsd/Source'
import {Scope} from './xsd/Scope'
import {QName} from './xsd/QName'
import * as types from './types'
import {Parser} from './Parser'
import {Namespace} from './Namespace'
import {Source} from './Source'
import {Scope} from './Scope'
import {QName} from './QName'

export class State {
constructor(parent: State, rule: Rule, source?: Source) {
Expand Down
6 changes: 1 addition & 5 deletions src/xsd/types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// This file is part of fast-xml, copyright (c) 2015 BusFaster Ltd.
// Released under the MIT license, see LICENSE.

import {State, Rule} from '../XsdState';
import {XsdParser} from '../XsdParser';
import {Namespace} from './Namespace';
import {Source} from './Source';
import {Scope} from './Scope';
import {State} from './State';
import {QName} from './QName';

import {Base, BaseClass} from './types/Base';
Expand Down
2 changes: 1 addition & 1 deletion src/xsd/types/Attribute.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is part of fast-xml, copyright (c) 2015 BusFaster Ltd.
// Released under the MIT license, see LICENSE.

import {State} from '../../XsdState';
import {State} from '../State';
import {QName} from '../QName';
import * as types from '../types';

Expand Down
2 changes: 1 addition & 1 deletion src/xsd/types/Base.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is part of fast-xml, copyright (c) 2015 BusFaster Ltd.
// Released under the MIT license, see LICENSE.

import {State, Rule} from '../../XsdState';
import {State, Rule} from '../State';
import {Namespace} from '../Namespace';
import {Scope} from '../Scope';
import {QName} from '../QName';
Expand Down
2 changes: 1 addition & 1 deletion src/xsd/types/ComplexType.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is part of fast-xml, copyright (c) 2015 BusFaster Ltd.
// Released under the MIT license, see LICENSE.

import {State} from '../../XsdState';
import {State} from '../State';
import {QName} from '../QName';
import * as types from '../types';

Expand Down
2 changes: 1 addition & 1 deletion src/xsd/types/Element.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is part of fast-xml, copyright (c) 2015 BusFaster Ltd.
// Released under the MIT license, see LICENSE.

import {State} from '../../XsdState';
import {State} from '../State';
import {QName} from '../QName';
import * as types from '../types';

Expand Down
2 changes: 1 addition & 1 deletion src/xsd/types/Group.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is part of fast-xml, copyright (c) 2015 BusFaster Ltd.
// Released under the MIT license, see LICENSE.

import {State} from '../../XsdState';
import {State} from '../State';
import {QName} from '../QName';
import * as types from '../types';

Expand Down
2 changes: 1 addition & 1 deletion src/xsd/types/Import.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is part of fast-xml, copyright (c) 2015 BusFaster Ltd.
// Released under the MIT license, see LICENSE.

import {State} from '../../XsdState';
import {State} from '../State';
import {Namespace} from '../Namespace';
import * as types from '../types';

Expand Down
2 changes: 1 addition & 1 deletion src/xsd/types/Schema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is part of fast-xml, copyright (c) 2015 BusFaster Ltd.
// Released under the MIT license, see LICENSE.

import {State} from '../../XsdState';
import {State} from '../State';
import * as types from '../types';

/** Schema root element */
Expand Down

0 comments on commit 822f52c

Please sign in to comment.