Hello Community -
I am getting an issue while fetching xml values. It pops up the below error message.
“For Each: The ‘:’ character, hexadecimal value 0x3A, cannot be included in a name”
I need to fetch the request id value from the below XML to use further -
<env:Envelope xmlns:env=“http://schemas.xmlsoap.org/soap/envelope/ ” xmlns:wsa=“WS-Addressing 1.0 Namespace ”>
env:Header
wsa:Action submitRequest</wsa:Action>
wsa:MessageID urn:uuid:136fd538-9ec0-4519-b7ca-9c5749fd03cd</wsa:MessageID>
wsa:RelatesTo urn:uuid:bc779307-1819-4667-8cec-b246405011a1</wsa:RelatesTo>
</env:Header>
env:Body
<ns0:submitRequestResponse xmlns:ns0=“http://xmlns.oracle.com/scheduler ”>
287054
</ns0:submitRequestResponse>
</env:Body>
</env:Envelope>
Kindly help.
Thanks,
Vinay
ppr
(Peter Preuss)
October 20, 2020, 8:41am
2
@VinayTiwari
your xml is defining a namespace and we have to handle this.
For a first starter help have a look here
Hi @mikamol
Find the attached sample Main.xaml (8.1 KB)
that is showcasing following:
Retrieving all Field elements
Retrieving all Id elements (Parent is Field)
Retrieving the particular Answer Value for a particular Id
As this XML is defining the namespace:` xmlns="urn:abou:documents:ka:Case
The Root element Name is not Case it is: e.g. urn:abou:documents:ka:Case:Case
So the namespace part is to take into account
Solved with using namespace manager
Kindly note the order from a XML Docu…
and also another example:
XMLWithNameSpace_GetAttribute.xaml (5.0 KB)
demoNamespaceGetAttribute.xml (166 Bytes)
Let us know your further questions. With a sample xml from your end we can also adress your scenario individually
@ppr - Thanks for your response.
Yeah, for sure we need to handle the namespaces here, just looking out the way to handle it. Few of the activities are missing from attached “Main.xaml” bot. Kindly upload the “Main.xaml” bot here.
Thanks,
Vinay
ppr
(Peter Preuss)
October 20, 2020, 9:10am
4
@VinayTiwari
in general do this:
define the name space (datatype XNamespace)
and use it for the name
Thanks @ppr .
I tried with above mentioned steps but no luck. Here my xml structure is different in comparison to yours.
******************************** XML ********************************************
<env:Envelope xmlns:env=“http://schemas.xmlsoap.org/soap/envelope/ ” xmlns:wsa=“WS-Addressing 1.0 Namespace ”>
env:Header
wsa:Action submitRequest</wsa:Action>
wsa:MessageID urn:uuid:136fd538-9ec0-4519-b7ca-9c5749fd03cd</wsa:MessageID>
wsa:RelatesTo urn:uuid:bc779307-1819-4667-8cec-b246405011a1</wsa:RelatesTo>
</env:Header>
env:Body
<ns0:submitRequestResponse xmlns:ns0=“http://xmlns.oracle.com/scheduler ”>
287054
</ns0:submitRequestResponse>
</env:Body>
</env:Envelope>
It seems we have handled the namespaces but “:” is still causing issues. I tried to put the same sign into variable and use the variable into code but that also didn’t worked.
Below is what i tired so far -
Declared the namespaces.
Use in code.
1 Like
ppr
(Peter Preuss)
October 20, 2020, 11:29am
6
@VinayTiwari
please share XML as file or use the format </>
button from editor. The sample is not readable.
Thanks
also have a look on the demos we do use NameSpaceVar + Elementname and not env:… here the colon is maybe causing the issue. please correct your code accordingly
As Envelope is the root we can ommit Envelope:
XMLResult.Root.Element(NameSpace1 + “Body”).Element(Namespace3 + “submitRequestResponse”).Value.toString could work as far the broken shared XML is get interpretated
another example also here:
@Pradeep.Robot
Following up the communications from messages find some further starter help:
XML Namespaces can confuse sometimes. But with following it can be overcome and analysed. After deserializing into an XDoc following statement can be used for exploration in the watch Box / Immediate Box while debbuging:
[grafik]
playing with the index the element of interest can be checked if its dealing with any Namespace or not
with the LINQ XML methods we can use the Descendants(“SubCollection”)…
Hello Vinay,
In this video I Deserialize XML with NameSpace inside:
23:50 Deserialize XML
25:15 How to extract Data from XML Nodes
27:40 How to extract Data from XML Attributes
Thanks,
Cristian Negulescu
3 Likes