[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] document XML inside another document XML using XLINK
Hi, I'm trying to add XML documents into another XML document using XLINK but I don't know how. I've tried several ways but it doesn't work, could you help me, please? Example: generalstocks.xml <?xml version="1.0" standalone="yes"?> <mystocks xmlns:xlink="http://www.w3.org/1999/xlink"> <contactlink xlink:type="simple" xlink:href="stocks.xml" xlink:show="embed"/> </mystocks> stocks.xml <?xml version="1.0"?> <portfolio> <stock exchange="y"> <name>new</name> <symbol>zzzz</symbol> <price dt="number">20.313</price> </stock> </portfolio> stocks.dtd <!ELEMENT mystocks (contactlink)> <!ELEMENT portfolio (stock+)> <!ELEMENT stock (name, symbol, price)> <!ELEMENT name CDATA> <!ELEMENT sysmbol CDATA> <!ELEMENT price CDATA> <!ATTLIST price dt CDATA #REQUIRED> <!ELEMENT contactlink ANY> <!ATTLIST contactlink xlink:type (simple) #FIXED "simple" xlink:href CDATA #IMPLIED xlink:show (embed) #FIXED "embed" xlink:actuate (onLoad) #FIXED "onLoad"> And this is the source code (I'm using Visual C++): #include <stdio.h> #import <msxml4.dll> using namespace MSXML2; int main(int argc, char* argv[]) { IXMLDOMDocument2Ptr pXMLDom; IXMLDOMParseError *pXMLErr=NULL; HRESULT hr; CoInitialize(NULL); hr = pXMLDom.CreateInstance(__uuidof(DOMDocument40)); if (FAILED(hr)) { printf("Failed to instantiate DOMDocument40 class\n"); return -1; } pXMLDom->async = VARIANT_FALSE; if ( pXMLDom->load("generalstocks.xml") != VARIANT_TRUE) { printf("Failed load xml data from file.\n%s\n", (LPCSTR)pXMLDom->parseError->Getreason()); return -1; } // Query a single node. IXMLDOMNodePtr pNode = pXMLDom->selectSingleNode("//stock[1]/*"); if (pNode == NULL) { printf("Invalid node fetched.\n%s\n", (LPCSTR)pXMLDom->parseError->Getreason()); } else { printf("Result from selectSingleNode:\nNode, <%s>:\n\t%s\n\n", (LPCSTR)pNode->nodeName, (LPCSTR)pNode->xml); } pXMLDom.Release(); pNode.Release(); CoUninitialize(); return 0; } Thanks in advance, Davinia _________________________________________________________________ Reparaciones, servicios a domicilio, empresas, profesionales... Todo en la guía telefónica de QDQ. http://qdq.msn.es/msn.cfm
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|