Re: Need to parse java string with XML data

Posted by cjhowe on
URL: http://ofbiz.116.s1.nabble.com/Need-to-parse-java-string-with-XML-data-tp145266p145269.html

> <number=3106799433><name=><dnis=2149><state=active>

I don't believe that to be well-formed XML. I suspect there is a parent
to those "elements" and if there is, it should look like this...

As child elements:
<parent>
  <number>3106799433</number>
  <name/>
  <dnis>2149</dnis>
  <state>active</state>
</parent>

or..
as attributes:
<parent number="3106799433" name="" dnis="2149" state="active"/>


--- Walter Vaughan <[hidden email]> wrote:

> David E. Jones wrote:
>
> >
> > Check out the UtilXml class in OFBiz, it has some handy methods for
>  
> > this kind of stuff, including that very thing.
>
> Okay I've read
>
>
http://www.ofbiz.eu/framework/base/build/javadocs/org/ofbiz/base/util/UtilXml.html

> and I've looked at sample code and nothing jumps out at me. :(
>
> I'll have a string with data like this in it...
> <number=3106799433><name=><dnis=2149><state=active>
>
> It's not really clear to me get from that string via readXmlDocument,
>
> firstChildElement, and get to an array or whatever where I can
> reference
> "number" and get "3016799433" as a result.
>
> --
> Walter
>
>
>