Simple method for combining multiple XML files - external entity reference

xiaoxiao2021-03-06  79

The following example is incorporated by an external entity, merge file order1.xml and file Order2.xml into a file Directory.xml list 1. To merge XML document Order1.xml:

ksu-0384 LCD LCD display 1 358.00 < ItemNumber> KSU-0511 Speaker 1 16.50 KSU-7710 Mouse 1 8.50

Listing 2. XML document to be merged order2.xml:

KSU-0652 Double flying swallow keyboard 1 35.00 < Itemnumber> KSU-7720 Intel CPU 1 1650.00 KSU-7010 Mai Tuo hard drive 1 850.00

Listing 3. Output Document Directory.xml, the black body part is an entity declaration and its reference:

& disclaimer1; & disclaimer2; When the processor complies with XML 1.0 is read, the entity is expanded, and the content is replaced with its content, so the complete document is as follows. Listing 4. Document display with extended entities (IE6):

转载请注明原文地址:https://www.9cbs.com/read-93481.html

New Post(0)