srini_w3 0 Posted June 3, 2011 Report 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 Quote Link to post Share on other sites
Ingolme 1,032 Posted June 3, 2011 Report 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? Quote Link to post Share on other sites
srini_w3 0 Posted June 4, 2011 Author Report 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 Quote Link to post Share on other sites
Ingolme 1,032 Posted June 4, 2011 Report 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"); }} Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.