Is the regex or another plugin capable of getting data from:

<itemResponse><items><ITEM category="T-Shirts" color="WHITE" color-code="WHITE" description="2000 WHITE L" feature="6 oz" hex-value="FFFFFF" [...] </ITEM></items></itemResponse>

and allow us to use

category="T-Shirts"

to set the category on a Feed item to T-Shirts, for example?

Thanks very much!

Comments

Anonymous’s picture

j9’s picture

Hi bouton and thanks,

I dont think xpath will retreive specific data within a tag. Rather, it returns the entire data between the tags.

Correct me if I am off, but xpath would only return this whole amount:

<ITEM category="T-Shirts" color="WHITE" color-code="WHITE" description="2000 WHITE L" feature="6 oz" hex-value="FFFFFF" [...] </ITEM>

whereas I am looking to retreive

category="T-Shirts" color="WHITE"

and set taxonomies on a node. Any further thoughts on this?

Thanks very much!

acidpotato’s picture

I havent come around to using regex for anything so far but I think so custom plugins might help you what you want to do -

See #1416700: Add plugin to limit input to words/phrases matching existing taxonomy terms which limits taxonomy terms imported to only existing terms. Also #1623560: find replace by List will be useful for creating lists of find and replace words.

So using following tamper plugin you might be close to what you need to achieve -

1. Using xpath you can create set the source to Item tag and set the target to Category taxonomy field.
2. Use space to explode your terms
3. Use find replace to remove the quotes from T-Shirts term
4. Use the custom plugin restricting taxonomy terms to current terms

This will import only the term T-Shirts from above example. You need to ensure that T-shirts term already exists in your vocabulary. You might need to make some adjustments in the order of the plugins to get what you need depending on what terms already exist in your Vocabulary, if there are any duplicates etc.

Repeat the same process for Color and other vocabularies if needed.

achton’s picture

#2: XPath queries can easily pick out attributes like the ones you suggest.

Check out the examples here: http://www.w3schools.com/xpath/xpath_syntax.asp

twistor’s picture

Issue summary: View changes
Status: Active » Closed (fixed)