Examples of validateAgainst()


Examples of org.codehaus.stax2.XMLStreamReader2.validateAgainst()

        throws XMLStreamException
    {
        String XML = "<root attr='123'><leaf /></root>";
        XMLValidationSchema schema = parseDTDSchema(SIMPLE_DTD);
        XMLStreamReader2 sr = getReader(XML);
        sr.validateAgainst(schema);
        while (sr.next() != END_DOCUMENT) { }
        sr.close();
    }

    /**
 
View Full Code Here

Examples of org.codehaus.stax2.XMLStreamReader2.validateAgainst()

    {
        String XML = "<root attr='123'><leaf /></root>";
        XMLValidationSchema schema = parseDTDSchema(SIMPLE_DTD);
        XMLStreamReader2 sr = getReader(XML);
        assertTokenType(START_ELEMENT, sr.next());
        sr.validateAgainst(schema);
        while (sr.next() != END_DOCUMENT) { }
        sr.close();
    }

    /*
 
View Full Code Here

Examples of org.codehaus.stax2.XMLStreamReader2.validateAgainst()

+"</xs:schema>");
        XMLStreamReader2 sr = getReader("<ns11:Root xmlns:ns11='http://MySchema'>"
            +"<ns11:Child xsi:type='ns11:ChildInst' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>"
            +"</ns11:Child>"
            +"</ns11:Root>");
        sr.validateAgainst(schema);
       
        try {
            assertTokenType(START_ELEMENT, sr.next());
            assertEquals("Root", sr.getLocalName());
            assertTokenType(START_ELEMENT, sr.next());
View Full Code Here

Examples of org.codehaus.stax2.XMLStreamReader2.validateAgainst()

    QName msgQName = new QName("http://server.hw.demo/", "sayHi");
    while (true) {
      int what = reader.nextTag();
      if (what == XMLStreamConstants.START_ELEMENT) {
        if (reader.getName().equals(msgQName)) {
          reader.validateAgainst(schema);
        }
      } else if (what == XMLStreamConstants.END_ELEMENT) {
        if (reader.getName().equals(msgQName)) {
          reader.stopValidatingAgainst(schema);
        }
View Full Code Here

Examples of org.codehaus.stax2.XMLStreamReader2.validateAgainst()

   
    protected void verifyFailure(String xml, XMLValidationSchema schema, String failMsg,
                                 String failPhrase, boolean strict) throws XMLStreamException
    {
        XMLStreamReader2 sr = constructStreamReader(getInputFactory(), xml);
        sr.validateAgainst(schema);
        try {
            while (sr.hasNext()) {
                /* int type = */sr.next();
            }
            fail("Expected validity exception for " + failMsg);
View Full Code Here

Examples of org.codehaus.stax2.XMLStreamReader2.validateAgainst()

            public void reportProblem(XMLValidationProblem problem) throws XMLValidationException {
                throw new Fault(new Message("READ_VALIDATION_ERROR", LOG, problem.getMessage()),
                                Fault.FAULT_CODE_CLIENT);
            }
        });
        reader2.validateAgainst(vs);
        return true;
    }

    public boolean setupValidation(XMLStreamWriter writer, Endpoint endpoint, ServiceInfo serviceInfo)
        throws XMLStreamException {
View Full Code Here

Examples of org.codehaus.stax2.XMLStreamReader2.validateAgainst()

        if (effectiveReader instanceof DepthXMLStreamReader) {
            effectiveReader = ((DepthXMLStreamReader)reader).getReader();
        }
        final XMLStreamReader2 reader2 = (XMLStreamReader2)effectiveReader;
        XMLValidationSchema vs = getValidator(serviceInfo);
        reader2.validateAgainst(vs);
    }

    public void setupValidation(XMLStreamWriter writer, ServiceInfo serviceInfo) throws XMLStreamException {
        XMLStreamWriter2 writer2 = (XMLStreamWriter2)writer;
        XMLValidationSchema vs = getValidator(serviceInfo);
View Full Code Here

Examples of org.codehaus.stax2.XMLStreamReader2.validateAgainst()

            public void reportProblem(XMLValidationProblem problem) throws XMLValidationException {
                throw new Fault(new Message("READ_VALIDATION_ERROR", LOG, problem.getMessage()),
                                Fault.FAULT_CODE_CLIENT);
            }
        });
        reader2.validateAgainst(vs);
        return true;
    }

    public boolean setupValidation(XMLStreamWriter writer, Endpoint endpoint, ServiceInfo serviceInfo)
        throws XMLStreamException {
View Full Code Here

Examples of org.codehaus.stax2.XMLStreamReader2.validateAgainst()

public class XmlStreamReaderFactory {
  private static final XMLInputFactory2 inputFactory = new WstxInputFactory();
 
  public static XMLStreamReader2 createReader(Reader fileReader, XMLValidationSchema xmlSchema) throws XMLStreamException {
    XMLStreamReader2 streamReader = (XMLStreamReader2) inputFactory.createXMLStreamReader(fileReader);
    streamReader.validateAgainst(xmlSchema);
   
    return streamReader;
  }
}
View Full Code Here

Examples of org.codehaus.stax2.XMLStreamReader2.validateAgainst()

        if (reader instanceof DepthXMLStreamReader) {
            reader = ((DepthXMLStreamReader)reader).getReader();
        }
        XMLStreamReader2 reader2 = (XMLStreamReader2)reader;
        XMLValidationSchema vs = getValidator(schemas);
        reader2.validateAgainst(vs);


    }
   
    private Reader getSchemaAsStream(DOMSource source) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.