fabianlauer / tsxml Goto Github PK
View Code? Open in Web Editor NEWA small XML parser and serializer. No dependencies, no hassle.
License: MIT License
A small XML parser and serializer. No dependencies, no hassle.
License: MIT License
It appears that parsing input which contains an unterminated XML comment causes tsxml to begin traversing beyond the end of the string searching for the closing token. I’m hoping to work on reproducing this and coming up with a fix soon!
For example, when parsing this:
<alpha />
the serialisation will output:
<alpha></alpha>
This is because the parser/AST do not store whether nodes in source code were self closing or not.
To be able to parse HTML, support for "void elements" is necessary. These elements do not require a closing tag or closing slash, for example:
<meta charset="utf-8">
To support these elements, the parser will need a list of tag names where this is allowed (or even enforced). Without such a list, the parser can not determine whether a void element is one on purpose or whether the missing closing tag or slash is actually syntax error.
The list of void tags for HTML5 can be found here:
https://www.w3.org/TR/html-markup/syntax.html#syntax-elements
Instances of DocumentNode
should provide information about DOCTYPEs and XML versions to user code so the user doesn't have to process literals and attributes in MDOs and PIs themselves.
There should be a way to limit the line length and insert a line break after a certain number of characters, eg:
<a>
<values alpha="1" beta="2" delta="3"
gamma="4" />
</a>
When parsing PIs, the parsed ast nodes always get an attribute with undefined
value and an empty string as attribute name. When serialized again, something similar to this appears:
<?alpha ="undefined" ?>
See FabianLauer/vs-code-xml-format#7:
A node like
<system.webServer> <!-- .... --> </system.webServer>
Will cause an error and will not format the document.
XML formatting failed: at line #, column #; expected whitespace or end of opening tag.
I have tried to use Ternary Operators with expression using <
and I got the error above, but not when using something like that !=
:
XML formatting failed: at line 13, column 76: expected exclamation mark, question mark or alphabetic tag name.
<StackLayout>
<Label text="label using < " visibility="{{ p.cond < 1 ? 'visible' : 'collapsed' }}" />
<Label text="label using != " visibility="{{ p.cond != 1 ? 'visible' : 'collapsed' }}" />
</StackLayout>
This makes the XML invalid - Tried on SOAP request.
They throw a syntax error although clearly they shouldn't. See da85440.
In cases where MDOs have both literals and attributes, an attribute with an empty name is parsed.
From FabianLauer/vs-code-xml-format#6:
An attribute like:
<absPath url="D:\Users\kgunders\Documents\MR\Projects\HyperLinkSheets"
Will cause the following error:
XML formatting failed: at line 2, column 694: namespace prefix must be followed by a tag name.
Here is more context from the problematic XML:
<Choice Requires="x15"> <absPath url="D:\Users\kgunders\Documents\MR\Projects\HyperLinkSheets\" xmlns:x15ac="http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac" /> </Choice>
A work around is to temporarily add a character after the backslash, format, and remove the extra character.
Original issue: FabianLauer/vs-code-xml-format#4
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.