-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added option to parse XML from a string
- Loading branch information
Showing
12 changed files
with
107 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
rm -rf dist/ | ||
rm -rf node_modules/ | ||
rm package-lock.json | ||
npm install | ||
npm run build |
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
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,40 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Maxprograms. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse License 1.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/org/documents/epl-v10.html | ||
* | ||
* Contributors: | ||
* Maxprograms - initial API and implementation | ||
*******************************************************************************/ | ||
import { XMLReader } from "./XMLReader"; | ||
|
||
export class StringReader implements XMLReader { | ||
|
||
CHUNK_SIZE: number = 4096; | ||
|
||
data: string; | ||
position: number; | ||
|
||
constructor(data: string) { | ||
this.data = data; | ||
this.position = 0; | ||
} | ||
|
||
dataAvailable(): boolean { | ||
return this.position < this.data.length; | ||
} | ||
|
||
read(): string { | ||
let amount: number = this.CHUNK_SIZE; | ||
if (this.position + this.CHUNK_SIZE > this.data.length) { | ||
amount = this.data.length - this.position; | ||
} | ||
let result: string = this.data.substring(this.position, amount); | ||
this.position += amount; | ||
return result; | ||
} | ||
|
||
} |
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,16 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Maxprograms. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse License 1.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/org/documents/epl-v10.html | ||
* | ||
* Contributors: | ||
* Maxprograms - initial API and implementation | ||
*******************************************************************************/ | ||
|
||
export interface XMLReader { | ||
dataAvailable(): boolean; | ||
read(): string; | ||
} |