Unexpected close tag line 5 column 7 char ошибка

When running the command cordova platform add android, I get a bunch of errors popping up in the terminal.

Caelans-MBP:HiltonExtraordinaryFB Caelan$ cordova platform add android
Creating android project...
Creating Cordova project for the Android platform:
    Path: platforms/android
    Package: com.phonegap.hiltonsimplyfb
    Name: Hilton F&B
    Android target: android-19
Copying template files...
Project successfully created.
Error: Unexpected close tag
Line: 8
Column: 12
Char: >
    at error (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:347:8)
    at strictFail (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:364:22)
    at closeTag (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:523:7)
    at Object.write (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:948:29)
    at XMLParser.feed (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/parsers/sax.js:48:15)
    at ElementTree.parse (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:263:10)
    at Object.exports.XML (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:593:13)
    at Object.module.exports.parseElementtreeSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:126:38)
    at android_parser.update_from_config (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/android_parser.js:221:23)
    at android_parser.update_project (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/android_parser.js:349:14)
Caelans-MBP:HiltonExtraordinaryFB Caelan$ 

Is there any way I can resolve these errors so I can continue.

asked Feb 5, 2015 at 11:20

thephpdev's user avatar

Without seeing your config.xml file it’s hard to troubleshoot, but I’ll bet it’s the name of your app:

Name: Hilton F&B

Since config.xml must be valid XML, make sure you’re using the & ampersand entity and not a raw ampersand, which has meaning in XML syntax.

answered Mar 23, 2015 at 14:55

Jough Dempsey's user avatar

1

I also had the same issue and wanted to share my experience. The problem was Unexpected close tag, in your config.xml file you forgot to close one or two tags, if you look at the line which is shown as error, there is not error even, but somewhre in your config.xml file there is tag not closed. Please, make sure all tags have closed correctly.

answered Aug 10, 2017 at 9:53

Doston's user avatar

DostonDoston

5596 silver badges15 bronze badges

1

In my case, I was missing one closing tag in the string that I was parsing to XML. It had a starting tag not closing tag.
Make sure to check all the Tags have starting and closing tags.

If you have XML on runtime and cannot be checked manually, You can use an amazing npm package which provide validate method to check if XML is valid.

npm link: https://www.npmjs.com/package/fast-xml-parser

example:

const { XMLValidator } = require('fast-xml-parser');
const result = XMLValidator.validate(
  "<root>Run the , ...' >/etc/hosts.allow where each <net>/<mask> combination (for example, '192.168.1.0/255.255.255.0') represents one network block in use by your organization that requires access to this system</root>",
  {
    allowBooleanAttributes: true,
  }
);

Just sharing, might be helpful for someone.

answered Jan 18, 2022 at 13:59

Waleed Ahmad's user avatar

After updating the software by running «npm install -g plex-sync» on a working machine, I am now getting the following errors.

Progress: | Elapsed: 0.0s | 100% Error: Unexpected close tag Line: 5 Column: 7 Char: > at error (/usr/local/lib/node_modules/plex-sync/node_modules/sax/lib/sax.js:667:10) at strictFail (/usr/local/lib/node_modules/plex-sync/node_modules/sax/lib/sax.js:693:7) at closeTag (/usr/local/lib/node_modules/plex-sync/node_modules/sax/lib/sax.js:887:9) at SAXParser.write (/usr/local/lib/node_modules/plex-sync/node_modules/sax/lib/sax.js:1452:13) at Parser.exports.Parser.Parser.parseString (/usr/local/lib/node_modules/plex-sync/node_modules/xml2js/lib/xml2js.js:508:31) at Parser.parseString (/usr/local/lib/node_modules/plex-sync/node_modules/xml2js/lib/xml2js.js:7:59) at exports.parseString (/usr/local/lib/node_modules/plex-sync/node_modules/xml2js/lib/xml2js.js:540:19) at /usr/local/lib/node_modules/plex-sync/lib/plex.js:42:29 at F (/usr/local/lib/node_modules/plex-sync/node_modules/core-js/library/modules/_export.js:35:28) at parseXML (/usr/local/lib/node_modules/plex-sync/lib/plex.js:41:10) (node:4974) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Unexpected close tag Line: 5 Column: 7 Char: > (node:4974) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

