Author |
Message
|
malammik |
Posted: Mon Jul 11, 2005 12:49 pm Post subject: xml.attribute |
|
|
 Partisan
Joined: 27 Jan 2005 Posts: 397 Location: Philadelphia, PA
|
I have xml which looks like this
<myxml>
<a xsi:type = foo>
<a xsi:type = bar>
and so on
</myxml>
Say I need the a with xsi type bar. Is there a way to get to <a> with xsi type bar right away w/o having to loop and check?
I know this grammar is not supported but something like this.
DECLARE X REFERENCE TO A.(XML.Attribute)xsi:type='bar'
Thanks. _________________ Mikhail Malamud
http://www.netflexity.com
http://groups.google.com/group/qflex |
|
Back to top |
|
 |
JT |
Posted: Mon Jul 11, 2005 1:59 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Quote: |
Is there a way to get to <a> with xsi type bar right away w/o having to loop and check? |
I don't believe so, at least we haven't been able to do so without looping through the array and then setting the REFERENCE pointer to the required occurrence. Obviously, with a single line of code you can extract the values on the <a> occurrence that you seek, but that doesn't tell you the position in the array. |
|
Back to top |
|
 |
malammik |
Posted: Mon Jul 11, 2005 4:43 pm Post subject: |
|
|
 Partisan
Joined: 27 Jan 2005 Posts: 397 Location: Philadelphia, PA
|
|
Back to top |
|
 |
chibban |
Posted: Tue Jul 12, 2005 1:41 pm Post subject: |
|
|
Novice
Joined: 01 Jun 2005 Posts: 14
|
Hello,
I have a related question :
I need to generate XML with attributes, lets say :
Code: |
<EXAMP>
<FIRST type="NUMBER">
<SECOND type="CHAR">
</EXAMP> |
I tried using the CREATE FIELD command with NameValue type as mentioned in the reference : http://publib.boulder.ibm.com/infocenter/wbihelp/index.jsp
like this :
Code: |
CREATE FIELD OutputRoot.XML.TestCase.description TYPE NameValue VALUE 'This is my TestCase' ; |
Which suppose to create this :
Code: |
<TestCase description="This is my TestCase"> |
But it creates the description as a son tag of the TestCase, and somtimes (I think only when I use the 'type' word as an attribute) it omits it, I mean the output does not contain the attribute 'type'.
How can I create XML with attributes then ? _________________ Thanks,
Sivan |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jul 12, 2005 2:05 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
chibban wrote: |
I have a related question |
No, you don't.
chibban wrote: |
How can I create XML with attributes then ? |
By reading the documentation that specifically tells you how to address different types of XML fields in ESQL.
Or by doing a search here for "XML Attribute", and finding any of the probably hundreds of other times that this question has been asked.
Welcome to the Internet. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
chibban |
Posted: Wed Jul 13, 2005 1:24 pm Post subject: |
|
|
Novice
Joined: 01 Jun 2005 Posts: 14
|
I did search for XML Attribute, and I even tried both ways of creating the xml attribute, Still it doesn't work... I get an invalid XML structure...
I have no idea what I'm doing wrong.
[I tried the NameValue option and the (XML.Attribute) option...]
Any idea ? _________________ Thanks,
Sivan |
|
Back to top |
|
 |
JT |
Posted: Wed Jul 13, 2005 3:31 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Code: |
SET OutputRoot.XML.EXAMP.FIRST.(XML.Attribute)type = 'NUMBER';
SET OutputRoot.XML.EXAMP.SECOND.(XML.Attribute)type = 'CHAR'; |
If you still receive an 'invalid XML structure' error after implementing the code above, post all of your ESQL code. |
|
Back to top |
|
 |
|