Comments (8)
I think processing instructions not covered yet
from fast-xml-parser.
Sorry for the late response. It is a festive season here. As @Delagen said, it is not covered yet. It's a very small change. I'll publish the changes on Monday.
from fast-xml-parser.
Please use 3.4.0
from fast-xml-parser.
@amitguptagwl i can't find a reference on how to access the processing instructions. Is it correct to say that only the validator is aware of it? I would like to access the processing instructions after validation as well, they contain valuable info.
from fast-xml-parser.
Validator is checking for valid syntax of PI. And parser is ignoring them to read. Can you please tell me some use case where you feel you want keep their data and the desire format of the data. We can plan to include it into v4.
from fast-xml-parser.
@amitguptagwl thanks for the quick reply. PI's do have a dedicated purpose, normally it is a connection between XML authors and the xml-aware application [1].
My use case is that I receive an XML from someone else. This author decided to use PI's to embed metadata of the XML. One could argue that the purpose of PIs is not related to metadata and the author could've chosen to embed that metadata in a real tag, but this is where we are and technically the author is complying with the XML standard.
Further, it seems to me that a parser reading a valid xml should return to me all the information in there, including the PI, which is part of XML standard. Sadly, as XML popularity declines it seems to me there are not many robust parsers out there who do take PIs into account as it may be more of an obscure use case in 2020, I've only found hobby parser projects that do keep PI's in the JSON output.
Regarding the desired format, I think continuing with fast-xml-parser standard would be best, that is, in similarity to using the attr
keyword, the PIs could be packed as an array with a relevant keyword such as instr
. They should follow the same nesting rules as attr
if possible.
Let me know if this makes sense or if I can provide more specific examples.
[1] https://docstore.mik.ua/orelly/xml/xmlnut/ch17_02.htm
from fast-xml-parser.
I have created another issue to track it
from fast-xml-parser.
Please check v4.0.0-beta.6
from fast-xml-parser.
Related Issues (20)
- Parsing an invalid XML element
- isArray behavior on missing/empty tags HOT 1
- TypeError: Cannot read properties of undefined (reading 'tagName') when parsing closing tag without an opening tag at the start of XML document HOT 3
- V3 to V4 migration guide? HOT 5
- Circular Dependency Error While trying to validate xml HOT 3
- Online demo does not handle DOCTYPE correctly and gives an error HOT 2
- Regex Injection Via Doctype Entities HOT 4
- unreliable for parsing html HOT 2
- Introduce isObject option for unpaired tags HOT 2
- Parsing of Empty Tags HOT 4
- Entities are being processed in CDATA sections HOT 1
- Attribute in oneListGroup is not parsed correctly HOT 1
- All special characters are not correctly parsed HOT 4
- Ability to read & write DOCTYPE information HOT 2
- parser malfunctions when textNodeName is the same as a tag name HOT 8
- Node attributes get lost on XML parsing HOT 1
- Decimal point is not preserved after parsed to json. HOT 6
- Difficulty treating some numeric tags as string HOT 2
- XML parse looks good on Online tool, but when using API crashes HOT 2
- Any tag which has a format like <!D%s> where %s - any sequence of characters is perceived as <!DOCTYPE> and causes error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fast-xml-parser.