При запуске командной cordova platform add android, я получаю кучу ошибок, возникающих в терминале.

Caelans-MBP:HiltonExtraordinaryFB Caelan$ cordova platform add android
Creating android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.phonegap.hiltonsimplyfb
Name: Hilton F&B
Android target: android-19
Copying template files...
Project successfully created.
Error: Unexpected close tag
Line: 8
Column: 12
Char: >
at error (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:347:8)
at strictFail (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:364:22)
at closeTag (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:523:7)
at Object.write (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:948:29)
at XMLParser.feed (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/parsers/sax.js:48:15)
at ElementTree.parse (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:263:10)
at Object.exports.XML (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:593:13)
at Object.module.exports.parseElementtreeSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:126:38)
at android_parser.update_from_config (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/android_parser.js:221:23)
at android_parser.update_project (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/android_parser.js:349:14)
Caelans-MBP:HiltonExtraordinaryFB Caelan$

Есть ли способ разрешить эти ошибки, чтобы продолжить.

Не видя ваш файл config.xml трудно устранить неполадки, но я ставлю на это имя вашего приложения:

Имя: Hilton F & B

Поскольку config.xml должен быть действительным XML, убедитесь, что вы используете & амперсанд, а не сырой амперсанд, имеющий смысл в синтаксисе XML.

У меня также была такая же проблема и я хотел поделиться своим опытом. Проблема заключалась в том, что в вашем файле config.xml вы забыли закрыть один или два тега, если вы посмотрите на строку, которая отображается как ошибка, нет ошибки, даже если в вашем файле config.xml есть тег не закрыт. Пожалуйста, убедитесь, что все теги были закрыты правильно.

Введите минимум 50 символов

Я использую grunt-spell для проверки HTML-файлов jekyll _site после сборки. Он всегда работает нормально с первым файлом, а затем с ошибками во всех других файлах, кроме одного с Error: Unexpected close tag Line: 5 Column: 7 Char: >, интересно то, что все эти файлы сделаны из шаблона и имеют идентичные первые 10 строк.

Если я удалю первый файл, то второй файл работает нормально. Если я удалю первые два файла, третий файл будет работать нормально и так далее. Мне кажется тут ошибка в хрюкающем заклинании, или в учителе. Любые идеи, как это исправить или обойти это?

Вот моя хрюкающая запись:

    spell: {
             files: ['./_site/**/*.html']
    }

2 ответа

grunt-spell может проверять орфографию только в текстовых документах. Вам нужно будет сначала извлечь текст из HTML, а затем передать его grunt-spell.

Для обычных типов документов, html, уценки и т. д. было бы неплохо автоматически анализировать текст с возможностью проверки орфографии. Здесь есть открытая проблема: https://github.com/shama/grunt- заклинание/вопросы/7


0

Kyle Robinson Young
27 Июн 2014 в 06:33

