You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ TypesXML is a native TypeScript XML processing toolkit—there are no bindings t
11
11
- DOM builder (`DOMBuilder`) that produces an in-memory tree and preserves lexical information needed by canonicalization.
12
12
- Streaming SAX parser with pull-based file, string, and Node.js stream entry points.
13
13
- 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.
15
15
- OASIS XML Catalog resolver for public/system identifiers and alternate entity sources.
16
16
- Passes 100% of the test cases in the official W3C XML Conformance Test Suite for DTD grammars (valid, invalid, not-wf, external entity cases).
17
17
- Canonical XML renderer compatible with the W3C XML Test Suite rules.
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.
112
112
113
113
## 5. Enabling Validating Mode
114
114
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.
116
116
117
117
```ts
118
118
const parser =newSAXParser();
@@ -239,7 +239,7 @@ Only implement the callbacks you care about—unimplemented methods can remain e
239
239
240
240
## 9. Merging Default Attributes from Grammars
241
241
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.
243
243
244
244
To benefit from this feature:
245
245
@@ -248,7 +248,7 @@ To benefit from this feature:
248
248
249
249
You will then see the defaults in DOM output and SAX callbacks.
250
250
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.
252
252
253
253
## 10. Error Handling and Diagnostics
254
254
@@ -266,7 +266,7 @@ These collections help you confirm which schemas were loaded and where defaults
266
266
267
267
- Combine `SAXParser` with your application’s data model by creating specialised handlers.
268
268
- 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.
270
270
- Download the `samples/` folder, run `npm install`, and execute `npm run parse-file` to test everything with Node immediately.
271
271
- Browse the runnable snippets under `samples/` for end-to-end code you can adapt.
Copy file name to clipboardExpand all lines: samples/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,13 @@ Each file is self-contained and documented inline. After installing you can exec
21
21
22
22
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.
23
23
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.
25
25
26
26
## Sample Index
27
27
28
28
-`parse-file.ts` – Parse a local XML file, traverse the DOM, and report attribute values.
29
29
-`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.
31
31
-`stream-parse.ts` – Fetch an XML document over HTTPS and process it as a stream.
32
32
-`custom-handler.ts` – Implement a bespoke `ContentHandler` that logs SAX events.
33
33
@@ -38,7 +38,7 @@ To explore the most common scenarios directly:
38
38
-`npm run parse-file` – build the samples and print a quick DOM traversal of the catalog-backed library.
39
39
-`npm run stream-parse` – build the samples and fetch a remote XML document over HTTPS, printing the raw payload.
40
40
-`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.
0 commit comments