cancel
Showing results for 
Search instead for 
Did you mean: 

BLS, extract parts of an XML

Former Member
0 Kudos

Hi.

I may have asked before, but can not find the answer anywhere. I have an XML which I want to extract parts of. It this possible an how?

I want to get the part

/ns1:GetProductionSchedule

/ns2:GetProductionSchedule

/ns2:DataArea

/ns3:ProductionSchedule

and everything below it....

The XML is as follows.

<?xml version="1.0" encoding="UTF-8"?>

<GetProductionSchedule xmlns="http://Wonderware.WWEI.Services">

<GetProductionSchedule xmlns="http://www.wonderware.com/wwei/v0201/schemas">

<ApplicationArea>

<Sender>

<LogicalID/>

<ComponentID/>

<TaskID/>

<ReferenceID/>

<ConfirmationCode/>

<AuthorizationID/>

</Sender>

<CreationDateTime/>

<BODID/>

<UserArea/>

</ApplicationArea>

<DataArea>

<ProductionSchedule xmlns="http://www.wbf.org/xml/b2mml-v02">

<ID>000003176585</ID>

<Description/>

<Location>

<EquipmentID/>

<EquipmentElementLevel OtherValue=""/>

<Location>

<EquipmentID/>

<Any/>

</Location>

<Any/>

</Location>

<PublishedDate/>

<StartTime/>

<EndTime/>

<EquipmentElementLevel OtherValue=""/>

<Any/>

</ProductionSchedule>

</DataArea>

</GetProductionSchedule>

</GetProductionSchedule>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Poul,

what do you exactly want to do by extracting?

For example, you can copy the node /GetProductionSchedule/GetProductionSchedule/DataArea/ProductionSchedule into a XML local variable by just using the link type "assign xml" (it will automatically be used when you drag the node "ProductionSchedule" and drop it on the variable.

Is that what you need?

Michael

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi all.

My problem is solved. The cause was, that my XML contained several of these nodes. I made a transaction that removed these, and now I can manipulate it as I want to.....

I think, that the problem is the namespace naming "xmlns:ns1", but I am not sure.

<Any>

<ns1:ReservationNumber

xmlns:ns1="http://www.sap.com/S95B2MMLExtn">0221229082

</ns1:ReservationNumber>

</Any>

BR.

Poul.

Former Member
0 Kudos

Hi.

I think, I have found my problem. My original XML contains several nodes like the following, and this is causing the problem.

<Any>

<ns1:ReservationNumber

xmlns:ns1="http://www.sap.com/S95B2MMLExtn">0221229082

</ns1:ReservationNumber>

</Any>

BR.

Poul.

Former Member
0 Kudos

Part of the challenge with B2MML implementations is that the standard isn't always standard.

As long as the schema (or sample document) is correctly defined with extensions and namespaces, MII should still put the correct namespace(s) in the XPATH when copying/appending/deleting XML.

Former Member
0 Kudos

Hello Michael.

This is exactly what I want to do, but it does not work....

Regards

Poul.

agentry_src
Active Contributor
0 Kudos

Hi Poul,

After you change the link type to Assign XML, you need to do an update to keep the change. I would also verify by closing and reopening the action block to make sure it "took". It may be my absentmindedness in hitting the update button, but it seems to not take sometimes. Then display the local property in a tracer. It should be present.

Good luck,

Mike

agentry_src
Active Contributor
0 Kudos

Poul,

Ignore my previous message. Still mentally working in 11.5.

I assume you are using a tracer to display the extracted xml? I built a little test transaction and you were right. There does not appear to be any extracted xml in the Tracer.Message property. So I did used an XML Saver to save it using the path: "db://ProjectA/WEB/test.xml". Lo and behold the xml was extracted just as Michael and I had expected. So the problem appears to be in the Tracer rather than in the method. This is apparently a problem similar to trying to use a Tracer to display the xml output of a repeater. Which should be fixed in 12.1.

Let me know what you find out. I am working in 12.0.5.

Good luck,

Mike

Edited by: Michael Appleby on Oct 14, 2008 5:17 PM

Former Member
0 Kudos

Michael,

now that you mention the tracer, I remember that from time to time I also get into this trap that the tracer does not display a contents of a node and its sub nodes as expected (I am working on 12.0.2). If I then link one element inside the node into the tracer message, it works.

So Poul, maybe you can try to map, say, Location and see if the tracer outputs something.

Michael