[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Encapsulating an XML document within an XML element
Hello, Is there a _standard_ way of combining or encapsulating multiple XML documents into a single XML document? To give an example, let's say I'd like to wrap these two documents for storage in a single XML instance: ------------------------------------------------------- <?xml version="1.0"?> <!DOCTYPE example1 [ <!ELEMENT one (#PCDATA)> ]> <one> ..</one> ------------------------------------------------------- <?xml version="1.0"?> <!DOCTYPE example2 [ <!ELEMENT two (#PCDATA)> ]> <two> ..</two> ------------------------------------------------------- So essentially what I want is this: <docset> <xml:document> <?xml version="1.0"?> <!DOCTYPE example1 [ <!ELEMENT one (#PCDATA)> ]> <one> ..</one> </xml:document> <xml:document> <?xml version="1.0"?> <!DOCTYPE example2 [ <!ELEMENT two (#PCDATA)> ]> <two> ..</two> </xml:document> </docset> Except, of course, that is not XML as we know it. So instead, I could invent my own way of encoding XML metadata in XML. Then a legal example might be: <ex:docset xmlns:ex="http://example.com/"> <ex:document> <ex:xmldecl version="1.0"> <ex:doctype name="example1"> <ex:elementdecl name="one" contentspec="(#PCDATA)"/> </ex:doctype> <one> ..</one> </ex:document> <ex:document> <ex:xmldecl version="1.0"> <ex:doctype name="example2"> <ex:elementdecl name="two" contentspec="(#PCDATA)"/> </ex:doctype> <two> ..</two> </ex:document> </ex:docset> However, I'm quite concerned that (a) I don't want to reinvent the wheel, and (b) if there is a standard way of doing this, of being interoperable. Having standard semantics could be quite important. For example, 'ID' attributes are defined to be unique within a document instance - so a validating parser which understands the boundaries of an <ex:document> could apply the uniqueness check just to the scope of an individual encapsulated document, not to the whole aggregate document. Equally, it could understand the <ex:doctype> declarations for the component parts, and validate each component document separately, if so desired. Perhaps you'll just say "this is all obsolete, use schemas instead". That's fair enough... but I still want to be able to store and aggregate existing XML-1.0 compliant documents whose contents I don't have control over. Even with schemas, the <?xml...?> declaration is still recommended, isn't it? And if I want to preserve that, I will have to encode it some other way. Regards, Brian.
|
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
|