0

I've been doing some research on my own and it seems likely this isn't even possible, but maybe someone can help me here.

I have some xml stored in a database that looks something like this:

<?xml version="1.0" encoding="utf-8"?>
<msg>
    <head>
        <Blah>Blah</Blah>
    </head>
    <body>
        <FooDetails>
            <Foo>
                <FooId>9999</FooId>
                <FooField>
                    <Foobar>Foobar value blah</Foobar>
                </FooField>
            </Foo>
            <Bar>
                <BarId>123456789</BarId>
                <BarStatus>B</BarStatus>
            </Bar>
        </FooDetails>
    </body>
</msg>

What I'm wondering is if there's an ExtractValue xpath recipe that could just show me "FooDetails".

Essentially "FooDetails" is the type of transaction. The children of the node will be quite different based on the type of transaction.

Just to answer some anticipated questions, we have a 3rd party sending XML to us via an API which we store in a database and then other scripts come along and process it. So even though the XML format is obviously not ideal, there's no hope of changing it.

Thanks!

1 Answer 1

1

It seems that MySQL doesn't support two functions you would usually use for such task:

  • local-name()
  • name()

Please see it here: The following XPath functions are not supported, or have known issues as indicated:

Sign up to request clarification or add additional context in comments.

1 Comment

Definitely seems to be the case. I was hoping there might be a decent way of tricking it into showing me what I want without some really ugly substring parsing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.