Loading ...
Sorry, an error occurred while loading the content.

XML in XML

Expand Messages
  • mrrevello
    Hi!, sorry but my bad english. I wish to referencing xml file into another xml file. For example: first.xml is: ONE second.xml is: [I wish
    Message 1 of 4 , Oct 9, 2002
    • 0 Attachment
      Hi!, sorry but my bad english.

      I wish to referencing xml file into another xml file.

      For example:

      first.xml is:

      <Element>ONE</Element>


      second.xml is:

      [I wish put here any reference to first.xml]
      <Element>TWO</Element>


      and when open the second.xml file with the explorer i see:

      <Elememt>ONE</Element>
      <Element>TWO</Element>


      How i can do this?
    • G. Ken Holman
      ... You should never worry about a language that isn t your first, and you should never feel the need to apologize for using it when you have to use it. ... We
      Message 2 of 4 , Oct 9, 2002
      • 0 Attachment
        At 2002-10-09 15:19 +0000, mrrevello wrote:
        >Hi!, sorry but my bad english.

        You should never worry about a language that isn't your first, and you
        should never feel the need to apologize for using it when you have to use it.

        >I wish to referencing xml file into another xml file.

        We are all assuming this is in the context of working with XSL-FO ... your
        question would be better posted elsewhere, though an answer is below.

        >For example:
        >
        >first.xml is:
        >
        > <Element>ONE</Element>
        >
        >second.xml is:
        >
        > [I wish put here any reference to first.xml]
        > <Element>TWO</Element>
        >
        >and when open the second.xml file with the explorer i see:
        >
        ><Elememt>ONE</Element>
        ><Element>TWO</Element>

        The above file is *not* XML ... it is not well-formed and would not be
        accepted by any properly-implemented XML processor.

        But, if you wrap it all in another element, as below, you can use an
        external parsed general entity to accomplish what you need.

        Note that although it is intuitive to share external parsed general
        entities in an information sharing strategy, and it works with small files,
        this is fraught with long-term danger to your XML files and you should
        never do this.

        I hope this helps.

        ............ Ken

        T:\ftemp>type first.xml
        <Element>one</Element>

        T:\ftemp>type second.xml
        <!DOCTYPE test [<!ENTITY other SYSTEM "first.xml">]>
        <test>
        &other;
        <Element>two</Element>
        </test>

        T:\ftemp>start second.xml

        T:\ftemp>copy screen.text.captured.from.IE.using.cut.and.paste nul
        <!DOCTYPE test (View Source for full doctype...)>
        - <test>
        <Element>one</Element>
        <Element>two</Element>
        </test>
        ^Z
        1 file(s) copied.

        T:\ftemp>


        --
        G. Ken Holman mailto:gkholman@...
        Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
        Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
        ISBN 0-13-065196-6 Definitive XSLT and XPath
        ISBN 0-13-140374-5 Definitive XSL-FO
        ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
        ISBN 1-894049-10-1 Practical Formatting Using XSL-FO
        Next public training: 2002-12-08,2003-02-03,06,03-03,06
      • Whitney, Dan (FPDG)
        Ken Although probably not a discussion for this group, just have to ask why is using external entities not a good idea? What is the long term danger? Dan ...
        Message 3 of 4 , Oct 9, 2002
        • 0 Attachment
          Ken

          Although probably not a discussion for this group, just have to ask why is
          using external entities not a good idea? What is the long term danger?

          Dan



          -----Original Message-----
          From: G. Ken Holman [mailto:gkholman@...]
          Sent: October 09, 2002 1:03 PM
          To: XSL-FO@yahoogroups.com
          Subject: Re: [XSL-FO] XML in XML


          At 2002-10-09 15:19 +0000, mrrevello wrote:
          >Hi!, sorry but my bad english.

          You should never worry about a language that isn't your first, and you
          should never feel the need to apologize for using it when you have to use
          it.

          >I wish to referencing xml file into another xml file.

          We are all assuming this is in the context of working with XSL-FO ... your
          question would be better posted elsewhere, though an answer is below.

          >For example:
          >
          >first.xml is:
          >
          > <Element>ONE</Element>
          >
          >second.xml is:
          >
          > [I wish put here any reference to first.xml]
          > <Element>TWO</Element>
          >
          >and when open the second.xml file with the explorer i see:
          >
          ><Elememt>ONE</Element>
          ><Element>TWO</Element>

          The above file is *not* XML ... it is not well-formed and would not be
          accepted by any properly-implemented XML processor.

          But, if you wrap it all in another element, as below, you can use an
          external parsed general entity to accomplish what you need.

          Note that although it is intuitive to share external parsed general
          entities in an information sharing strategy, and it works with small files,
          this is fraught with long-term danger to your XML files and you should
          never do this.

          I hope this helps.

          ............ Ken

          T:\ftemp>type first.xml
          <Element>one</Element>

          T:\ftemp>type second.xml
          <!DOCTYPE test [<!ENTITY other SYSTEM "first.xml">]>
          <test>
          &other;
          <Element>two</Element>
          </test>

          T:\ftemp>start second.xml

          T:\ftemp>copy screen.text.captured.from.IE.using.cut.and.paste nul
          <!DOCTYPE test (View Source for full doctype...)>
          - <test>
          <Element>one</Element>
          <Element>two</Element>
          </test>
          ^Z
          1 file(s) copied.

          T:\ftemp>


          --
          G. Ken Holman mailto:gkholman@...
          Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
          <http://www.CraneSoftwrights.com/f/>
          Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
          ISBN 0-13-065196-6 Definitive XSLT and XPath
          ISBN 0-13-140374-5 Definitive XSL-FO
          ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
          ISBN 1-894049-10-1 Practical Formatting Using XSL-FO
          Next public training: 2002-12-08,2003-02-03,06,03-03,06



          Yahoo! Groups Sponsor

          ADVERTISEMENT

          <http://rd.yahoo.com/M=233351.2428261.3848243.2225242/D=egroupweb/S=17050160
          61:HM/A=1213956/R=0/*http://www.gotomypc.com/u/tr/yh/grp/300_Cquo1/g22lp?Tar
          get=mm/g22lp.tmpl>

          <http://us.adserver.yahoo.com/l?M=233351.2428261.3848243.2225242/D=egroupmai
          l/S=:HM/A=1213956/rand=138989159>

          To unsubscribe from this group, send an email to:
          XSL-FO-unsubscribe@egroups.com



          Your use of Yahoo! Groups is subject to the Yahoo!
          <http://docs.yahoo.com/info/terms/> Terms of Service.
        • G. Ken Holman
          ... Sorry, I didn t quite say that ... I said they were not a good idea for *sharing* information. I think they are a great idea and I use external parsed
          Message 4 of 4 , Oct 9, 2002
          • 0 Attachment
            At 2002-10-09 13:49 -0400, Whitney, Dan (FPDG) wrote:
            >Although probably not a discussion for this group, just have to ask why is
            >using external entities not a good idea?

            Sorry, I didn't quite say that ... I said they were not a good idea for
            *sharing* information.

            I think they are a great idea and I use external parsed general entities
            extensively on a daily basis with very successful results in the very long
            term.

            My XSLT training material is made up of 37 separately authored XML external
            parsed general entities (at approximately a module and lesson granularity).

            My XSL-FO training material is made up of hundreds of external parsed
            general entities, most of which are synthesized from other XML instances.

            External parsed general entities are *wonderful* for managing a large
            single XML file as many separately editable system resources ... I keep all
            of my authored entities and "seed" documents (the ones I use to synthesize
            the hundreds of little entities) separately in my source code control system.

            Note that I said "single XML file".

            >What is the long term danger?

            The susceptibility of the parsing context ... the collection of entities
            used by the fragments of the XML document. Part of the DTD is found in the
            internal declaration subset and impacts on all of the fragments.

            Consider (and I've seen this) a shop using shared XML information in
            external parsed general entities. It works for months and everyone is
            happy. Someone changes the shared entity to refer to a new entity and
            updates their internal declaration subset of their XML, or their version of
            the DTD (that may not be shared) to define the entity so that their XML
            document is well-formed.

            Instantly, *every* other XML document sharing that fragment is now not
            well-formed because of the missing definition for the entity ... and since
            it isn't even well-formed, XML-based tools reject the instance (as it
            should!) instead of doing any kind of partial processing.

            With this in mind, I am very wary of sharing entities, though I have done
            so in a *very* limited and controlled fashion.

            In my own presentation environment I have slides shared between different
            presentations, and the authoring of presentations isn't as controlled. I
            don't use external parsed general entities to share a common slide, I use
            the document() function and the id() function to reach into an wholly
            contained XML document (that may be made up of multiple entities) and
            access the slide from the node tree (not the syntax of the entity) of the
            presentation.

            This way every presentation, regardless of how many fragments each is made
            up of, is accessed only as a wholly contained XML document and my authoring
            process for each presentation ensures they are self-consistent, without
            needing to worry about what other presentations might be sharing.

            I hope this helps.

            ................ Ken


            --
            G. Ken Holman mailto:gkholman@...
            Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
            Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
            ISBN 0-13-065196-6 Definitive XSLT and XPath
            ISBN 0-13-140374-5 Definitive XSL-FO
            ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
            ISBN 1-894049-10-1 Practical Formatting Using XSL-FO
            Next public training: 2002-12-08,2003-02-03,06,03-03,06
          Your message has been successfully submitted and would be delivered to recipients shortly.