Я работаю над этим, комментируя и раскомментируя по одному :(

            spell: {
//                     files: ['./_site/404.html']
//                     files: ['./_site/About/index.html']
//                     files: ['./_site/for-businesses/index.html']
                    files: ['./_site/for-developers/index.html']
//                    files: ['./_site/for-individuals/buy/index.html']
//                    files: ['./_site/for-individuals/faq/index.html']
//                    files: ['./_site/for-individuals/index.html']
//                    files: ['./_site/index.html']

                     //files: ['./_site/**/*.html']
            }

Кайл выяснил, что эта проблема вызвана тем, что After the Deadline API выдает 503. Я думаю, что это можно исправить, используя grunt-filetransform и захват имени файла, но я просто переключаюсь на gulp

У меня проверка орфографии работает лучше, чем в Grunt. См. здесь, если вам интересно: Как вывести результаты gulp на консоль?


0

Community
23 Май 2017 в 13:27

@jgrodskiy-donlen

  1. Just attempted to use with test xml/xsd

test_xml.zip

Atom Version: 1.5.3
System: Microsoft Windows 8.1 Enterprise
Thrown From: linter-xmllint package, v1.3.2

Stack Trace

Uncaught Error: Unexpected close tag
Line: 3
Column: 6
Char: >

At events.js:141


Error: Unexpected close tag
Line: 3
Column: 6
Char: >
    at error (atompackageslinter-xmllintnode_modulessaxlibsax.js:666:10)
    at strictFail (atompackageslinter-xmllintnode_modulessaxlibsax.js:692:7)
    at closeTag (atompackageslinter-xmllintnode_modulessaxlibsax.js:885:9)
    at Object.write (atompackageslinter-xmllintnode_modulessaxlibsax.js:1444:13)
    at SAXStream.write atompackageslinter-xmllintnode_modulessaxlibsax.js:238:18)
    at ReadableString.ondata (_stream_readable.js:525:20)
    at emitOne (events.js:77:13)
    at ReadableString.emit (events.js:169:7)
    at ReadableString.Readable.read (_stream_readable.js:360:10)
    at flow (_stream_readable.js:733:26)
    at resume_ (_stream_readable.js:713:3)
    at doNTCallback2 (node.js:441:9)
    at process._tickCallback (node.js:355:17)

@dirk-thomas

I have tried to open you xml file with the same version and I get one marker with:

Opening and ending tag mismatch: cat line 3 and zoo at line 4 column 7

That looks like the expected output to me. Since the xml file is not wellformed the linter should / does not even trigger the sax parser (

validateIfWellFormed = (messages) ->
if messages.length
return messages
return linter.checkValid textEditor

). So I am not sure how you got the stacktrace.

Can you please run the following commands on your command line and post the output:

xmllint --version
xmllint --noout test.xml

@jgrodskiy-donlen



Copy link


Contributor


Author

So I get a crash the moment i start typing a tag and no validation.

xmllint: using libxml version 20903
   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug Zlib
D:tmpschema_crap>xmllint --noout test.xml
test.xml:4: parser error : Opening and ending tag mismatch: cat line 3 and zoo
</zoo>
      ^
test.xml:5: parser error : Premature end of data in tag zoo line 2

ezgif-1899626102

@dirk-thomas

Your xmllint reports correctly that the file is not well formed. After that I doesn’t run sax (which would fail to parse the text as it does for you). I can’t reproduce the problem — it behaves correctly without a stacktrace showing an error marker in the document with the message from xmllint.

I don’t have any better idea then the following to troubleshoot:

  • can you post the content of ~/.atom/packages/linter-xmllint/lib/init.coffee (e.g. in a gist)
  • can you try to uninstall and reinstall linter-xmllint

@jgrodskiy-donlen



Copy link


Contributor


Author

@dirk-thomas

Yeah, since I can’t reproduce it but it happens repeatably on your machine it would be great to try some debugging. My guess is that despite xmllint working correctly for you no messages are being extracted (which means no problem is detected) and then the sax parser is started and fails on the not wellformed input.

Please add the following debug statements (you can easily uninstall / reinstall the package afterwards):

  • before line 68 insert

    console.log 'content = "' + output + '"'

  • before line 71 insert

    console.log 'messages.length = ' + messages.length

Restart atom, edit your xml file as before and then open View -> Developer -> Toggle Developer Tools and look in the console tab and share the two printed line. Thanks.

@jgrodskiy-donlen



Copy link


Contributor


Author

Here it is.

So the crash happens on the ‘<‘ itselfs. After just putting that in and saving and running xmllint directly
test.xml:3: parser error : StartTag: invalid element name

