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
    zeoka
    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 4 years, 4 months ago by zeoka.
      • This topic was modified 4 years, 4 months ago by zeoka.
      #116592
      zeoka
      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 4 years, 4 months ago by zeoka.
        • This reply was modified 4 years, 4 months ago by zeoka.
        • This reply was modified 4 years, 4 months ago by zeoka.
        • This reply was modified 4 years, 4 months ago by zeoka.
        #116597
        zeoka
        Participant
          • Topics: 73
          • Replies: 466
          • Total: 539
          • ★★★

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

          #116598
          zeoka
          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
            zeoka
            Participant
              • Topics: 73
              • Replies: 466
              • Total: 539
              • ★★★

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

              #116600
              zeoka
              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)
              • The forum ‘Programming’ is closed to new topics and replies.
              There is currently 0 users and 106 guests online
              No users are currently active
              Forum Statistics
              Threads: 2,495, Posts: 17,374, Members: 77,605
              Most users ever online was 12 on January 22, 2019 3:47 pm
              Ctrlr