Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Xpath parsing problem

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Mike Miller <mm8041 AT gmail.com>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Xpath parsing problem
  • Date: Thu, 3 Mar 2011 10:10:24 -0500

Ok, I suppose some research is in order. I'm getting lazy as I get older
and really wanted
something like: well just do this or put that in your xpath query and it
will work ;-)

BTW: I did see an XOM example somewhere, where a person showed you do
something
like: doc.query("/*:tag1/*:tag2"); so as to wildcard or ignore namespace
issues (which is
what I wanted to do). But XOM threw an exception about having a colon in
the xpath.
Is this doable?

Thanks,
Mike

On Thu, Mar 3, 2011 at 10:01 AM, Michael Kay <mike AT saxonica.com> wrote:

> >Stating that I don't understand how namespaces fit into xpath queries is
> not really a help, that's obvious.
>
> I thought it would help point you to the right place in the
> FAQ/documentation.
>
> So to help me out here, it was my impression that tags within an xml
>> document
>> that are not preceeded by<something: do not have namespaces applied, is
>> this
>> incorrect?
>>
> No. If an element name contains no colon, it takes on the default
> namespace, which is the one introduced by xmlns="...." on that or the
> nearest ancestor element that has such a declaration.
>
>
> If so, then I assume there is some default namespace that
>> applies to
>> all tags when one is not specified? If it's too much to explain this to
>> me,
>> then
>> could I get a link that would clarify?
>>
> Look for the namespaces chapter in the introduction of any basic XML book,
> or google for "Namespaces tutorial".
>
> Or if its not too difficult, can I get a simple example of using the query
>> method
>> with xpath to drill into a document when namespaces are involved?
>>
>> Yes, it's not too difficult, just google for "XPath default namespace
> FAQ".
>
> Michael Kay
> Saxonica
>
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>




Archive powered by MHonArc 2.6.24.

Top of Page