Skip to content

Commit c391616

Browse files
committed
Updated text
1 parent 0d953af commit c391616

5 files changed

Lines changed: 13 additions & 12 deletions

File tree

FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: USERNAME

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ TypesXML is a native TypeScript XML processing toolkit—there are no bindings t
1111
- DOM builder (`DOMBuilder`) that produces an in-memory tree and preserves lexical information needed by canonicalization.
1212
- Streaming SAX parser with pull-based file, string, and Node.js stream entry points.
1313
- Complete DTD parser/validator with conditional sections and parameter entities.
14-
- Default attribute extraction from any reachable grammar (DTD, Relax NG, or XML Schema); defaults merge during SAX parsing independent of validation mode.
14+
- Default attribute extraction from any reachable grammar (DTD, RelaxNG, or XML Schema); defaults merge during SAX parsing independent of validation mode.
1515
- OASIS XML Catalog resolver for public/system identifiers and alternate entity sources.
1616
- Passes 100% of the test cases in the official W3C XML Conformance Test Suite for DTD grammars (valid, invalid, not-wf, external entity cases).
1717
- Canonical XML renderer compatible with the W3C XML Test Suite rules.

docs/tutorial.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ parser.parseFile("samples/resources/xml/library.xml"); // Use "resources/..." in
108108
`Catalog` requires an absolute file system path. The snippet above anchors the lookup to the samples directory via `import.meta.url`, but any approach that produces an absolute path (for example `resolve(process.cwd(), "catalog/catalog.xml")`) works in your own projects.
109109
```
110110

111-
The parser now resolves DTDs through the catalog and can locate Relax NG or XML Schema documents to harvest default attributes, avoiding repetitive HTTP requests and ensuring consistent versions.
111+
The parser now resolves DTDs through the catalog and can locate RelaxNG or XML Schema documents to harvest default attributes, avoiding repetitive HTTP requests and ensuring consistent versions.
112112

113113
## 5. Enabling Validating Mode
114114

115-
Validation checks the document against its DTD and raises an error when a rule is violated. It does not influence default attribute retrieval—Relax NG and XML Schema grammars are loaded for defaults whenever they are referenced. The samples folder includes `resources/dtd/sample.dtd` plus matching XML instances so you can see both success and failure cases.
115+
Validation checks the document against its DTD and raises an error when a rule is violated. It does not influence default attribute retrieval — RelaxNG and XML Schema grammars are loaded for defaults whenever they are referenced. The samples folder includes `resources/dtd/sample.dtd` plus matching XML instances so you can see both success and failure cases.
116116

117117
```ts
118118
const parser = new SAXParser();
@@ -239,7 +239,7 @@ Only implement the callbacks you care about—unimplemented methods can remain e
239239

240240
## 9. Merging Default Attributes from Grammars
241241

242-
TypesXML collects default attribute values declared in any grammar it can load (DTD, Relax NG, or XML Schema) and merges them into SAX events. That means elements automatically receive attributes such as `translate="yes"` or `class="- map/map"` without you manually copying values. DTD defaults participate in the same way as schema-driven defaults.
242+
TypesXML collects default attribute values declared in any grammar it can load (DTD, RelaxNG, or XML Schema) and merges them into SAX events. That means elements automatically receive attributes such as `translate="yes"` or `class="- map/map"` without you manually copying values. DTD defaults participate in the same way as schema-driven defaults.
243243

244244
To benefit from this feature:
245245

@@ -248,7 +248,7 @@ To benefit from this feature:
248248

249249
You will then see the defaults in DOM output and SAX callbacks.
250250

251-
The sample command `npm run relaxng-defaults` demonstrates this with a Relax NG grammar resolved through the catalog: the parser pulls default attributes from `library-rng.xml` even though validation remains disabled.
251+
The sample command `npm run relaxng-defaults` demonstrates this with a RelaxNG grammar resolved through the catalog: the parser pulls default attributes from `library-rng.xml` even though validation remains disabled.
252252

253253
## 10. Error Handling and Diagnostics
254254

@@ -266,7 +266,7 @@ These collections help you confirm which schemas were loaded and where defaults
266266

