I just check that out and play with it some. But I don't see that the
XPE tool does much for what I need.

I maybe missing the point(?) in your previous message, but that tool
does only show the XPath based on the selection made in the tree.

The negation was a good sugsestion, and I was exploring the way
I can get the DOM by excluding the sublement. But Jaxen and DOM4J
are not doing much for that unless I am missing something. Thanks.

Regards,


Pae


> Check out XPE (XPath Explorer) at http://sourceforge.net/projects/xpe/ .
> It allows you to load an XML instance and play around with XPath calls
> from the top to extract different nodes.  Try it out and see if you can
> come up with the right syntax.  Also, there is a few XPath functions
> supported to negate a selection.
>
> Best Wishes,
> Dave
>
>
> Pae Choi wrote:
> > Thank you for your reply as well as code snippet. But that's not
exactlly
> > what I was looking for.
> >
> > My applogies if I did not explained well in my prevous message. The
> > code snippet in your message will be able to get the <ContactInfo>
> > subemelement fine. And I have no problem to getting that.
> >
> > My question was to get the rest of XML DOM, excluding the prviously
> > selected sublelement, <ContactInfo>. To wit, I am looking for a simple
> > way to get the result without parsing the XML document by excluding
> > the previously selected subelement. The result I am expecting to get
> > is as follows:
> >
> > Initial XML:
> > /<Patient>/
> > /    <Age>39</Age>///
> > /    <Gender>Female</Gender>///
> > /    <ContactInfo>///
> > /        <PhoneNumber>123-456-7890</PhoneNumber>///
> > /        <EmailAddress>[EMAIL PROTECTED]</EmailAddress>///
> > /    </ContactInfo>///
> > /</Patient>///
> > The result XML:
> > /<Patient>/
> > /    <Age>39</Age>///
> > /    <Gender>Female</Gender>///
> > /</Patient>///
> > Thank you.
> >
> > Any more comments?
> >
> > Regards,
> >
> >
> > Pae
> >
> >
> >
> >     ----- Original Message -----
> >     *From:* Benjamin Kopic <mailto:[EMAIL PROTECTED]>
> >     *To:* Pae Choi <mailto:[EMAIL PROTECTED]>
> >     *Cc:* [EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>
> >     *Sent:* Sunday, November 17, 2002 4:07 AM
> >     *Subject:* Re: [dom4j-user] XPath result from a DOM and the Rest of
DOM
> >
> >     If I understand you correctly, the following will return <Patient>
> >     element:
> >
> >
> >     SAXReader reader = new SAXReader();
> >     Document document = reader.read( new File(
"patient_records.xml" ) );
> >     Element contactInfo = document.selectSingleNode( "//ContactInfo",
> >     "." );
> >     Element patient = contactInfor.getParent();
> >
> >
> >     Then you can use the Node API to traverse the <Patient> element
> >     returned.
> >
> >     Also, if <Patient> is the root element, then you can do the
following:
> >
> >     SAXReader reader = new SAXReader();
> >     Document document = reader.read( new File(
"patient_records.xml" ) );
> >     Element patient = document.getRootElement();
> >
> >
> >
> >     Best regards
> >
> >     Ben
> >
> >
> >     On Sat, 2002-11-16 at 23:52, Pae Choi wrote:
> >
> >         /Say we have an XML document as follows:///
> >         ////
> >         /<Patient>///
> >         /    <Age>39</Age>///
> >         /    <Gender>Female</Gender>///
> >         /    <ContactInfo>///
> >         /        <PhoneNumber>123-456-7890</PhoneNumber>///
> >         /        <EmailAddress>[EMAIL PROTECTED]</EmailAddress>///
> >         /    </ContactInfo>///
> >         /</Patient>///
> >         ////
> >         /And we use the XPath to only get the <ContactInfo>, e.g.,///
> >         /"//ContactInfo" which should get the result as follows;///
> >         ////
> >         /    <ContactInfo>///
> >         /        <PhoneNumber>123-456-7890</PhoneNumber>///
> >         /        <EmailAddress>[EMAIL PROTECTED]</EmailAddress>///
> >         /    </ContactInfo>///
> >         ////
> >         /My question is:///
> >         ////
> >         /[Q] Is there way to get the rest of XML document in a simple///
> >         /      way. The rest of XML document should be as follows;///
> >         ////
> >         /<Patient>///
> >         /    <Age>39</Age>///
> >         /    <Gender>Female</Gender>///
> >         /</Patient>///
> >         ////
> >         /Any comments? Thank you.///
> >         ////
> >         /Regards,///
> >         ////
> >         ////
> >         /Pae///
> >         ////
> >         ////
> >         ////
> >
> > --
> > benjamin kopic
> > m: +44 (0)780 154 7643
> > t: +44 (0)20 7794 3090
> > e: [EMAIL PROTECTED]
> > w: http://www.panContext.com/
> >
>
>
> --
>
> +------------------------------------------------------------+
> | David Lucas                        mailto:[EMAIL PROTECTED]  |
> | Lucas Software Engineering, Inc.   (740) 964-6248 Voice    |
> | Unix,Java,C++,CORBA,XML,EJB        (614) 668-4020 Mobile   |
> | Middleware,Frameworks              (888) 866-4728 Fax/Msg  |
> +------------------------------------------------------------+
> | GPS Location:  40.0150 deg Lat,  -82.6378 deg Long         |
> | IMHC: "Jesus Christ is the way, the truth, and the life."  |
> | IMHC: "I know where I am; I know where I'm going."    <><  |
> +------------------------------------------------------------+
>
> Notes: PGP Key Block=http://www.lse.com/~ddlucas/pgpblock.txt
> IMHO="in my humble opinion" IMHC="in my humble conviction"
> All trademarks above are those of their respective owners.
>
>



-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to