code_junkie

XML namespaces and attributes

Nov 10th, 2011
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. <bar xmlns:foo="http://www.foo.com/"
  2. foo:baz="baz"
  3. qux="qux"/>
  4. <bar xmlns="http://www.foo.com/" xmlns:foo="http://www.foo.com/"
  5. foo:baz="baz"
  6. qux="qux"/>
  7. <foo:bar xmlns="http://www.foo.com/" xmlns:foo="http://www.foo.com/"
  8. foo:baz="baz"
  9. qux="qux"/>
  10.  
  11. <{}bar
  12. {http://www.foo.com/}baz="baz"
  13. {}qux="qux"/>
  14. <{http://www.foo.com/}bar
  15. {http://www.foo.com/}baz="baz"
  16. {}qux="qux"/>
  17. <{http://www.foo.com/}bar
  18. {http://www.foo.com/}baz="baz"
  19. {}qux="qux"/>
  20.  
  21. <?xml version="1.0" encoding="utf-8"?>
  22. <xs:schema xmlns="http://schemas.mycompany.com/Customer/V1"
  23. targetNamespace="http://schemas.mycompany.com/Customer/V1"
  24. xmlns:xs="http://www.w3.org/2001/XMLSchema">
  25.  
  26. <xs:attribute name="Id" type="xs:positiveInteger"/>
  27.  
  28. <xs:element name="Customer">
  29. <xs:complexType>
  30. <xs:attribute ref="Id" use="required"/>
  31. <!-- some elements here -->
  32. </xs:complexType>
  33. </xs:element>
  34.  
  35. <?xml version="1.0" encoding="utf-8"?>
  36. <Customer Id="1" xmlns="http://schemas.mycompany.com/Customer/V1">
  37. <!-- ... other elements here -->
  38. </Customer>
  39.  
  40. <?xml version="1.0" encoding="utf-8"?>
  41. <Customer cus:Id="1" xmlns="http://schemas.mycompany.com/Customer/V1"
  42. xmlns:cus="http://schemas.mycompany.com/Customer/V1">
  43. <!-- ... other elements here -->
  44. </Customer>
  45.  
  46. <xs:element name="Customer">
  47. <xs:complexType>
  48. <xs:attribute name="Id" type="xs:positiveInteger" use="required"/>
  49. <!-- some elements here -->
  50. </xs:complexType>
  51. </xs:element>
Add Comment
Please, Sign In to add comment