Package org.apache.ws.jaxme.xs.parser

Examples of org.apache.ws.jaxme.xs.parser.XSContext


   *   {@link org.w3c.dom.Element}, or an instance of
   *   {@link org.w3c.dom.DocumentFragment}. In the latter case, make
   *   sure, that the fragment contains a single root element.
   */
  public XSSchema parse(Node pNode) throws SAXException {
    XSContext myData = getContext();
    parser.set(this);
    try {
      return newXSLogicalParser().parse(pNode);
    } finally {
      myData.setCurrentContentHandler(null);
      parser.set(null);
    }
  }
View Full Code Here


  protected void setSchema(XSSchema pSchema) {
    schema = pSchema;
  }
 
  protected XsESchema parseSyntax(Node pNode) throws SAXException {
    XSContext data = getData();
    try {
      XsObjectFactory factory = data.getXsObjectFactory();
      XsESchema mySchema = factory.newXsESchema();
      XsSAXParser xsSAXParser = factory.newXsSAXParser(mySchema);
      addSyntaxSchema(mySchema);
      try {
        data.setCurrentContentHandler(xsSAXParser);
        DOMSerializer ds = new DOMSerializer();
        ds.serialize(pNode, xsSAXParser);
        return (XsESchema) xsSAXParser.getBean();
      } finally {
        removeSyntaxSchema();
      }
    } finally {
      data.setCurrentContentHandler(null);
    }
  }
View Full Code Here

  }
 
  protected void parseSyntax(Locator pLocator, String pSchemaLocation,
      XsESchema pSchema)
  throws SAXException, IOException, ParserConfigurationException {
    XSContext data = getData();
    try {
      XsObjectFactory factory = data.getXsObjectFactory();
      XMLReader xr = factory.newXMLReader(isValidating());
      EntityResolver entityResolver = xr.getEntityResolver();
      InputSource schemaSource = null;
      if (entityResolver != null) {
        schemaSource = entityResolver.resolveEntity(null, pSchemaLocation);
      }
      if (schemaSource == null) {
        schemaSource = getInputSource(pLocator == null ? null : pLocator.getSystemId(),
            pSchemaLocation);
      }
     
      XsSAXParser xsSAXParser = factory.newXsSAXParser(pSchema);
      addSyntaxSchema(pSchema);
      try {
        data.setCurrentContentHandler(xsSAXParser);
        xr.setContentHandler(xsSAXParser);
        xr.parse(schemaSource);
      } finally {
        removeSyntaxSchema();
      }
    } finally {
      data.setCurrentContentHandler(null);
    }
  }
View Full Code Here

  /** <p>Redefines the given {@link XsRedefinable}.</p>
   */
  protected void redefine(XsESchema pSyntaxSchema,
      XsERedefine pRedefine, XsRedefinable pChild) throws SAXException {
    XSSchema mySchema = getSchema();
    XSContext data = getData();
    XSObjectFactory factory = data.getXSObjectFactory();
    if (pChild instanceof XsTAttributeGroup) {
      XsTAttributeGroup attributeGroup = (XsTAttributeGroup) pChild;
      mySchema.redefine(factory.newXSAttributeGroup(mySchema, attributeGroup));
    } else if (pChild instanceof XsTNamedGroup) {
      XsTNamedGroup group = (XsTNamedGroup) pChild;
View Full Code Here

  /** <p>Adds the given object to the schema.</p>
   *
   */
  protected void add(XsESchema pSyntaxSchema, Object pChild) throws SAXException {
    XSSchema mySchema = getSchema();
    XSContext data = getData();
    XSObjectFactory factory = data.getXSObjectFactory();
    if (pChild instanceof XsEAnnotation) {
      XsEAnnotation annotation = (XsEAnnotation) pChild;
      mySchema.add(factory.newXSAnnotation(mySchema, annotation));
    } else if (pChild instanceof XsETopLevelSimpleType) {
      XsETopLevelSimpleType type = (XsETopLevelSimpleType) pChild;
View Full Code Here

   * @see #getXSContentHandler()
   */
  public XSSchema parse(InputSource pSource)
  throws ParserConfigurationException, SAXException, IOException {
    XSContentHandler contentHandler = getXSContentHandler(pSource.getSystemId());
    XSContext data = getData();
    XMLReader xr = data.getXsObjectFactory().newXMLReader(isValidating());
    xr.setContentHandler(contentHandler);
    SchemaTransformer transformer = data.getXSObjectFactory().getSchemaTransformer();
    if (transformer != null) {
      transformer.parse(pSource, xr);
      pSource = transformer.getTransformedInputSource();
      xr = transformer.getTransformedXMLReader();
    }
View Full Code Here

    /** Sets the document locator.
     */
    public void setLocator(Locator pLocator) {
      locator = pLocator;
        XSContext context = getData();
        if (context != null) {
          context.setLocator(pLocator);
        }
    }
View Full Code Here

  private final String systemId;

  XSContentHandlerImpl(XSLogicalParser pParser, String pSystemId) throws SAXException {
    parser = pParser;
  systemId = pSystemId;
    XSContext data = parser.getData();
    data.setXSLogicalParser(parser);
    parser.clearSyntaxSchemas();
    XsObjectFactory factory = data.getXsObjectFactory();
    XsESchema mySchema = factory.newXsESchema();
    parser.setSchema(data.getXSObjectFactory().newXSSchema(data, mySchema));
    xsSAXParser = factory.newXsSAXParser(mySchema);
    parser.addSyntaxSchema(mySchema);
    data.setCurrentContentHandler(xsSAXParser);
  }
View Full Code Here

  public void endDocument() throws SAXException {
    xsSAXParser.endDocument();
    XsESchema syntaxSchema = (XsESchema) xsSAXParser.getBean();
    parser.removeSyntaxSchema();
    XSContext data = parser.getData();
    data.setCurrentContentHandler(null);

    try {
      parser.parse(syntaxSchema, systemId);
      XSSchema mySchema = parser.getSchema();
      parser.createSubstitutionGroups(mySchema);
View Full Code Here

    return result;
  }
 
  public XSParser newXSParser(SGFactory pController) throws SAXException {
    XSParser parser = new JAXBParser();
    XSContext context = parser.getContext();
    context.setXsObjectFactory(pController.newXsObjectFactory());
    context.setXSObjectFactory(pController.newXSObjectFactory());
    return parser;
  }
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.parser.XSContext

Copyright © 2018 www.massapicom. 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.