Home > Net >  C # to judge whether XML have closing tags?
C # to judge whether XML have closing tags?

Time:09-15


A:


B:


1: how to judge whether A of the lack of "& lt;/flaw>" Whether the lack of "/" the end tag of an and B, thank you.

CodePudding user response:

Regular expression of reference balance recursive matched group: https://blog.csdn.net/wujingang/article/details/70546857


And, of course, the more simple way, but since you are writing your own framework source code too much, here is not convenient to send, can direct messages I sent you!

CodePudding user response:

XElement xmlTree=XElement. Parse (" & lt; Flaw strip=\ \ "2" job=\ "123 " & gt;" );

Do not conform to the rules, will directly

CodePudding user response:

Take exception to check if you don't think so, go directly to search on nuget "XmlParser can
"
Ps: keyword Parser, in theory, any grammar parsing keywords is a Parser, in theory we can make any kind of language, grammar and language struggle is futile, such as your problem, if you really want to own a is not difficult, at least somebody else has to provide a complete tool

For example:
1. Install the jse
2. Give vs anltrvsix plug-in installation
3. Who will build a project, nuget install Antlr4. Runtime. Standard, Antlr4BuildTasks
4. Go to https://github.com/antlr/grammars-v4/tree/master/download G4 of XML documents, on the project, and then select compile attribute "Anltr4
"5. Compile once, an XML parsing file is done

Actually, another post, "arithmetic" is a story, "arithmetic" grammar check and interpretation is also a kind of grammar, the parser is, of course, his trouble points than you, you only need to check, had letex grammar check rules, the arithmetic is involve the grammar check, parser to VST, VST visitor model to generate actual operation code, that posts the ans don't want to reply, because in some people's opinion, the ans to reply is "hit the newcomer, show off technology"

CodePudding user response:

Abnormal XML directly after you load an error... Just try catch haha
  •  Tags:  
  • C#
  • Related