PDA

View Full Version : Problem reading XML structure



max52
22 Apr 2008, 5:19 AM
Is it not possible, to read a XML structure like this:


<sftable>
<vorgang>
<sfrec>
<createdate>2007-08-08 11:30:26</createdate>
<createusr>3711</createusr>
<updatedate>2008-04-09 12:02:38</updatedate>
<sfextdata>
<product_info>
<mid>222</mid>
<description>
<prod_geber id="81">Gothaer</prod_geber>
<prod_typ id="6">Hausrat</prod_typ>
<prod_typ2 id="6">Hausrat</prod_typ2>
<prod_vorgang id="2">Deckungsaufgabe</prod_vorgang>
</description>
</product_info>
<product_instance xmlns:p="url" xmlns:fi="url" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gothaer="url">
<p:product>
<p:head>
<p:ID>580083</p:ID>
<p:Name>Gothaer AG Hausrat V2</p:Name>
<p:Beschreibung/>
<p:Version>2.0</p:Version>
</p:head>
</p:product>
</product_instance>
</sfextdata>
</sfrec>
</vorgang>
</sftable> I have the problems with the <p:product> node.

In the reader, the mapping is declared as the following:

reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'sfrec',
id: 'id',
//totalRecords: '@total'
}, [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
{name: 'send_date', mapping: 'sfextdata > process > item > send_date'},
{name: 'prod_geber', mapping: 'sfextdata > product_info > description > prod_geber'},
{name: 'prod_typ', mapping: 'sfextdata > product_info > description > prod_typ'},
{name: 'prod_vorgang', mapping: 'sfextdata > product_info > description > prod_vorgang'},
{name: 'version', mapping: 'sfextdata > product_instance > product > head > Version'}
])I have tried the mapping also like this:

{name: 'version', mapping: 'sfextdata > product_instance > p:product > p:head > Version'}The dataindex 'version' is always empty.

Can anybody help?
Thanks!

Animal
22 Apr 2008, 5:21 AM
DomQuery doesn't do namespaces.