Привет форумчане!Пытаюсь загрузить данные из XML в 1С. Вылетает с такой ошибкой:
Ошибка при вызове метода контекста (Прочитать)
Пока Файл.Прочитать() Цикл
по причине:
Ошибка разбора XML: — [9,6]
Фатальная ошибка:
StartTag: invalid element name
В самом файле XML как раз на цифровой тег ругается, руками если поправить на любое другое имя не числовое, грузит нормально тогда.
<?xml version=’1.0′ encoding=’windows-1251′?>
<root>
<header>
<fileName>тут был путь к файлу</fileName>
<fileNumber>1</fileNumber>
<objList>орг,1</objList>
<docName>finDocument</docName>
<version>15.0 Revision: b43d543f5e7f</version>
<2109> rls date: 18.08.03 18:20 </2019>
<exportDate>01/03/2018</exportDate>
<exportTime>11:36:49</exportTime>
<baseNum>0</baseNum>
<dateFrom>28/02/2018</dateFrom>
Как выйти из этой ситуации? Сам файла сваливается из другой системы. Мб как в 1С это дело обойти можно не правя каждый раз файл руками?
The document basically has «catalog» as the root tag with child tags of «movie» followed by one or more «actor». Each of these child tags further contains more child tags. I was supposed to make a DTD for this based on some rules given, but it is just rejecting whatever I put at the beginning of the doucment. Any help?
Here is the XML code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE catalog SYSTEM "catalog.dtd">
<catalog>
<movie movieID="m0100" genre="drama">
<title>Monster's Ball</title>
<year>2001</year>
<length>111 minutes</length>
<topBilledActors actorIDs="a0100 a0102" />
</movie>
<actor actorID="a0100" oscarWinner="yes">
<name>Halle Berry</name>
<date>August 14, 1966</date>
<birthplace>Cleveland, Ohio</birthplace>
<role character="Leticia Musgrove" movie="m0100" />
<role character="Storm" movie="m0101" />
</actor>
<actor actorID="a0102" oscarWinner="yes">
<name>Billy Bob Thornton</name>
<role character="Hank Grotowski" movie="m0100" />
</actor>
<movie movieID="m0101" genre="fantasy">
<title>X-Men</title>
<year>2000</year>
<length>104 minutes</length>
<topBilledActors actorIDs="a0100 a0103" />
</movie>
<actor actorID="a0103" oscarWinner="no">
<name>Ian McKellen</name>
<role character="Magneto" movie="m0101" />
<role character="Gandolf" movie="m0105" />
<role character="Gandolf" movie="m0107" />
</actor>
<movie movieID="m0105" genre="action" earningsRank="17">
<name>Lord of the Rings: The Fellowship of the Ring</name>
<date>2001</date>
<length>178 minutes</length>
<topBilledActors actorIDs="a0103" />
</movie>
<movie movieID="m0107" genre="action" earningsRank="8">
<name>Lord of the Rings: The Return of the King</name>
<date>2003</date>
<length>201 minutes</length>
<topBilledActors actorIDs="a0103" />
</movie>
<actor actorID="a0101" oscarWinner="yes">
<name>Tom Hanks</name>
<date>July 9, 1956</date>
<birthplace>Concord, California</birthplace>
<role character="Captain John H. Miller" movie="m0102" />
<role character="Forrest Gump" movie="m0103" />
<role character="Andrew Beckett" movie="m0104" />
</actor>
<movie movieID="m0102" genre="action" earningsRank="50">
<name>Saving Private Ryan</name>
<date>1998</date>
<length>170 minutes</length>
<topBilledActors actorIDs="a0101 a0104" />
</movie>
<actor actorID="a0104" oscarWinner="yes">
<name>Matt Damon</name>
<date>October 8, 1970</date>
<birthplace>Cambridge, Massachusetts</birthplace>
<role character="Private James Francis Ryan" movie="m0102" />
</actor>
<movie movieID="m0103" genre="comedy" earningsRank="14">
<name>Forrest Gump</name>
<date>1994</date>
<length>142 minutes</length>
<topBilledActors actorIDs="a0101 a0105 a0106" />
</movie>
<actor actorID="a0105" oscarWinner="yes">
<name>Sally Field</name>
<birthplace>Pasadena, California</birthplace>
<role character="Mrs. Gump" movie="m0103" />
</actor>
<actor actorID="a0106">
<name>Gary Sinise</name>
<role character="Lt. Dan Taylor" movie="m0103" />
<role character="Ken Mattingly" movie="m0106" />
</actor>
<movie movieID="m0104" genre="drama">
<name>Philadelphia</name>
<date>1993</date>
<length>125 minutes</length>
<topBilledActors actorIDs="a0101 a0107" />
</movie>
<movie movieID="m0106" genre="drama">
<name>Apollo 13</name>
<date>1995</date>
<length>140 minutes</length>
<topBilledActors actorIDs="a0101 a0106" />
</movie>
<actor actorID="a0107" oscarWinner="yes">
<name>Denzel Washington</name>
<role character="Joe Miller" movie="m0104" />
</actor>
</catalog>
Here is the DTD file:
<!ELEMENT catalog (movie, actor+)*>
<!ELEMENT movie (title, year, length, topBilledActors)>
<!ATTLIST movie movieID ID #REQUIRED>
<!ATTLIST movie genre (fantasy | action | drama | comedy) #REQUIRED>
<!ATTLIST movie earningsRank CDATA #IMPLIED>
<!ELEMENT title (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT length (#PCDATA)>
<!ELEMENT topBilledActors EMPTY>
<!ATTLIST topBilledActors ActorIDs IDREFS>
<!ELEMENT actor (name, date*, birthplace*, role+)>
<!ATTLIST actor actorID ID #REQUIRED>
<!ATTLIST actor oscarWinner (yes|no) "no">
<!ELEMENT name (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT birthplace (#PCDATA)>
<!ELEMENT role EMPTY>
<!ATTLIST role character CDATA>
<!ATTLIST role movie IDREF>
EDIT: I am verifying this with the XML validator at http://www.w3schools.com/xml/xml_validator.asp
My web browser (IE) does not display the file and gives the error:
Required white space was missing. Error processing resource 'file:///C:/Documents and Settings/Administrator/Desktop/...
<!ATTLIST topBilledActors ActorIDs IDREFS>
@c-x,
Looking at what you’ve described so far, I’m having a bit of trouble figuring out how callTaxiiService2
would be where the code is failing.
First, you mention StartTag: invalid element name, line 555, column 2
, which has a few hints:
- The invalid element name is an XML parse error, and the code you show does not attempt to parse XML until the line that reads
taxii_message = t.get_message_from_http_response(resp, poll_req.message_id)
- The error location is
line 555, column 2
, which seems to indicate that the error is in a Poll Response. TAXII Poll Requests like the one the above code creates are only a few lines (maybe 10-15 if you pretty print it). If the error is in fact in a Poll Response, that means you are getting a response from the server.
Second, you mention that the error occurs when libtaxii is processing an addinfourl
object. addinfourl
objects are returned by callTaxiiService2
(specifically libtaxii’s underlying use of urllib2.urlopen
), which leads me to think that the callTaxiiService2
returned successfully. If that function failed, I do not have an explanation as to how you’d have a handle on the return object.
The t.get_message_from_http_response(resp, poll_req.message_id)
line parses XML from the HTTP Response (encapsulated in an addinfourl
object) [1] [2].
I can replicate the error you are getting with the following code (note the extraneous begin bracket <
):
from lxml import etree etree.XML('<hello><</hello>') # Traceback (most recent call last): # File "<stdin>", line 1, in <module> # File "lxml.etree.pyx", line 3072, in lxml.etree.XML (srclxmllxml.etree.c:70460) # File "parser.pxi", line 1828, in lxml.etree._parseMemoryDocument (srclxmllxml.etree.c:106689) # File "parser.pxi", line 1716, in lxml.etree._parseDoc (srclxmllxml.etree.c:105478) # File "parser.pxi", line 1086, in lxml.etree._BaseParser._parseDoc (srclxmllxml.etree.c:100105) # File "parser.pxi", line 580, in lxml.etree._ParserContext._handleParseResultDoc (srclxmllxml.etree.c:94543) # File "parser.pxi", line 690, in lxml.etree._handleParseResult (srclxmllxml.etree.c:96003) # File "parser.pxi", line 620, in lxml.etree._raiseParseError (srclxmllxml.etree.c:95050) # lxml.etree.XMLSyntaxError: StartTag: invalid element name, line 1, column 9
Based on that, my bet is that the STIX content in the Poll Response has an extra begin bracket (therefore being invalid XML) and that’s what’s blowing up.
As @gtback mentioned to me offline, libtaxii can do a much better job of handling processing errors. So regardless of this issue’s resolution, I’ll open an issue for that.
@c-x — I don’t mean to disagree too much, but I’m having trouble arriving at your conclusion with the evidence you’ve provided. I’ve attempted to explain my thought process so that we can reach a conclusion about what’s happening and the best way to fix it. I realize I’m not coming from the debug logs (like you are), but rather an understanding of the code, so I may be missing a key piece of information.
Thank you.
-Mark
[1] https://github.com/TAXIIProject/libtaxii/blob/master/libtaxii/__init__.py#L96
[2] https://github.com/TAXIIProject/libtaxii/blob/master/libtaxii/messages_11.py#L87
Пользователь 250059 Заглянувший Сообщений: 20 |
#1 0 06.02.2015 16:52:43 Добрый день, у меня на сайте есть структура разделов, я хочу перенести её в дерево групп 1С
Возможно кто нибудь производил такие действия и знает, что делать. |
||
Пользователь 30123 Эксперт Сообщений: 904 |
А вы это пытаетесь сделать не через помощник импорта каталога из Битрикс в 1С? Попробуйте сделать через Помощник. Там группы загружаются в начале, а товары можно и не загружать, если они там вместе с группами вам не нужны. |
Пользователь 250059 Заглянувший Сообщений: 20 |
Нет хотелось по другому. http://prntscr.com/62x6aa Структура на сайте и в 1с отличаются. http://prntscr.com/62x6r8 Но не могу создать подходящий XML файл структуры в битриксе. |
Пользователь 30123 Эксперт Сообщений: 904 |
Holster_int, ах, вот оно что. Объяснить, как сделать — не смогу. Но если хотите — помогу. Обращайтесь в личку. |
Пользователь 316476 Заглянувший Сообщений: 1 |
Добрый день. Проблема с помощником импорта с сайта в 1с и при импорте пишет: Как с этим боротся??? Не могу загрузить товары |
Александр Денисюк
Администратор Сообщений: 4917 |
#6 0 27.02.2015 18:43:13
Найдите этот файл и смотрите, где нечитаемые символы XML. Ну а потом правьте данные в БУС |
||
Доброй ночи,уважаемые!!!
Бухгалтерия предприятия, редакция 3.0 (3.0.43.213) (http://v8.1c.ru/buhv8/)
Copyright (С) ООО «1C-Софт», 2009 — 2016. Все права защищены
(http://www.1c.ru)
1С:Предприятие 8.3 (8.3.8.1652)
суть вопроса такова :после обновления программы не могу зайти в главное-организации и зайти в саму организацию ,выдает такую ошибку
13.05.2016 0:07:15 Ошибка разбора XML: — [1,18622] Фатальная ошибка: StartTag: invalid element name ,у кого-то было подобное? спасибо
и появилось обновление до версии редакция 3.0 (3.0.43.214 ) .пыталась обновиться ,крутится колесико и выбрасывает из программы
Заранее всем спасибо за помощь
г. Благовещенск173 360 баллов
Добрый день!
Проведите ремонт через конфигуратор.
Конфигуратор — Администрирование — Тестирование и исправление.
Заполнить и подать уведомление об исчисленных суммах налогов и взносов
Доброе утро!!!
это я уже делала,не помогает ,также я делала запуск файла chdbfl.exe, который находится в bin-папке конфигурации, это тоже не помогает
А если откатиться на базу, сохраненную перед обновлением на 213?
(Предупреждение — новичок asp) У меня есть файл aspx с тегом
<%@ Page Language=VB ... %>
В самом начале файла.
При вызове этого с моего сервера IIS (http: //localhost/myservice/default.aspx) это дает мне ошибку
This page contains the following
errors:error on line 1 at column 2:
StartTag: invalid element name
Below is a rendering of the page up to
the first error.
Что я делаю не так?
Перейти к ответу
Данный вопрос помечен как решенный
Ответы
7
Создается впечатление, что браузер пытается отобразить то, что, по его мнению, является файлом XML, поскольку выдает ошибку на втором символе первой строки. Поэтому я думаю, что файл не анализируется, а просто немедленно возвращается как есть. Убедитесь, что ваш сервер IIS настроен правильно и действительно ли он анализирует ваши теги ASP перед возвратом страницы.
Когда я перешел на вкладку ASP.NET для виртуального каталога, я заметил, что версия ASP.NET не была выбрана (это было пустое поле со списком). Выбор версии .NET framework сделал свое дело. Спасибо.
Как и в предыдущем комментарии, в моей настройке тоже не была выбрана версия ASP.NET. Но после выбора версии я получил следующую ошибку при доступе к файлу aspx.
Windows XP, IIS 5.1.
Сведения об исключении: System.Web.Hosting.HostingEnvironmentException: не удалось получить доступ к метабазе IIS.
Выполнил следующие команды, aspnet_iis -i
и aspnet_iis -ga
Решил проблему.
Когда я это сделал. Работало нормально.
Перейдите в эту директорию в командной строке C: WINDOWS Microsoft.NET Framework v2.0.50727
Запустите эту команду
Aspnet_regiis -I
Это установит aspnet
Попробуй это :
Чтобы установить и включить ASP.NET:
Щелкните Пуск, а затем щелкните Панель управления.
Щелкните «Установка и удаление программ».
Щелкните Добавить / удалить компоненты Windows.
Дважды щелкните Сервер приложений, а затем щелкните Подробности.
Установите флажок ASP.NET и нажмите кнопку ОК.
Нажмите «Далее.
Щелкните Готово.
Для меня проблема заключалась в том, что я просматривал файл .svc, используя свой локальный путь к файлу, сопоставленный с сервером в моем браузере, когда я хотел использовать дословный путь к моему серверу.
Для меня проблема заключалась в сериализации, которая отвечала клиенту.
Моя проблема заключалась в пространствах тегов xml:
- < tag > text < / tag > ---> wrong
- <tag> text </tag> ----> good.
Другие вопросы по теме
- Remove From My Forums
-
Question
-
User1632842107 posted
I connect my aspx page from html by ‘href‘ link. My index page is in
.html extension and my Login page in .aspx extension.When i run my Web pages without debug(Ctrl + F5) from Visual Studio it
works fine and i don’t get this error
«Error on line 1 at column 2: StartTag: invalid element name».When i open my Index.html file form local directory and Click on Login button i got this error.
I don’t think so there is any issue in my Web.Config becoz it work fine by Ctrl+F5.
Thanks, for help in advance.
Answers
-
User475983607 posted
Host123
From Visual Studio it works fine. When I view (Ctrl+shift+W) default.html from Visual Studio and click on LogIn button, it redirect me at Login.aspx.
But when I open default.html from local directory it shows this Error: «StartTag: invalid element name».
I just want to know, its due to HTML files do not trigger the ASP.NET as you mention early?
You misunderstand how ASP.NET works at a fundamental level. ASP.NET is a server side framework where ASPX page are hosted in IIS/ASP.NET services. The pages are processed on the server and the results is an HTML stream to the browser. You
can’t open an ASPX page from the file system with a browser because there’s not HTTP pipeline. The browser thinks the file is XML and shows the error. This is considered common knowledge.Host123
Btw i can show the working file from Visual Studio but i am just afraid what if He ask me to open it from Local Directory.
I suspect the interviewer would not ask this question because it is an odd thing to do. I started with Web Forms back the early 2000s and today is the first time I’ve ever tried to open an ASPX file with a browser. It’s never crossed my
mind.However, the fact that you are asking this question indicates you have never written an ASP.NET application.
Use Visual Studio to run the web application by pressing F5 or clicking the run button in the toolbar.
- Marked as answer by
Thursday, October 7, 2021 12:00 AM
- Marked as answer by
I am trying to parse XML to array in my custom module in Magento 2.2.7. Community version (free)
I am loading HelperData through Block element and this is «working».
This is my HelperData.php
<?php
namespace VendorCategoriesHelper;
use MagentoFrameworkSerializeSerializerInterface;
class Data extends MagentoFrameworkAppHelperAbstractHelper
{
private $xml2;
private $xml;
public function __construct(SerializerInterface $serializer) {
$this->serializer = $serializer;
$this->xml2 = dirname(file_get_contents('import/kategorije-za-import.xml'));
$this->xml = $this->serializer->unserialize($this->serializer->serialize(simplexml_load_string($this->xml2)));
} // end of construct
public function testing(){
var_dump($this->xml);
}
This outputs error in
[2019-02-16 10:27:51] main.CRITICAL: Warning: simplexml_load_string(): Entity: line 1414: parser error : StartTag: invalid element name in /home/user/public_html/app/code/Vendor/Categories/Helper/Data.php on line 19 [] []
XML file location is:
homeuserpublic_htmlimportkategorije-za-import.xml
My xml file is:
<?xml version='1.0' encoding='UTF-8'?>
<NewDataSet>
<Table>
<CategoryID>1</CategoryID>
<CategoryName>Hardware</CategoryName>
<ParentCategoryID>0</ParentCategoryID>
</Table>
<Table>
<CategoryID>2</CategoryID>
<CategoryName>Paketi i bundle</CategoryName>
<ParentCategoryID>1</ParentCategoryID>
</Table>
<Table>
<CategoryID>3</CategoryID>
<CategoryName>Matične ploče</CategoryName>
<ParentCategoryID>1</ParentCategoryID>
</Table>
<Table>
<CategoryID>4</CategoryID>
<CategoryName>Intel</CategoryName>
<ParentCategoryID>3</ParentCategoryID>
</Table>
</NewDataSet>
I have tested this as a script outside Magento and XML file loads and parses as array.
What to do?
Skip to content
I’ve been trying to figure out how to properly use github with xcode, so that both me and my friend can work on the same project. Somehow there aren’t clear enough instructions anywhere (and I didn’t bother to do a comprehensive search), so while I’m ‘playing it by the ear’, I thought it could be useful to post some of the difficulties I’ve faced and how I solved them.
One of them is the error I started getting every time I click and try to reach the Main.storyboard on xcode.
Line X startTag: invalid element name.
Why am I getting this?
Because the merge wasn’t fully successful due to some conflicts. Therefore git decided to keep both of the versions of the code. If you’re experiencing the same problem, open the Main.storyboard as sourcecode (by rightclicking the file in xcode) and you will see something similar to below:
<<<<<<< HEAD
// code (let's say version A)
=======
// code (let's say version B)
>>>>>>> master
Tip 1:
Copy all of the code, and try deleting version B (as well as the <<<<<<< HEAD,
======= and >>>>>> master), and run. If your problem is solved, you're good. If not, paste the original code again and try deleting version A.
Tip 2:
Do all the git work in xcode (committing, pushing, pulling, branching, etc). You can access all through “sourcecontrol”. If you try to do bits on xcode and pieces on the github website, things get jammed.
The document basically has «catalog» as the root tag with child tags of «movie» followed by one or more «actor». Each of these child tags further contains more child tags. I was supposed to make a DTD for this based on some rules given, but it is just rejecting whatever I put at the beginning of the doucment. Any help?
Here is the XML code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE catalog SYSTEM "catalog.dtd">
<catalog>
<movie movieID="m0100" genre="drama">
<title>Monster's Ball</title>
<year>2001</year>
<length>111 minutes</length>
<topBilledActors actorIDs="a0100 a0102" />
</movie>
<actor actorID="a0100" oscarWinner="yes">
<name>Halle Berry</name>
<date>August 14, 1966</date>
<birthplace>Cleveland, Ohio</birthplace>
<role character="Leticia Musgrove" movie="m0100" />
<role character="Storm" movie="m0101" />
</actor>
<actor actorID="a0102" oscarWinner="yes">
<name>Billy Bob Thornton</name>
<role character="Hank Grotowski" movie="m0100" />
</actor>
<movie movieID="m0101" genre="fantasy">
<title>X-Men</title>
<year>2000</year>
<length>104 minutes</length>
<topBilledActors actorIDs="a0100 a0103" />
</movie>
<actor actorID="a0103" oscarWinner="no">
<name>Ian McKellen</name>
<role character="Magneto" movie="m0101" />
<role character="Gandolf" movie="m0105" />
<role character="Gandolf" movie="m0107" />
</actor>
<movie movieID="m0105" genre="action" earningsRank="17">
<name>Lord of the Rings: The Fellowship of the Ring</name>
<date>2001</date>
<length>178 minutes</length>
<topBilledActors actorIDs="a0103" />
</movie>
<movie movieID="m0107" genre="action" earningsRank="8">
<name>Lord of the Rings: The Return of the King</name>
<date>2003</date>
<length>201 minutes</length>
<topBilledActors actorIDs="a0103" />
</movie>
<actor actorID="a0101" oscarWinner="yes">
<name>Tom Hanks</name>
<date>July 9, 1956</date>
<birthplace>Concord, California</birthplace>
<role character="Captain John H. Miller" movie="m0102" />
<role character="Forrest Gump" movie="m0103" />
<role character="Andrew Beckett" movie="m0104" />
</actor>
<movie movieID="m0102" genre="action" earningsRank="50">
<name>Saving Private Ryan</name>
<date>1998</date>
<length>170 minutes</length>
<topBilledActors actorIDs="a0101 a0104" />
</movie>
<actor actorID="a0104" oscarWinner="yes">
<name>Matt Damon</name>
<date>October 8, 1970</date>
<birthplace>Cambridge, Massachusetts</birthplace>
<role character="Private James Francis Ryan" movie="m0102" />
</actor>
<movie movieID="m0103" genre="comedy" earningsRank="14">
<name>Forrest Gump</name>
<date>1994</date>
<length>142 minutes</length>
<topBilledActors actorIDs="a0101 a0105 a0106" />
</movie>
<actor actorID="a0105" oscarWinner="yes">
<name>Sally Field</name>
<birthplace>Pasadena, California</birthplace>
<role character="Mrs. Gump" movie="m0103" />
</actor>
<actor actorID="a0106">
<name>Gary Sinise</name>
<role character="Lt. Dan Taylor" movie="m0103" />
<role character="Ken Mattingly" movie="m0106" />
</actor>
<movie movieID="m0104" genre="drama">
<name>Philadelphia</name>
<date>1993</date>
<length>125 minutes</length>
<topBilledActors actorIDs="a0101 a0107" />
</movie>
<movie movieID="m0106" genre="drama">
<name>Apollo 13</name>
<date>1995</date>
<length>140 minutes</length>
<topBilledActors actorIDs="a0101 a0106" />
</movie>
<actor actorID="a0107" oscarWinner="yes">
<name>Denzel Washington</name>
<role character="Joe Miller" movie="m0104" />
</actor>
</catalog>
Here is the DTD file:
<!ELEMENT catalog (movie, actor+)*>
<!ELEMENT movie (title, year, length, topBilledActors)>
<!ATTLIST movie movieID ID #REQUIRED>
<!ATTLIST movie genre (fantasy | action | drama | comedy) #REQUIRED>
<!ATTLIST movie earningsRank CDATA #IMPLIED>
<!ELEMENT title (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT length (#PCDATA)>
<!ELEMENT topBilledActors EMPTY>
<!ATTLIST topBilledActors ActorIDs IDREFS>
<!ELEMENT actor (name, date*, birthplace*, role+)>
<!ATTLIST actor actorID ID #REQUIRED>
<!ATTLIST actor oscarWinner (yes|no) "no">
<!ELEMENT name (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT birthplace (#PCDATA)>
<!ELEMENT role EMPTY>
<!ATTLIST role character CDATA>
<!ATTLIST role movie IDREF>
EDIT: I am verifying this with the XML validator at http://www.w3schools.com/xml/xml_validator.asp
My web browser (IE) does not display the file and gives the error:
Required white space was missing. Error processing resource 'file:///C:/Documents and Settings/Administrator/Desktop/...
<!ATTLIST topBilledActors ActorIDs IDREFS>
(Warning — asp newbie) I have an aspx file with the tag
<%@ Page Language=VB ... %>
right at the beginning of the file.
When calling this from my IIS server (http://localhost/myservice/default.aspx), this gives me the error
This page contains the following
errors:error on line 1 at column 2:
StartTag: invalid element name
Below is a rendering of the page up to
the first error.
What am I doing wrong?
asked Nov 11, 2008 at 14:27
1
It appears as if the browser tries to display what it thinks is an XML file, since it gives an error on the second character of the first line. So I think the file is not parsed, but simply returned as is immediately. Check if your IIS server is configured correctly and that it actually parses your ASP tags before returning the page.
answered Nov 11, 2008 at 14:36
DaanDaan
6,9524 gold badges29 silver badges36 bronze badges
1
When I went into the ASP.NET tab for the virtual directory I noticed the ASP.NET version was not selected (it was an empty combo box). Choosing the .NET framework version did the trick. Thanks.
answered Nov 11, 2008 at 14:43
EpagaEpaga
38k58 gold badges156 silver badges245 bronze badges
Similar to the previous comment, in my setup too the ASP.NET version was not selected. But after selecting the version i got the following error while accessing the aspx file.
Windows XP, IIS 5.1.
Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
Executed the following commands, aspnet_iis -i
and aspnet_iis -ga
resolved the issue.
answered Dec 6, 2009 at 14:23
When i did this. It worked fine.
Go to this directroy in command prompt C:WINDOWSMicrosoft.NETFrameworkv2.0.50727
Run this command
Aspnet_regiis -I
this will install aspnet
answered Feb 24, 2010 at 13:36
For me, the problem was that I was viewing the .svc file using my local file path mapped to a server in my browser when I meant to be using the verbatim path to my server.
answered Aug 26, 2014 at 19:43
Jared BeachJared Beach
2,51633 silver badges36 bronze badges
Try this :
To install and enable ASP.NET:
Click Start, and then click Control Panel.
Click Add or Remove Programs.
Click Add/Remove Windows components.
Double-click Application Server, and then click Details.
Click to select the ASP.NET check box, and then click OK.
Click Next.
Click Finish.
bolt19
1,9554 gold badges32 silver badges41 bronze badges
answered Sep 18, 2013 at 6:13
Vineeth VijayanVineeth Vijayan
1,1751 gold badge19 silver badges33 bronze badges
For me, the problem was in the serialization that responded to client.
My problem was in the xml tags spaces:
- < tag > text < / tag > ---> wrong
- <tag> text </tag> ----> good.
answered Nov 27, 2020 at 10:48
- Remove From My Forums
-
Question
-
User1632842107 posted
I connect my aspx page from html by ‘href‘ link. My index page is in
.html extension and my Login page in .aspx extension.When i run my Web pages without debug(Ctrl + F5) from Visual Studio it
works fine and i don’t get this error
«Error on line 1 at column 2: StartTag: invalid element name».When i open my Index.html file form local directory and Click on Login button i got this error.
I don’t think so there is any issue in my Web.Config becoz it work fine by Ctrl+F5.
Thanks, for help in advance.
Answers
-
User475983607 posted
Host123
From Visual Studio it works fine. When I view (Ctrl+shift+W) default.html from Visual Studio and click on LogIn button, it redirect me at Login.aspx.
But when I open default.html from local directory it shows this Error: «StartTag: invalid element name».
I just want to know, its due to HTML files do not trigger the ASP.NET as you mention early?
You misunderstand how ASP.NET works at a fundamental level. ASP.NET is a server side framework where ASPX page are hosted in IIS/ASP.NET services. The pages are processed on the server and the results is an HTML stream to the browser. You
can’t open an ASPX page from the file system with a browser because there’s not HTTP pipeline. The browser thinks the file is XML and shows the error. This is considered common knowledge.Host123
Btw i can show the working file from Visual Studio but i am just afraid what if He ask me to open it from Local Directory.
I suspect the interviewer would not ask this question because it is an odd thing to do. I started with Web Forms back the early 2000s and today is the first time I’ve ever tried to open an ASPX file with a browser. It’s never crossed my
mind.However, the fact that you are asking this question indicates you have never written an ASP.NET application.
Use Visual Studio to run the web application by pressing F5 or clicking the run button in the toolbar.
-
Marked as answer by
Thursday, October 7, 2021 12:00 AM
-
Marked as answer by