srini_w3 Posted June 3, 2011 Share Posted June 3, 2011 Hi All,I am trying to import a xml in other xml and parsing with java code?Can anybody please give some hints or an example for it.Thanks Link to comment Share on other sites More sharing options...
Ingolme Posted June 3, 2011 Share Posted June 3, 2011 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 More sharing options...
srini_w3 Posted June 4, 2011 Author Share Posted June 4, 2011 I am using java code to parse. Can you please paste some sample xml files for importing a xml in another xmlThanks Link to comment Share on other sites More sharing options...
Ingolme Posted June 4, 2011 Share Posted June 4, 2011 I am using java code to parse. Can you please paste some sample xml files for importing a xml in another xmlThanksThere'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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.