Click here to Skip to main content
15,914,074 members
Home / Discussions / XML / XSL
   

XML / XSL

 
Questionproblem in javascript Pin
Arihant rathi18-Oct-07 0:50
Arihant rathi18-Oct-07 0:50 
AnswerRe: problem in javascript Pin
Stefan Troschuetz18-Oct-07 1:19
Stefan Troschuetz18-Oct-07 1:19 
QuestionHi Help me Pin
Ragava Yadav17-Oct-07 22:18
Ragava Yadav17-Oct-07 22:18 
QuestionExtra pair of eyes Pin
mango_lier15-Oct-07 12:59
mango_lier15-Oct-07 12:59 
AnswerRe: Extra pair of eyes Pin
Stefan Troschuetz15-Oct-07 21:46
Stefan Troschuetz15-Oct-07 21:46 
GeneralRe: Extra pair of eyes Pin
mango_lier16-Oct-07 6:26
mango_lier16-Oct-07 6:26 
QuestionBuilding a transform to re-structure a XML file Pin
I_AM_A_TULLI15-Oct-07 7:41
I_AM_A_TULLI15-Oct-07 7:41 
QuestionHelp: how to get link addres in the RSS XML file in MFC/C++? Pin
fujoey13-Oct-07 15:42
fujoey13-Oct-07 15:42 
I have to parse RSS channel definition XML file. I have appended one sample at the end of this topic.
I have installed MSXML parser 6 and uses it successfully. Please refer to function XmlRSSRead.
There are a lot of information about the channel and item of this channel. For example, one channel has title, link, description information. One channel may have a lot of item too. Each item also hase title, link, description information.
I have to extract title, link, description information in my application. I can not find one quick start guide from microsoft doucments.
Could anyone be kind to tell me what I should do next?

The following is the function I have now and the xml file I want to parse.


void XmlRSSRead( void )
{
//¡ä¡ä?¡§DOMDocument???¨®
MSXML2::IXMLDOMDocumentPtr pDoc;
HRESULT hr = pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument30));
if(!SUCCEEDED(hr))
{
AfxMessageBox( _T("?T¡¤¡§¡ä¡ä?¡§DOMDocument???¨®¡ê????¨¬2¨¦¨º?¡¤?¡ã2¡Á¡ã¨¢?MS XML Parser ??DD?a!") );
}
//?¨®?????t
pDoc->load( _T("D:\\temp\\mPhone\\Docs\\RSS\\nature.xml") );

//?¨²¨º¡Â?D2¨¦?¨°???achannel¦Ì??¨²¦Ì?,
// "//"¡À¨ª¨º??¨²¨¨?¨°a¨°?2?2¨¦?¨°
MSXML2::IXMLDOMElementPtr childNode ;
childNode = (MSXML2::IXMLDOMElementPtr)(pDoc->selectSingleNode("//channel"));

//¦Ì?¦Ì??¨²¦Ì?¨¤¨¤D¨ª
MSXML2::DOMNodeType nodeType;
childNode->get_nodeType(&nodeType);

//?¨²¦Ì???3?
BSTR var;
CString name;
childNode->get_nodeName(&var);
name = (char*)(_bstr_t)var;

//?¨²¦Ì??¦Ì
VARIANT varVal;
childNode->get_nodeTypedValue(&varVal);
CString strValue = (char*)(_bstr_t)varVal;

//?¨²¦Ì?¨º?D?,¡¤??¨²¨¢¡ä¡À¨ª?D
MSXML2::IXMLDOMNamedNodeMapPtr pAttrs = NULL;
MSXML2::IXMLDOMNodePtr pAttrItem;
childNode->get_attributes(&pAttrs);
long nCount ;
pAttrs->get_length(&nCount);
for(int i = 0 ; i < nCount ; i++)
{
pAttrs->get_item(i,&pAttrItem);
//?¨°???¨¦¨°?¨ª¡§1yo¡¥¨ºyget_nodeName,get_nodeTypedValue¦Ì?¦Ì?¨º?D???o¨ª¨º?D??¦Ì
//¨°2?¨¦¨°??¡À?¨®¦Ì?¦Ì?
CString strAttrName = (char*)(_bstr_t)pAttrItem->nodeName;
CString strAttrValue = (char*)(_bstr_t)pAttrItem->nodeTypedValue;
}
}

void mfXmlReadTest( void )
{
::CoInitialize(NULL);

MSXML2::IXMLDOMDocumentPtr spPtr;
HRESULT hr = spPtr.CreateInstance(__uuidof(MSXML2::DOMDocument30));
ASSERT(SUCCEEDED(hr));

spPtr->loadXML("<r>\n<t>top\nbottom\n");
spPtr->save("C:\\nature.xml");
spPtr.Release();
::CoUninitialize();
}


XMLÎļþÈçÏ£º

<rss xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd" version="2.0">
<channel>
<title>Nature Podcast
http://www.nature.com/nature/podcast/rss/nature.xml <description>Nature is a weekly international journal publishing the finest peer-reviewed research in all fields of science. The Nature Podcast is a free weekly audio show highlighting content from each issue, and interviews with the scientists creating the data. The Nature Podcast provides insight and context to groundbreaking research, and allows the scientists to explain the significance of their work in their own words.
<language>en
<copyright>© 2006 Nature Publishing Group
<lastbuilddate>Wed, 25 Jul 2007 18:00:00 GMT
<category>Science & Medicine
<category>Technology

