Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Feb 2013
    Posts
    2
    Vote Rating
    0
    syadmus is on a distinguished road

      0  

    Default Unanswered: Using XMLReader and XMLWriter for complex XML data

    Unanswered: Using XMLReader and XMLWriter for complex XML data


    Hello everyone,

    currently I am trying to develop an application with ExtJS and Sencha Architect. My really big problem is, that I am not able to get the XMLReader & the XMLWriter to work with nested XML data.

    My XML looks like this (just a little part of it):

    Code:
    <Calculation>
      <Sections>
        <Section>
          <Text><ShortText>Short description text</ShortText></Text>
          <Item>
            <Text><ShortText>Short description text of the item</ShortText></Text>
          </Item>
        </Section>
        <Section>
          <Text><ShortText>Short description text</ShortText></Text>
          <Item>
            <Text><ShortText>Short description text of the item</ShortText></Text>
          </Item>
          <Sections>
            <Section>
              <Text><ShortText>Short description text of the item</ShortText></Text>
            </Section>
          </Sections>
        </Section>
      </Sections>
    </Calculation>
    As you can see, my data is quite complex. What would be the best approach to work with this xml data.
    I have tried everything from defining models with associations to converting the xml into JSON... I have really no clue, how I could get this data into a xmlTreeStore.

    Note, that i am working with sencha architect. =)

    Greets,
    Richard

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Posts
    2
    Vote Rating
    0
    syadmus is on a distinguished road

      0  

    Default Additional information

    Additional information


    I started another try and endet up with the scenario, that I am able to load the first layer of my xml. I have one associated model, which is not loaded at all. What am I doing wrong?

    This is my current XML testfile:

    Code:
    <Sections>
        <Section>
            <ComponentID>1</ComponentID>
           <ParentID>0</ParentID>
            <Text lang="en-us">
                <ShortText>Some Text</ShortText>
                <LongText/>
            </Text>
            <leaf>true</leaf>
            <Item>
                <InternalNumber>00001</InternalNumber>
                <ExternalNumber>1</ExternalNumber>
                <Text lang="en-us">
                  <ShortText>Another Text</ShortText>
                  <LongText/>
                </Text>
                <Comment/>
              </Item>
              <Item>
                <InternalNumber>00002</InternalNumber>
                <ExternalNumber>1</ExternalNumber>
                <Text lang="en-us">
                  <ShortText>Another Text 2</ShortText>
                  <LongText/>
                </Text>
                <Comment/>
              </Item>
    
        </Section>
        <Section>
            <ComponentID>2</ComponentID>
           <ParentID>0</ParentID>
            <Text lang="en-us">
                <ShortText>Example Text 1</ShortText>
                <LongText/>
            </Text>
            <leaf>true</leaf>
            <Section>
                <ComponentID>3</ComponentID>
                <ParentID>2</ParentID>
                <Text lang="en-us">
                    <ShortText>Example Text 2</ShortText>
                    <LongText/>
                </Text>
                <leaf>false</leaf>
            </Section>
        </Section>
    </Sections>
    This is my model definition for the sections:

    Code:
    Ext.define('TOC.model.section', {
        extend: 'Ext.data.Model',
    
    
        uses: [
            'TOC.model.item'
        ],
    
    
        idProperty: 'component_id',
    
    
        hasMany: {
            associationKey: 'Items',
            model: 'TOC.model.item',
            primaryKey: 'internal_number',
            name: 'items'
        },
    
    
        fields: [
            {
                name: 'component_id',
                mapping: 'ComponentID'
            },
            {
                name: 'short_text',
                mapping: 'Text>ShortText'
            }
        ]
    });
    This is the definition for the items:

    Code:
    Ext.define('TOC.model.item', {
        extend: 'Ext.data.Model',
    
    
        idProperty: 'internal_number',
    
    
        fields: [
            {
                name: 'internal_number',
                mapping: 'InternalNumber'
            },
            {
                name: 'external_number',
                mapping: 'ExternalNumber'
            },
            {
                name: 'short_text',
                mapping: 'Text>ShortText'
            },
            {
                name: 'section_id',
                mapping: 'ExternalNumber'
            }
        ]
    });
    And this is the store:

    Code:
    Ext.define('TOC.store.sections', {
        extend: 'Ext.data.TreeStore',
    
    
        requires: [
            'TOC.model.section'
        ],
    
    
        constructor: function(cfg) {
            var me = this;
            cfg = cfg || {};
            me.callParent([Ext.apply({
                autoLoad: true,
                storeId: 'Sections',
                model: 'TOC.model.section',
                proxy: {
                    type: 'ajax',
                    url: 'data/demo.xml',
                    reader: {
                        type: 'xml',
                        root: 'Sections',
                        record: 'Section'
                    }
                },
                listeners: {
                    load: {
                        fn: me.onXmltreestoreLoad,
                        scope: me
                    }
                }
            }, cfg)]);
        },
    
    
        onXmltreestoreLoad: function(treestore, node, records, successful, options) {
            var rec      = treestore.getNodeById(1);
            console.log(rec.data);
            item  = rec.items();
            console.log(item.count());
        }
    
    
    });
    This code is mostly generated by Sencha Architect.
    I am able to get the first layer (section) from the XML... but not the items. Another problem is, that the tree does not understand the nesting of sections... The rules for this XML are:

    Sections CAN haveMany Sections
    Sections CAN haveMany Items

    Someone with an idea?

    Thanks!
    Richard