[
Lists Home |
Date Index |
Thread Index
]
is xml a script and if it is, does this sort of practice infringe the
microsoft patent we have been discussing, and further if it does
infringe, how do we get a licence to do this?
On Tue, 2004-02-17 at 06:48, Davinia Lopez wrote:
> 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
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>
>
|