Trying to decide between XPath and one-level-at-a-time found an ideal3rd. way

C

Cambridge Ray

(newbie alert)

I found two (DOM) tutorial-type programs to retrieve values and I am
trying to decide which one I will build upon.

(For this explanation, I will use the filesystem analogy.)

One of them is simpler, being based on XPath:

cat /some/dir/inside/another/item.txt

The other program goes like this:

cd some
cd dir
cd inside
cd another
cat item.txt

(the above are actually nested loops)

I now realize that the two approaches would be even more useful, if
combined into a hybrid approach:

cd /some/dir/inside/another
dir
cat item.txt
cat other.txt

Is there such express way to jump directly to the desired depth where
your target item resides?

TIA,

-RFH
 
C

Cambridge Ray

(newbie alert)

I found two (DOM) tutorial-type programs to retrieve values and I am
trying to decide which one I will build upon.

(For this explanation, I will use the filesystem analogy.)

One of them is simpler, being based on XPath:

cat /some/dir/inside/another/item.txt

The other program goes like this:

cd some
cd dir
cd inside
cd another
cat item.txt

(the above are actually nested loops)

I now realize that the two approaches would be even more useful, if
combined into a hybrid approach:

cd /some/dir/inside/another
dir
cat item.txt
cat other.txt

Is there such express way to jump directly to the desired depth where
your target item resides?

TIA,

-RFH

As long as I using a filesystem analogy, what I am looking for would
be like this Unix command:

mkdir -p some/dir/inside/another

Which creates all unexistent directories.

-RFH
 
C

Cambridge Ray

(newbie alert)

I found two (DOM) tutorial-type programs to retrieve values and I am
trying to decide which one I will build upon.

(For this explanation, I will use the filesystem analogy.)

One of them is simpler, being based on XPath:

cat /some/dir/inside/another/item.txt

The other program goes like this:

cd some
cd dir
cd inside
cd another
cat item.txt

(the above are actually nested loops)

I now realize that the two approaches would be even more useful, if
combined into a hybrid approach:

cd /some/dir/inside/another
dir
cat item.txt
cat other.txt

Is there such express way to jump directly to the desired depth where
your target item resides?

TIA,

-RFH

I forgot to mention that I use Xerces-C++, which is very powerful, but
has a steep learning curve.

-RFH
 
J

Joe Kesselman

As long as I using a filesystem analogy, what I am looking for would
be like this Unix command:

mkdir -p some/dir/inside/another

Which creates all unexistent directories.

That's an underspecified behavior, since you haven't said WHERE it
should create them if other children are already present. (Remember, the
order may be meaningful in some documents, and/or may be constrained by
the DTD or Schema.)

I think the application code needs to be a bit more thoughtful about this.


--
Joe Kesselman,
http://www.love-song-productions.com/people/keshlam/index.html

{} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
/\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top