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 comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...