简体   繁体   中英

How to include xml file in xml ? <xi : include does not work

I am trying to include some xml files in an other xml file. To do so, I used :

<example xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <types xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude">

        <xi:include href="file1.xml" parse="xml" />
        <xi:include href="file2.xml" parse="xml" />

    </types>

</example>

But i got this error : Unexpected attribute 'xmlns:xi'

I don't understand why...

Thanks in advance !

( I am using Node js and trying to connect to DDS By the way )

You need to check whether your XML parser has an option to expand xi:include directives. It's unlikely to be done by default, if the capability is there at all you probably have to configure it.

If not, you might be able to find a free-standing XInclude processor, but I suspect your choices on Node.js are a bit limited.

For the very small subset of XInclude that people actually use 99% of the time, it's pretty trivial to write an XSLT transformation to do the expansion: it's only half-a-dozen lines of code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM