누구나 xml을 vbscript로 구문 분석하는 예제가 있습니까? .NET generic 목록을 XML로 직렬화하여 고전 ASP 페이지로 보냅니다. XMLDom을 사용할 수있을 것이라고 생각했지만 라이브러리가 서버에 설치되어 있지 않은 것처럼 보였으므로 다른 솔루션을 찾고 있습니다. ("Object Required : documentElement"오류가 발생했습니다.)xml을 vbscript로 구문 분석
기본적으로 제목과 주요 기사 섹션이 포함 된 xml 문자열 형태로 약 15 개의 개체 목록을 전달하고 있습니다. 목록을 작성하고 둘 다 인쇄하십시오.
것은 이것은 내가 XMLDOM가 설치되지 않은 발견하기 전에 내가 가진 무엇 이었습니까 :
set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.loadXML(item)
Set objFirstChild = xmlDoc.documentElement.firstChild
Set objAttributes = objFirstChild.attributes
For Each Attr in objAttributes
Response.write(Attr.Headline & "<br>")
Response.write(Attr.Content & "<br>")
Next
Response.End
어떤 도움을 주시면 감사 - 내 VBScript를 요즘 꽤 녹슨입니다!
편집 - MSXML2.DOMDocument
으로 시도했지만 Object Required 오류가 발생했습니다.
<?xml version="1.0" encoding="utf-8"?>
<articles>
<article>
<newsID>7</newsID>
<headline>This is headline 1</headline>
<content><![CDATA[<p>This is the start of the main content of the article</p><p>This is the next paragraph.</p> ]]></content>
<date>04/06/2013 00:00</date>
</article>
<article>
<newsID>7</newsID>
<headline>This is headline 2</headline>
<content><![CDATA[<p>This is the start of the main content of the article</p><p>This is the next paragraph.</p> ]]></content>
<date>04/06/2013 00:00</date>
</article>
<article>
<newsID>7</newsID>
<headline>This is headline 3</headline>
<content><![CDATA[<p>This is the start of the main content of the article</p><p>This is the next paragraph.</p> ]]></content>
<date>04/06/2013 00:00</date>
</article>
</articles>
XML을 게시 할 수 있습니까? – ulluoink
xmldom이 "설치되지 않은 경우"createobject ("...") 행에서 오류가 발생합니다. – ulluoink
안녕하세요 ulluoink - 샘플 xml로 게시물을 수정했습니다. 불행히도 저는 코드가 어디에 있지 않으므로 복사본이 아니기 때문에 xml이 어떻게 배치되어 있는지를 알 수 있습니다. –