Jump to content

XML import in an other XML

Recommended Posts

You're going to have to specify one of your XML elements as one that imports another file, then you start parsing the next file when you find one of those elements.Are you using Java or Javascript?

Link to post
Share on other sites
I am using java code to parse. Can you please paste some sample xml files for importing a xml in another xmlThanks
There's no actual sample I can give that will actually work because you have to implement it yourself. I'm not sure why you would "import" XMl into another XML file, because it would result in two XML declarations.Here's a little example of how you could do it:
<?xml version="1.0" encoding="UTF-8" ?><root>  <element1>Value</element>  <customImportNode url="file.xml" /></root>

This isn't Java, it's just some example code that would be applied to any language.

function parseFile(filename) {	// Load the file by the filename argument	// Some parsing instructions	if(node.nodeName == "customImportNode") {		parseFile(node.getAttribute("file");	}}

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...