Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Utility to convert XML to value pair ? >Thread Next - Re: Utility to convert XML to value pair ? Re: Utility to convert XML to value pair ?To: NULL Date: 4/9/2008 11:07:00 PM When I look closer at the XML, I realise that I myself had
misinterpreted my needs. Inside the XML, there is a portion where the
value are coded as (eg):
<NameValuePair>
<name>Name</name>
<value>xxxxxxxxxxxxxxxxx</value>
</NameValuePair>
<NameValuePair>
<name>Address</name>
<value>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</
value>
</NameValuePair>
<NameValuePair>
<name>Telephone</name>
<value>xxxxxxxx</value>
</NameValuePair>
<NameValuePair>
<name>Comments</name>
<value/>
</NameValuePair>
Name=3Dxxxxxxxxxxxxxxxxx
Address=3Dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Telephone=3Dxxxxxxxx
Comments=3D
So are there any tools that can do this ? Thanks.
On Apr 10, 6:14=A0am, Peter Flynn <peter.n...@m.silmaril.ie> wrote:
> dingdongdingd...@yahoo.com wrote:
> > Is there any freeware to convert an XML to text such as
>
> > Name=3DABC
> > Address=3DDEF
> > Tel=3D123
> > etc....
>
> It depends on the structure of your XML document. For anything other
> than the trivial case like
>
> <doc>
> =A0 =A0<Name>ABC</Name>
> =A0 =A0<Address>DEF</Address>
> =A0 =A0<Tel>123</Tel>
> </doc>
>
> you'll need to provide some indication of *what* you want to extract.
>
> However, if you just want name=3Dvalue pairs regardless, the simplest tool=
> is to use the ESIS output of onsgmls (part of OpenSP, seehttp://validator.=
w3.org/dist/) and two of the standard text processing
> tools (grep and gawk) that you can install with Cygwin
> (http://www.cygwin.com/) or GNU Utilities for Win32
> (http://unxutils.sourceforge.net/)
>
> $ onsgmls -wxml xml.dcl myfile.xml | grep -E '^(\-|\()' | grep -v
> '^-\\n\\012[\ ]*$' | gawk '/^\(/ {gi=3Dsubstr($0,2)} /^\-/ {print gi "=3D\=
""
> substr($0,2) "\""}'
> Name=3D"ABC"
> Address=3D"DEF"
> Tel=3D"123"
>
> ///Peter
> --
> XML FAQ:http://xml.silmaril.ie/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