267267
- Combine `SAXParser` with your application’s data model by creating specialised handlers.
268268
- Use `DOMBuilder` for modification-heavy workflows, then serialise with `XMLDocument#toString()`.
269-
- Explore the source in `ts/` for advanced utilities such as indentation helpers, writers, and Relax NG support.
269+
- Explore the source in `ts/` for advanced utilities such as indentation helpers, writers, and RelaxNG support.
270270
- Download the `samples/` folder, run `npm install`, and execute `npm run parse-file` to test everything with Node immediately.
271271
- Browse the runnable snippets under `samples/` for end-to-end code you can adapt.
272272

samples/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Each file is self-contained and documented inline. After installing you can exec
2121

2222
Example data lives under `resources/`. `xml/library.xml` references a schema published at `http://example.com/samples/schema`, which is resolved locally through the catalog in `resources/catalog/catalog.xml`. The scripts compute absolute paths to these files at runtime, matching the requirement of the `Catalog` API.
2323

24-
A DTD-backed pair—`xml/library-valid.xml` and `xml/library-invalid.xml`—demonstrates DTD validation using `resources/dtd/sample.dtd`. The Relax NG grammar in `resources/rng/library.rng` is referenced by `xml/library-rng.xml` to showcase default attribute merging without validation mode.
24+
A DTD-backed pair—`xml/library-valid.xml` and `xml/library-invalid.xml`—demonstrates DTD validation using `resources/dtd/sample.dtd`. The RelaxNG grammar in `resources/rng/library.rng` is referenced by `xml/library-rng.xml` to showcase default attribute merging without validation mode.
2525

2626
## Sample Index
2727

2828
- `parse-file.ts` – Parse a local XML file, traverse the DOM, and report attribute values.
2929
- `catalog-validated.ts` – Load an OASIS catalog, enable DTD validation, and show merged default attributes.
30-
- `relaxng-defaults.ts` – Resolve a Relax NG grammar via catalog lookup and observe default attributes merged into the DOM.
30+
- `relaxng-defaults.ts` – Resolve a RelaxNG grammar via catalog lookup and observe default attributes merged into the DOM.
3131
- `stream-parse.ts` – Fetch an XML document over HTTPS and process it as a stream.
3232
- `custom-handler.ts` – Implement a bespoke `ContentHandler` that logs SAX events.
3333

@@ -38,7 +38,7 @@ To explore the most common scenarios directly:
3838
- `npm run parse-file` – build the samples and print a quick DOM traversal of the catalog-backed library.
3939
- `npm run stream-parse` – build the samples and fetch a remote XML document over HTTPS, printing the raw payload.
4040
- `npm run custom-handler` – build the samples and stream SAX events through the logging handler.
41-
- `npm run relaxng-defaults` – build the samples and parse `library-rng.xml`, showing Relax NG defaults applied even without validation.
41+
- `npm run relaxng-defaults` – build the samples and parse `library-rng.xml`, showing RelaxNG defaults applied even without validation.
4242

4343
For the validation sample:
4444

samples/relaxng-defaults.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ async function main(): Promise<void> {
1616
parser.setCatalog(catalog);
1717
parser.setContentHandler(handler);
1818

19-
console.log("Parsing library-rng.xml with Relax NG defaults...");
19+
console.log("Parsing library-rng.xml with RelaxNG defaults...");
2020
parser.parseFile(xmlPath);
2121

2222
const document = handler.getDocument();
@@ -26,7 +26,7 @@ async function main(): Promise<void> {
2626
}
2727

2828
console.log("Root element:", root.getName());
29-
console.log("Region attribute (Relax NG default):", root.getAttribute("region")?.getValue());
29+
console.log("Region attribute (RelaxNG default):", root.getAttribute("region")?.getValue());
3030

3131
root.getChildren().forEach((child) => {
3232
const isbn = child.getAttribute("isbn")?.getValue();
@@ -35,7 +35,7 @@ async function main(): Promise<void> {
3535
console.log(` Book ISBN=${isbn} status=${status} title=${title}`);
3636
});
3737

38-
console.log("Missing attributes filled via Relax NG default annotations.");
38+
console.log("Missing attributes filled via RelaxNG default annotations.");
3939
}
4040

4141
main().catch((error) => {

0 commit comments

Comments
 (0)