Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Go
New
Search
Notify
Tools
Reply
  
rename element in xml
 Login/Join
 
Gold member
posted
I am looking for a way to rename without using a transform

</Header>
...
...
</Header>

To

</Hdr>
...
</Hdr>


Thanks


IWay SM 5.6, 6.01, 6.1, 6.9, 7.0
EDI, XML, XSD, WF 8.0, DM 77,8.0 asp.net, SQL Server
 
Posts: 85 | Registered: February 27, 2009Reply With QuoteReport This Post
Expert
posted Hide Post
Not knowing what you can do in iWay, from a text perspective, you could initiate some sort of global change.

In Unix and Windows (if installed), things like the sed command can do this.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6131 | Location: 33.8688° S, 151.2093° E | Registered: October 31, 2006Reply With QuoteReport This Post
Gold member
posted Hide Post
Needs to be in Iway process,

thanks


IWay SM 5.6, 6.01, 6.1, 6.9, 7.0
EDI, XML, XSD, WF 8.0, DM 77,8.0 asp.net, SQL Server
 
Posts: 85 | Registered: February 27, 2009Reply With QuoteReport This Post
Member
posted Hide Post
Hi,

I don't know if this is the exactly for you but you might try to define XDXMLExtract Service (com.ibi.agents.XDXMLExtract). It allows you to use XPATH expression to locate your element (for example < Header >) and then to define optional name for the root of the extracted subtree (like < Hdr >)

Otherwise... why not to use transform?

Regards,
Rivo


iSM 6.0
iDM 7.6.5 - 7702
WF 7.6.4 - 7702

All output formats
 
Posts: 23 | Location: Tallinn, Estonia | Registered: July 31, 2009Reply With QuoteReport This Post
Member
posted Hide Post
Ray,

1. Create an XML file listener.
2. Create an XML to XML Transform. Use the file you wish to modify as the input dictionary and data. Use the same file as the output dictionary. Use "Automap" to map the input to Output. In the Output column right click on the "Header" element. Rename it to "Hdr".
3. Create a process flow with your transform followed by a file(write) object.
4. Create your channel using all those elements.

I am not sure of your level of knowledge so I do not know if this is too high level, or too detailed.

Let me know if you have any questions.


------
Livin' down on the cube farm. Left, right, right.

iWay 5.6
Windows
Excel, Tab-delimited, XML
 
Posts: 23 | Location: Minnesota | Registered: July 27, 2009Reply With QuoteReport This Post
Gold member
posted Hide Post
can not use transform. the xml coming in will not always be the same Structure. The only thing that will always be there is the the parent tag </Header> witch needs to get rename because it is now a researved word in Unix.


IWay SM 5.6, 6.01, 6.1, 6.9, 7.0
EDI, XML, XSD, WF 8.0, DM 77,8.0 asp.net, SQL Server
 
Posts: 85 | Registered: February 27, 2009Reply With QuoteReport This Post
Member
posted Hide Post
Is this < header > root tag for your xml document?


iSM 6.0
iDM 7.6.5 - 7702
WF 7.6.4 - 7702

All output formats
 
Posts: 23 | Location: Tallinn, Estonia | Registered: July 31, 2009Reply With QuoteReport This Post
Gold member
posted Hide Post
<?xml version="1.0"?>
<document>
<header>

</header>
<detail>

</detail>
<detail>

</detail>
<detail>

</detail>
<detail>

</detail>
<footer>

</footer>
</document>


IWay SM 5.6, 6.01, 6.1, 6.9, 7.0
EDI, XML, XSD, WF 8.0, DM 77,8.0 asp.net, SQL Server
 
Posts: 85 | Registered: February 27, 2009Reply With QuoteReport This Post
Member
posted Hide Post
I ay this jokingly, but it is shades of truth. "Your requirements are wrong". Why does it have to be in iWay?

To me it looks like what you are trying to do is better suited to an OS tool instead of a iWay. In my experience iWay does not handle variablity of this sort with ease. I notice your signature says you are in Windows. If you can wait until the file would be on the UNIX platform SED or AWK would be the ticket.

