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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 03.01.2009, 18:36   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
axaptapedia: Load Web Documents
Источник: http://www.axaptapedia.com/Load_Web_Documents
==============

Summary:

Loading web documents is easy using Microsoft .NET Framework in Dynamics AX. All necessary classes are implemented in System.IO Namespace and ready to use in Dynamics AX. For example reading the HTML document from Axaptapedia.com can be done in this way:


System.Net.WebRequest request = System.Net.WebRequest::Create("http://www.axaptapedia.com");
System.Net.WebResponse response;
System.IO.StreamReader reader;
System.IO.Stream stream;
System.String line;
;

response = request.GetResponse();
stream = response.GetResponseStream();
reader = new System.IO.StreamReader(stream);
line = reader.ReadLine();
while(line != null)
{
info(line);
line = reader.ReadLine();
}

reader.Close();


==Loading XML document==
While XML is the default industry standard for data exchange, it is simple to load published XML documents. News Feeds are published as XML documents that are interpreted by a browser or mail client like outlook to provide a convenient user interface. To handle XML documents add the System.Xml namespace at the AOT.


// MSDN RSS feed
System.Net.WebRequest request = System.Net.WebRequest::Create("http://www.microsoft.com/feeds/msdn/en-us/rss.xml");
System.Net.WebResponse response;
System.IO.StreamReader reader;
System.IO.Stream stream;

System.String xmlFeed;
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlNodeList nodeList;
System.Collections.IEnumerator titleEnum;
System.Xml.XmlNode title,value;
;

// Load
response = request.GetResponse();
stream = response.GetResponseStream();
reader = new System.IO.StreamReader(stream);
xmlFeed = reader.ReadToEnd();
reader.Close();

// Parse and show feed titles
doc.LoadXml(xmlFeed);
nodeList = doc.SelectNodes("//title"); // XPath expression, all titel elements
titleEnum = nodeList.GetEnumerator();
while(titleEnum.MoveNext())
{
title = titleEnum.get_Current();
value = title.get_FirstChild(); // text node is first child of parent title element
info(value.get_Value());
}


[[Image:Rssfeedtitle.PNG‎]]


[[Category:.NET Development]]


Источник: http://www.axaptapedia.com/Load_Web_Documents
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 03.01.2009, 23:50   #2  
belugin is offline
belugin
Участник
Аватар для belugin
Сотрудники Microsoft Dynamics
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии 2011
Лучший по профессии 2009
 
4,622 / 2925 (107) +++++++++
Регистрация: 16.01.2004
Записей в блоге: 5
1.
X++:
public static void TEST_DownloadString (Args _args)
{
    System.Net.WebClient webClient = new System.Net.WebClient();
    ;
    info(webClient.DownloadString('http://axaptapedia.com'));
}
2.
X++:
static void Job8(Args _args)
{
    XmlDocument doc = new XMLDocument();
    XmlNodeList nodeList;
    XMLElement element;
;
    doc.load(@'http://www.axaptapedia.com/index.php?title=Special:Recentchanges&feed=rss');
    nodeList = doc.selectNodes(@'//item');
    for(element = nodeList.nextNode(); element; element = nodeList.nextNode())
    {
        info(element.getNamedElement('title').text());
    }
}
За это сообщение автора поблагодарили: mazzy (2), gl00mie (2), alex55 (1), kpoxa (1).
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Consuming "CustomerService" Web Service Blog bot DAX Blogs 0 25.01.2008 15:10
Inside Dynamics AX 4.0: The Web Framework Blog bot DAX Blogs 0 25.10.2007 03:04
Pokluda: Outbound web service (AIF) Blog bot DAX Blogs 0 28.10.2006 17:43
Dynamics AX: Web 2.0 Workgroup - A network of Web 2.0 resources Blog bot DAX Blogs 0 28.10.2006 16:40
Solutions Monkey: EP Web Part connection Blog bot DAX Blogs 0 28.10.2006 16:40

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

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

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