AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
DAX
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 20.11.2012, 18:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
ax-erp: XML parser namespace error
Источник: http://microsoft-dynamics-ax-erp.blo...ace-error.html
==============


Today I tried to create the following XML-structure in Ax:
1
2
</span span style="color: #000066; margin: 0px; padding: 0px;"version/span=span style="color: red; margin: 0px; padding: 0px;""1.0"/span span style="color: #000066; margin: 0px; padding: 0px;"encoding/span=span style="color: red; margin: 0px; padding: 0px;""UTF-8"/spanspan style="color: black; font-weight: bold; margin: 0px; padding: 0px;"?>

I wrote the following to do so:
1
2
3
4
xmlDoc = WGKFunctions::createXMLDocumentWithDeclaration(#version, #encoding, #standalone);
root = xmlDoc.createElement(this.rootNode());
...
root.setAttribute("xsi:noNamespaceSchemaLocation", "Personeel.xsd");

But I got the following result:
1
2
</span span style="color: #000066; margin: 0px; padding: 0px;"version/span=span style="color: red; margin: 0px; padding: 0px;""1.0"/span span style="color: #000066; margin: 0px; padding: 0px;"encoding/span=span style="color: red; margin: 0px; padding: 0px;""UTF-8"/spanspan style="color: black; font-weight: bold; margin: 0px; padding: 0px;"?>

As you see the ‘xsi:noNamespaceSchemaLocation‘ is replaced by ‘noNamespaceSchemaLocation‘.
After some research, I found the following link:http://blogs.msdn.com/emeadaxsupport...ace-error.aspx
You are using Microsoft Dynamics AX to create an XML Document. The code you are using to create the XML file was created for the previous version of the product and is now upgraded to Microsoft Dynamics AX 4.0 SP1.
Using the method
setAttribute(‘namespaceprefix:attribname’,'attribvalue’);
does not add the “namespaceprefix” to the final XML node.
The attribute name in the final XML node will be added without namespaceprefix:

This is because the XML Framework was changed starting from Dynamics AX 4.0 and offers now a method that takes care about namespaces and prefixes itself.
So the solution is to use the following method instead:
setAttribute2(‘attribname’,'namespace’,'attribvalue’);
Please note that the “namespace” – not the “namespace prefix” has to be entered as second parameter. The XML Framework will resolve the namespace automatically to the correct namespace prefix and add it to the final XML node:

So I modified my code to:
1
root.setAttribute2("noNamespaceSchemaLocation", "http://www.w3.org/2001/XMLSchema-instance", "Personeel.xsd");

and the correct XML was generated.



Источник: http://microsoft-dynamics-ax-erp.blo...ace-error.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
ax-erp: Creating SSRS-Reports in Dynamics AX 2012 – What’s no longer possible in AX-reports Blog bot DAX Blogs 0 18.07.2012 12:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
Dynamics AX Sustained Engineering: NF-e Process fails with XML schema error 215 due to missing namespace Blog bot DAX Blogs 0 09.07.2011 05:58
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
при построении перекрёстных ссылок выдаётся сообщение об ошибках mmmax DAX: Программирование 10 21.01.2005 12:42

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 16:14.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.