image

@dirk-thomas

But what is the message count? Please make sure you put the debug message in the right line and be aware that the line numbers change when inserting the other message.

@jgrodskiy-donlen



Copy link


Contributor


Author

Sorry, forgot to follow up.
It crashes in parseMessages

I see it go in to the method but not into the regex forEach. Here is what I added below to to mine.

parseMessages: (output) ->
    console.log "Insided parseMessages"
    console.log arguments;
    XRegExp ?= require('xregexp').XRegExp
    messages = []
    regex = XRegExp(
      '^(?<file>.+):' +
      '(?<line>\d+): ' +
      '(?<type>.+) : ' +
      '(?<message>.+)[\r?\n]' +
      '(?<source_line>.*)[\r?\n]' +
      '(?<marker>.*)\^$', 'm')
    XRegExp.forEach output, regex, (match, i) ->
      console.log "Inside XRegExp forEach"
      line = parseInt(match.line) - 1
      column = match.marker.length
      console.log "Line = " + line
      console.log "column = " + column
      messages.push({
        type: 'Error'
        text: match.message
        filePath: match.file
        range: [[line, column], [line, column]]
      })
    return messages

image

@jgrodskiy-donlen



Copy link


Contributor


Author

This is what the regex object is to me

/^(.+):(d+): (.+) : (.+)r?nr?n^$/m

Which looks nothing like the constructor to me…

@jgrodskiy-donlen



Copy link


Contributor


Author

Actually,
I think my message format is different from what you are expecting and it is not matching it. The one that comes from xmllint directly looks correct.

@dirk-thomas

Can you please try to remove the brackets around the newline matching part([\r?\n]). So the regex looks like this:

regex = XRegExp(
      '^(?<file>.+):' +
      '(?<line>\d+): ' +
      '(?<type>.+) : ' +
      '(?<message>.+)\r?\n' +
      '(?<source_line>.*)\r?\n' +
      '(?<marker>.*)\^$', 'm')

@jgrodskiy-donlen



Copy link


Contributor


Author

And that did it :-).

Should it be validating against the schema also? Or just basic xml syntax.

@dirk-thomas

As long as the content is not well conformed it can only check for that. Simply because it requires valid xml to perform validation. Once it is well conformed xml it will also run the validation against the dtd / xsd/ relax / schematron.

I created #49 with the patch described.

@jgrodskiy-donlen



Copy link


Contributor


Author

Alright so going back to the schema I sent above.

If you put tags It becomes a well-formed but not valid by the provided xsd standards. (You will have to change the location of the schema possibly to test locally).

@dirk-thomas

The fix is available in the new released version 1.3.3. Thanks for helping to debug this on Windows.

@dirk-thomas

Using a relative location for the schema (e.g. xsi:noNamespaceSchemaLocation="test.xsd") should work fine.

@jgrodskiy-donlen



Copy link


Contributor


Author

Hate to do this to you but it’s not working for me :(

I can open another bug for this if you want and point me to the general area to debug and I can get you more info.

image

@dirk-thomas

I get a marker behind the opening tag saying:

Element 'cat': This element is not expected. Expected is ( animal ). (test.xsd)at line 3 col 7

Have you installed the new version? Can you please try to add debug messages in the code to trace if the xsd validation is triggered, what the output is and then why no messages are matched?

Some pointers to relevant locations are:

  • checkValid: (textEditor) ->
  • validateSchema: (textEditor, argSchemaType, schemaUrl) ->
  • if argSchemaType is —schematron
  • parseSchemaMessages: (textEditor, output) ->

@dirk-thomas

  • Uncaught in promise ошибка 400
  • Unb ошибка на стиральной машине leran
  • Unb ошибка на стиральной машине haier что это означает
  • Unb ошибка на стиральной машине haier как сбросить ошибку
  • Unb ошибка на стиральной машине dexp