E4X: grab nodes with namespaces?

后端 未结 3 1642
慢半拍i
慢半拍i 2020-12-18 09:49

I want to learn how to process XML with namespaces in E4X so basically here is what I want to learn, say I have some XML like this:



        
3条回答
  •  南方客
    南方客 (楼主)
    2020-12-18 10:40

    If you have a XML that contains multiple names but you don't care about the namespaces when getting values from the XML you can do the following....

    Example XML

    
      Printed Material
      
        
          James
          Smith
        
        The Book Title
      
     
    

    You could get any item regardless of namespace like this

    var itemType:String = xml.*::ItemType;
    var bookISBN:Number = xml.*::Book.@isbn;
    var bookTitle:String = xml.*::Book.Title;
    

提交回复
热议问题