<url>http://www.nature.com/nature/podcast/images/nature_rss_logo.png
<title>Nature
http://www.nature.com/nature/podcast/rss/nature.xml <width>144
<height>144

<itunes:author>Nature
<itunes:subtitle>Interviews, insight and highlights of the latest scientific discoveries, every week in Nature
<itunes:summary>Nature is a weekly international journal publishing the finest peer-reviewed research in all fields of science. The Nature Podcast is a free weekly audio show highlighting content from each issue, and interviews with the scientists creating the data. The Nature Podcast provides insight and context to groundbreaking research, and allows the scientists to explain the significance of their work in their own words.
<itunes:owner>
<itunes:name>Nature
<itunes:email>podcast@nature.com

<itunes:category text="Science & Medicine">
<itunes:category text="Technology">
<itunes:image href="http://www.nature.com/nature/podcast/images/nature_itunes_logo.png">
<item>
<title>Nature Podcast: 26 July 2007
http://www.nature.com/nature/podcast/v448/n7152/nature-2007-07-26.mp3 <description>?26 July: Rain changes of our own making, science in the Simpsons, Californian-style plate rifts, investigating inflammatory bowel disease, pygmies with palm pilots.
<guid>http://www.nature.com/nature/podcast/v448/n7152/nature-2007-07-26.mp3
<enclosure url="http://www.nature.com/nature/podcast/v448/n7152/nature-2007-07-26.mp3" length="13343922" type="audio/mpeg">

<pubdate>Wed, 25 Jul 2007 18:00:00 GMT
<category>Science & Medicine
<category>Technology
<itunes:author>Nature
<itunes:subtitle>?26 July: Rain changes of our own making, science in the Simpsons, Californian-style plate rifts, investigating inflammatory bowel disease, pygmies with palm pilots.
<itunes:duration>37:03
<itunes:explicit>no
<itunes:category text="Science & Medicine">
<itunes:category text="Technology">
<itunes:keywords>nature, podcast, science, technology, education, science news, biology, physics, genetics, astronomy, astrophysics, quantum physics, evolution, evolutionary biology, geophysics, climate change, earth science, materials science, science policy, medicine, systems biology, genomics, palaeobiology, ecology, molecular biology, cancer, immunology, pharmacology, developmental biology, biochemistry, bioinformatics, nanotechnology, biotechnology, drug discovery, environmental science, life, marine biology, medical research, neuroscience, rna, dna, cell cycle, signal transduction, cell signalling



QuestionXML Problem Pin
kkb_200112-Oct-07 2:12
kkb_200112-Oct-07 2:12 
AnswerRe: XML Problem Pin
led mike12-Oct-07 5:06
led mike12-Oct-07 5:06 
QuestionJava XMLFilter XMLWriter problem -- returning extra tags from an XMLFilter using XMLWriter Pin
bessels10-Oct-07 23:43
bessels10-Oct-07 23:43 
QuestionElement does not exist in namespace... Pin
Lutosław10-Oct-07 21:42
Lutosław10-Oct-07 21:42 
AnswerRe: Element does not exist in namespace... Pin
Stefan Troschuetz15-Oct-07 22:04
Stefan Troschuetz15-Oct-07 22:04 
GeneralRe: Element does not exist in namespace... Pin
Lutosław17-Oct-07 21:00
Lutosław17-Oct-07 21:00 
QuestionEncrypting and decrypting xml files Pin
steve_rm10-Oct-07 19:33
steve_rm10-Oct-07 19:33 
AnswerRe: Encrypting and decrypting xml files Pin
Scott Dorman11-Oct-07 4:48
professionalScott Dorman11-Oct-07 4:48 
Questionserialize colors and fonts in XML Pin
urbane.tiger9-Oct-07 21:09
urbane.tiger9-Oct-07 21:09 
AnswerRe: serialize colors and fonts in XML Pin
led mike10-Oct-07 4:36
led mike10-Oct-07 4:36 
GeneralRe: serialize colors and fonts in XML Pin
urbane.tiger10-Oct-07 23:39
urbane.tiger10-Oct-07 23:39 
GeneralRe: serialize colors and fonts in XML Pin
led mike11-Oct-07 5:41
led mike11-Oct-07 5:41 
GeneralRe: serialize colors and fonts in XML Pin
urbane.tiger11-Oct-07 18:28
urbane.tiger11-Oct-07 18:28 
GeneralRe: serialize colors and fonts in XML Pin
led mike12-Oct-07 4:10
led mike12-Oct-07 4:10 
GeneralRe: serialize colors and fonts in XML Pin
urbane.tiger14-Oct-07 19:30
urbane.tiger14-Oct-07 19:30 
QuestionRegarding xpath expressions Pin
anu818-Oct-07 23:48
anu818-Oct-07 23:48 
AnswerRe: Regarding xpath expressions Pin
anu819-Oct-07 0:31
anu819-Oct-07 0:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.