Support

Forums

Contact Me

Posts Tagged 'jxpath'

Make JXPATH 1.2 namespace aware

Some hours of hard work to find a workaround for this issue...I hope that it will help some of you
as this simple issue should be quite common.

Here is a sample xml that reveal the issue (sample.xml):

   1:  <?xml version="1.0" encoding="UTF-8"?>
   2:  <address xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   3:          xmlns="http://www.example.com/test"
   4:          xsi:schemaLocation="http://www.example.com/test sample.xsd">
   5:    <name>name</name>
   6:    <street>street</street>
   7:    <city>city</city>
   8:    <country>country</country>
   9:  </address>

A very simple XSD schema (sample.xsd)

   1:  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
   2:  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
   3:             targetNamespace="http://www.example.com/test" 
   4:             xmlns="http://www.example.com/test">
   5:      <xs:element name="address">
   6:          <xs:complexType>
   7:              <xs:sequence>
   8:                  <xs:element name="name" type="xs:string" />
   9:                  <xs:element name="street" type="xs:string" />
  10:                  <xs:element name="city" type="xs:string" />
  11:                  <xs:element name="country" type="xs:string" />
  12:              </xs:sequence>
  13:          </xs:complexType>
  14:      </xs:element>
  15:  </xs:schema>
Articles tagged

Read more: Make JXPATH 1.2 namespace aware

Donations

Thank You for supporting my work