Open ewlsh opened 1 year ago
We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.
Do you mean tag index line number, or line number with col number? There is a plan to add tag index in v5.
Do you mean tag index line number, or line number with col number? There is a plan to add tag index in v5.
@amitguptagwl I'm looking for startIndex
(and maybe endIndex
), I can calculate lines and columns off of that value.
Currently I'm doing something like this against ^4.0.0-beta.2
/// Temporarily construct our own Xml parser from fast-xml-parser which preserves start indices
import { parseToOrderedJsObj } from 'fast-xml-parser/src/xmlparser/OrderedObjParser';
import { buildOptions } from 'fast-xml-parser/src/xmlparser/OptionsBuilder';
import XmlNode from 'fast-xml-parser/src/xmlparser/xmlNode';
import { ParseResult } from '../parse';
const addChild = XmlNode.prototype.addChild;
XmlNode.prototype.addChild = function _addChild(node) {
addChild.call(this, node);
this.child[this.child.length - 1].$startIndex = node.startIndex ?? null;
};
There is a plan to add tag index in v5.
Is there an issue for this I can follow?
The $startIndex
approach listed here seems like it would be a helpful inclusion, behind an option of course.
The development of version 5 is not up to the speed as I'm spending more time with other open source development.
Description
Feature request to have a way to include metadata such as
startIndex
in the parser outputPotentially related: https://github.com/NaturalIntelligence/fast-xml-parser/issues/345
Background
I'm working on a project that uses
fast-xml-parser
to parse XML files, it needs to report where a certain string was found in a given file. To support this I'm currently monkeypatchingXmlNode
: https://github.com/ewlsh/tree-gettext/blob/main/src/languages/xml.ts#L11Would you like to work on this issue?
I am open to contributing but am submitting this feature request first to gather input.
Bookmark this repository for further updates. Visit SoloThought to know about recent features.