Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #9541

Re: includes in xml-files?

From Arved Sandstrom <asandstrom3minus1@eastlink.ca>
Newsgroups comp.lang.java.programmer
Subject Re: includes in xml-files?
References <j8vs8h$bah$1@news.m-online.net>
Message-ID <Eq_sq.15572$SW4.9194@newsfe08.iad> (permalink)
Organization Public Usenet Newsgroup Access
Date 2011-11-04 20:20 -0300

Show all headers | View raw


On 11-11-04 02:12 AM, Magnus Warker wrote:
> Hi,
> 
> I have an XML-File in the classpath and I read it in with
> getResourceAsStream (Pseudocode):
> 
> InputStream stm = class.getResourceAsStream (...);
> DocumentBuilderFactory ftr = DocumentBuilderFactory.newInstance ();
> ftr.setIgnoringComments (true);
> DocumentBuilder bld = ftr.newDocumentBuilder();
> Document doc = bld.parse (stm);
> 
> Now I would like to source out some of the contents into separate
> xml-files and include them into the main file.
> 
> Is this possible, in particular when the files are loaded as resource
> stream?
> 
> How can I do that? WhatÄs the syntax for the include directives?
> 
> Thanks
> Magnus

One standard way of including XML is external parsed entities. See
http://www.w3.org/TR/2004/REC-xml-20040204/#sec-external-ent.

If you've done that then there is actually no other coding that you need
to do. Simply continue to reference the main XML that includes other
XML; the parser is responsible for locating and parsing the includes.

AHS

-- 
You should know the problem before you try to solve it.
Example: When my son was three he cried about a problem with his hand. I
kissed it several times and asked him about the problem. He peed on his
hand.
-- Radia Perlman, inventor of spanning tree protocol

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

includes in xml-files? Magnus Warker <magnux@mailinator.com> - 2011-11-04 06:12 +0100
  Re: includes in xml-files? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-04 15:51 -0700
  Re: includes in xml-files? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-11-04 20:20 -0300
    Re: includes in xml-files? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-04 17:46 -0700
      Re: includes in xml-files? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-11-04 22:58 -0300
  Re: includes in xml-files? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-04 20:14 -0400
    Re: includes in xml-files? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-04 21:32 -0400
  Re: includes in xml-files? Jeff Higgins <jeff@invalid.invalid> - 2011-11-04 20:41 -0400
    Re: includes in xml-files? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-11-04 23:00 -0300
  Re: includes in xml-files? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-04 18:20 -0700

csiph-web