Author |
Message
|
DJN2 |
Posted: Tue Jun 14, 2011 9:11 am Post subject: ESQL to English Code Translation |
|
|
Apprentice
Joined: 02 Jan 2009 Posts: 27 Location: New Jersey
|
Can someone translate this sniptes of code.
1)
DECLARE refBody REFERENCE TO Root.XMLNSC.(XMLNSC.Element)*[<];
IF NOT EXISTS(refBody.*:"PFUProfiles"[])
.. in regards to the [<] in the first line and the *: in the second. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jun 14, 2011 9:15 am Post subject: Re: ESQL to English Code Translation |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
DJN2 wrote: |
.. in regards to the [<] in the first line and the *: in the second. |
The first line is explained here
The second line is a wildcard (*) to match any namespace ( : ) _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
DJN2 |
Posted: Tue Jun 14, 2011 11:38 am Post subject: |
|
|
Apprentice
Joined: 02 Jan 2009 Posts: 27 Location: New Jersey
|
does that mean any namespace at all? What is the signifcance of 'PFUProfiles"? |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 14, 2011 11:43 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
DJN2 wrote: |
does that mean any namespace at all? What is the signifcance of 'PFUProfiles"? |
Yes, wildcard means "whatever the namespace is, match it anyway".
"PFUProfiles" is the name of an element.
What it means depends entirely on the meaning of the document in question. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jun 14, 2011 12:51 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
This:
Code: |
DECLARE refBody REFERENCE TO Root.XMLNSC.(XMLNSC.Element)*[<]; |
is declaraing a reference to the last child of InputRoot.XMLNSC that is an XML element ( a tag, as opposed to an attribute ). In other words, it is attempting to place a REF on the root tag of the document, while carefully avoiding the XML declaration, or any XML comments or processing instructions that are positioned as siblings of the root tag.
It could just as safely have taken the first element child, because the rules of XML don't allow more than one root tag per document. Not saying that the code is wrong, I'm just pointing out that < and > would both be correct.
This:
Code: |
IF LASTMOVE(refBody) THEN |
...should really be the next line, but the author clearly thought that it was safe to omit it. Maybe the author was correct - the XMLNSC parser would probably have issued a fatal error if there was no root tag.
This
Code: |
IF NOT EXISTS(refBody.*:"PFUProfiles"[]) |
is checking whether there is any element with name 'PFUProfiles' as a direct child of the root tag. The namespace will not be checked. |
|
Back to top |
|
 |
|