MySQL Forums
Forum List  »  Connector/Node.js

Re: Help with ExtractValue
Posted by: Jonathan Stephens
Date: February 18, 2009 02:07AM

Well, you *can* select <WORK/> and <HOME/> but they're empty. ExtractValue() gets the *content* of the tag, and empty tags have no content.

Let's look at your example again:

<vCard>
<ADR><WORK/><REGION>Dorset</REGION></ADR>
<ADR><HOME/><REGION>London</REGION></ADR>
</vCard>

Here's a tree representation:


        vCard
          |
   ---------------
   |             |
  ADR           ADR
   |             |
 -------      -------
 |     |      |     |
WORK REGION  HOME REGION

WORK and REGION are both children of the first ADR element; WORK and REGION are siblings. REGION is not a child of WORK.

Similarly, HOME and REGION are both children of the second ADR element. REGION is not a child of HOME.

Actually, a better XML representation of this information might be:


<vCard>
<ADR><TYPE>work</TYPE><REGION>Dorset</REGION></ADR>
<ADR><TYPE>home</TYPE><REGION>London</REGION></ADR>
</vCard>

or this:


<vCard>
<ADR type="work"><REGION>Dorset</REGION></ADR>
<ADR type="home"><REGION>London</REGION></ADR>
</vCard>


Either of these gives the ADR element consistent structure throughout the XML document, making it heaps easier to work with. :)

Jon Stephens
MySQL Documentation Team @ Oracle

MySQL Dev Zone
MySQL Server Documentation
Oracle

Options: ReplyQuote


Subject
Written By
Posted
January 18, 2009 10:54AM
January 18, 2009 03:37PM
Re: Help with ExtractValue
February 18, 2009 02:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.