XML search - fast, text inside nodes or text as attribute value

I don’t know if this is the right question or not, but out of curiosity I want to know what I’ll look for quickly. For Ex -

<A>
  <Name>John</Name>
</A>

or

<A>
  <Name n="John"/>
</A>

I saved millions of text as an attribute value, although not large enough. Above is just an example for a better understanding of the issue.

Now, if you use XML databases such as BaseX, eXists, etc., am I trying to search or create and index all names that will be faster?

+4
source share
1 answer

This is implementation dependent, so it cannot be generalized to all XML databases. Although in this simple case, I think it is the same for all databases: it does not matter.

BaseX, . , , <A/>. , XPath,

//A[Name = "John"]

:

db:text("your-database", "John")/parent::*:Name/parent::*:A

XPath , , :

//A[Name/@n = "John"]

db:attribute("your-database", "John")/self::*:n/parent::*:Name/parent::*:A

, ( ), , db:text() vs. db:attribute(). , , ( ), .

, XML XQuery, , . , .

+1

All Articles