Read xml files from resssources

Home Forums General Programming Read xml files from resssources

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #116587
    zeokazeoka
    Participant
    • Topics: 73
    • Replies: 466
    • Total: 539
    • ★★★

    Hi
    hi have done a valid xml file thats contains lots of sysex strings and just would pickup some properties
    the file is in the panel ressources. it is used to have a ROM
    i searched here to get starting point
    may be i need to identify first the FACTORY tag (ex) as juce object ?

    i see the juce class
    and for now i dunno i will try anyway
    is there any thread that could save time ?

    thank you

    • This topic was modified 1 month, 2 weeks ago by zeokazeoka.
    • This topic was modified 1 month, 2 weeks ago by zeokazeoka.
    #116592
    zeokazeoka
    Participant
    • Topics: 73
    • Replies: 466
    • Total: 539
    • ★★★

    Something like that ?

    local a = resources:getResource("MySounds")        -- MySounds.xml 
     local b = XmlDocument(a)                        -- a is may be not a file if it is a ressource object ??
            if b:getDocumentElement():hasTagName("FACTORY")   -- top xml value tree in the file  
          then local c = b:getDocumentElement()
               local d = c:getChildByName("ROM1")    -- a child value tree 
               local e = d:getChildByName("S1")      -- the sysex attached to the child                         
               console(String(""..e:toHexString(1)))
           end                                                                                                      
    • This reply was modified 1 month, 2 weeks ago by zeokazeoka.
    • This reply was modified 1 month, 2 weeks ago by zeokazeoka.
    • This reply was modified 1 month, 2 weeks ago by zeokazeoka.
    • This reply was modified 1 month, 2 weeks ago by zeokazeoka.
    #116597
    zeokazeoka
    Participant
    • Topics: 73
    • Replies: 466
    • Total: 539
    • ★★★

    local a seems not to be a file
    i tried a:AsFile() also ..

    #116598
    zeokazeoka
    Participant
    • Topics: 73
    • Replies: 466
    • Total: 539
    • ★★★

    i get the code

    const Image CtrlrPanelResourceManager::getResourceAsImage (const String &resourceName)
    
    {
    
    	CtrlrPanelResource *res = getResource (resourceName);
    
    	if (res != 0)
    
    	{
    
    		return (res->asImage());
    
    	}
    
    	return (Image::null);
    
    }
    
    const Font CtrlrPanelResourceManager::getResourceAsFont (const String &resourceName)
    
    {
    
        CtrlrPanelResource *res = getResource (resourceName);
    
    	if (res != 0)
    
    	{
    
    		return (res->asFont());
    
    	}
    
    	return (Font());
    
    }

    seems currently not possible to read xml via resources

    #116599
    zeokazeoka
    Participant
    • Topics: 73
    • Replies: 466
    • Total: 539
    • ★★★

    HEP HEP HEP AT LINE 373 : .def(“asXml”, &CtrlrPanelResource::asXml)
    tried a:asXml() but not works

    #116600
    zeokazeoka
    Participant
    • Topics: 73
    • Replies: 466
    • Total: 539
    • ★★★

    Nice !

    to save time.. if someone is interrested

      local a = resources:getResource("MySounds")        
      local b = a:asXml()                     
      local c = b:getNumChildElements() 
    --LUA>> 5 (int)   
      local e = b:getChildElement(4)
    --LUA>> Not Nil
      local f = e:getTagName()                                      
    --LUA>> ROM5 (string)
      local g = e:getAttributeValue(2)
    --LUA>> 7f 02 04 65 20 4d 75...(string)
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
There is currently 0 users and 23 guests online
No users are currently active
Forum Statistics
Threads: 2,275, Posts: 15,922, Members: 57,248
Most users ever online was 12 on January 22, 2019 3:47 pm
Do NOT follow this link or you will be banned from the site!