Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Utility to convert XML to value pair ?

From: "dingdongdingding@-----.---" <----------------@-----.--->
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/



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent