blahblah_gc Posted June 30, 2014 Share Posted June 30, 2014 I use JAXB with SAXParserFactory to read in a xml that contains other inclusions. For example, this following xml is called “TheFile.xml” and it refers to “class_common.xml” . <!DOCTYPE page [ <!ENTITY class_common SYSTEM "class_common.xml" >]> <api xmlns:denp="http://intranet.denali.com/wiki/DocBook_profiling"> &class_common; But what I notice is the default location used in SAXParserFactory for “class_common.xml” is where I launch the program . For example, my program is stared from DIR1 and both xml files are in DIR2, SAXParserFactory reads the “TheFile.xml” and tries to look for the “class_common.xml” from DIR1 instead of DIR2. How do I fix this? The code I have is like the following cl = class_xml.ObjectFactory.class.getClassLoader(); context = JAXBContext.newInstance("class_xml", cl); Unmarshaller u = context.createUnmarshaller(); SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setXIncludeAware(true); XMLReader xr = (XMLReader) spf.newSAXParser().getXMLReader(); SAXSource source = new SAXSource(xr, new InputSource(new FileInputStream(classXMLFile))); api = (Api) u.unmarshal(source); Link to comment Share on other sites More sharing options...
L8V2L Posted June 30, 2014 Share Posted June 30, 2014 (edited) You might have better luck looking here if this is java we are talking about, and when it comes to sax, that's the only implantation I read of is java with sax: http://www.saxproject.org Edited June 30, 2014 by L8V2L Link to comment Share on other sites More sharing options...
blahblah_gc Posted July 1, 2014 Author Share Posted July 1, 2014 Thanks, I am quit surprised that no one has used JAXB to readin inclusions what do people use? Or just don't have inclusions? Link to comment Share on other sites More sharing options...
L8V2L Posted July 2, 2014 Share Posted July 2, 2014 (edited) Thanks, I am quit surprised that no one has used JAXB to readin inclusions what do people use? Or just don't have inclusions?I really don't know. I see this all as wizardry; I myself is aiming to be a master wizard at JavaScript, and knowledgable in the sorcery art of html, css, xml and the likes.So I don't know much at all about sax and only read in passing of it.If you could detail all languages you are sorcerying in, I can have a better ideal of what to tell you, or how to help/guide you. Edited July 2, 2014 by L8V2L Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now