2

Given a big XML I want to have PART of the XML structure in a tree in memory (THIS IS NOT DOM!!) for example given

<MAIN>
    <A>
        <B>1</B>
        <C>2</C>
        <D>3</D>
            <H>7</H>
            <I>9</I>
        <E>2</D>
    </A>
    <A>
        <B>4</B>
        <C>5</C>
        <D>6</D>
            <H>3</H>
            <I>0</I>
        <E>3</D>
    </A>
</MAIN>

after the user selects nodes B and H, I want to have in memory

<MAIN>
    <A>
        <B>1</B>
        <C>2</C>
        <D>3</D>
            <H>7</H>
    </A>
    <A>
        <B>4</B>
        <C>5</C>
        <D>6</D>
            <H>3</H>
    </A>
</MAIN>

sometimes the user wants to filter by node contents, like all B nodes greater than 3, etc.

is there a (SAX?) library to do such thing? preferably in Smalltalk but any other language will be fine.

Juan Aguerre
  • 388
  • 2
  • 7

3 Answers3

1

There is a SAX library included in VisualWorks.

Alan Knight
  • 2,759
  • 1
  • 15
  • 13
0

In java land, using either JDOM or DOM4J (and possibly also XOM), you can write a customized builder to achieve what you want.

An example for DOM4J

forty-two
  • 12,204
  • 2
  • 26
  • 36
0

An STX processor allows one to process a large document in streaming fashion, but to retain (possibly transformed) portions of that document in variables or buffers.

WReach
  • 18,098
  • 3
  • 49
  • 93