Otherwise maybe RivoU suggestion of XMLXDextract shold be investigated.


------
Livin' down on the cube farm. Left, right, right.

iWay 5.6
Windows
Excel, Tab-delimited, XML
 
Posts: 23 | Location: Minnesota | Registered: July 27, 2009Reply With QuoteReport This Post
Member
posted Hide Post
quote:
exactly for you but you might try to define XDXMLExtract Service (com.ibi.agents.XDXMLExtract). It allows you to use XPATH expression to locate your element (for example < Header >) and


I've used XDXMLExtract before to rename a node. However, I don't think it would work in this case. The service will only bring back the node specified and all child nodes, not sibling nodes. I have an open case on this issue Ray, I'll let you know when I hear back.

Mike.
Vancouver, BC


iWay Adapter Manager version 5.5.005.SP5(i55005SP511) running on Windows platform
iWay Service Manager version 5.6.000.SM running on Windows platform.
 
Posts: 1 | Registered: July 20, 2009Reply With QuoteReport This Post
Member
posted Hide Post
OK.. maybe not the most elegant solution but does the job...

1) Start
2) Service objects
*Service Object 1:com.ibi.agents.XDXMLExtract
XPath Expression: /document/header/*
Root tag: hdr
*Service Object 2:com.ibi.agents.XDXMLExtract
XPath Expression: //document/detail
Root tag: body
*Service object 3:com.ibi.agents.XDXMLExtract
XPath Expression: /document/footer/
Root tag:
3)Join Object, to merge 3 parts into 1 doc
4) Service object: com.ibi.agents.XDEntagAgent
*Tag Name = document
*Base 64 Encoding = false
5)End

input doc
<?xml version="1.0" encoding="UTF-8" ?> 
  <document>
  <header>
  <test1>testhead</test1> 
  </header>
  <detail>
  <nr>1</nr> 
  </detail>
  <detail>
  <nr>2</nr> 
  </detail>
  <detail>
  <nr>3</nr> 
  </detail>
  <detail>
  <nr>4</nr> 
  </detail>
  <footer>
  <test1>testfoot</test1> 
  </footer>
  </document>



and output:
<?xml version="1.0" encoding="UTF-8" ?> 
 <document>
 <Join joins="3" relations="3">
 <body>
 <detail>
 <nr>1</nr> 
 </detail>
 <detail>
 <nr>2</nr> 
 </detail>
 <detail>
 <nr>3</nr> 
 </detail>
 <detail>
 <nr>4</nr> 
 </detail>
 </body>
 <hdr>
  <test1>testhead</test1> 
 </hdr>
 <footer>
  <test1>testfoot</test1> 
 </footer>
 </Join>
 </document>


I try to figure out something better also...

Rivo


iSM 6.0
iDM 7.6.5 - 7702
WF 7.6.4 - 7702

All output formats
 
Posts: 23 | Location: Tallinn, Estonia | Registered: July 31, 2009Reply With QuoteReport This Post
Gold member
posted Hide Post
so close, I get
  <?xml version="1.0" encoding="UTF-8" ?> 
- <document>
- <Join joins="3" relations="3">
  <hdr /> 
- <body>
- <superroot>
  <hdr /> 
  </superroot>
  </body>
- <superroot>
- <body>
- <superroot>
  <hdr /> 
  </superroot>
  </body>
  </superroot>
  </Join>
  </document>
 

I must be doing something.


IWay SM 5.6, 6.01, 6.1, 6.9, 7.0
EDI, XML, XSD, WF 8.0, DM 77,8.0 asp.net, SQL Server
 
Posts: 85 | Registered: February 27, 2009Reply With QuoteReport This Post
Gold member
posted Hide Post
Solved

Thanks Rivo


IWay SM 5.6, 6.01, 6.1, 6.9, 7.0
EDI, XML, XSD, WF 8.0, DM 77,8.0 asp.net, SQL Server
 
Posts: 85 | Registered: February 27, 2009Reply With QuoteReport This Post
  Powered by Social Strata  
 


Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.