Hi Team,
We're looking for best practices for form development focused on performance and maintainability.
Created forms using XML Schema
XDP was mapped to this XML Schema
Used foundational components, not AF core components
DoR requirement: Used XDP for PDF generation
Forms are based on JSON Schema
XDP still uses XML Schema (since AEM Forms Designer only supports XML Schema)
We're uploading JSON Schema + XML Schema + XDP
Field names must match across all three for binding to work
Using AF core components for better performance
We’re considering using only JSON Schema and relying on bindRef (name-based binding) instead of uploading XML Schema.
However, since AEM Forms Designer (for XDP) doesn’t support JSON Schema, is this a feasible and reliable approach?
We’re generating the DoR using:
DoROptions dorOptions = new DoROptions();
Should we continue using JSON + XML Schema + XDP?
Or is it better to simplify and use JSON Schema + bindRef (name-based binding) only?
Thanks,
Vara
Views
Replies
Total Likes
Hi @varaande,
As you rightly pointed out, AEM Forms Designer does not support JSON Schema natively. It primarily relies on XML Schema Definitions (XSDs) for defining the structure of the form data. This poses a challenge if you are looking to use JSON Schema directly. Additionally the bindRef attribute allows for name-based binding, which can be useful when you want to map form data fields to a specific structure, such as a JSON object. However, this approach assumes that the structure is predefined and consistent across form instances. Since AEM Forms Designer relies on XSD for schema definitions, using bindRef without an underlying XML Schema may not be straightforward.
One feasible approach is to create a transformation layer that converts JSON data into an XML format that AEM Forms Designer can understand. This could involve converting your JSON Schema into an equivalent XSD manually or through a custom utility, and ensuring that the JSON data is transformed into XML before being processed by AEM Forms.
Deciding between continuing with your current setup of using JSON + XML Schema + XDP versus simplifying to using JSON Schema + bindRef (name-based binding) only requires a careful analysis of your project's needs, resources, and future scalability.
Compatibility: AEM Forms Designer natively supports XML Schema, making this approach more compatible with existing tools and features.
Stability: This method is well-tested and widely used in enterprise environments, providing a more stable and predictable setup.
Rich Feature Set: XDPs (XML Data Packages) support a wide array of features for dynamic forms, such as scripting and layout flexibility, which are directly integrated with XML Schemas.
Integration: XML Schemas allow for better integration with other systems that may also rely on XML, offering a uniform approach to data handling.
Complexity: Managing both XML and JSON can introduce complexity, especially in maintaining and synchronizing data transformations.
Overhead: The need to convert JSON data to XML format adds additional processing steps, which could be a source of potential errors.
Simplicity: Using JSON Schema simplifies the data model, especially if your system is predominantly JSON-based, reducing the need for data transformation layers.
Modern Approach: JSON is often more lightweight and easier to handle in modern web applications, which may improve performance and reduce latency.
Ease of Use: JSON is generally easier to read and write, which can simplify development and debugging processes.
Lack of Native Support: AEM Forms Designer does not natively support JSON Schema, which could require custom development or middleware to handle data binding and transformation.
Potential for Errors: Without native tooling support, the risk of errors or inconsistencies in data handling increases.
Limited Functionality: You may not be able to leverage some of the advanced features provided by XDPs and XML Schemas.
Suppose your current setup with JSON + XML Schema + XDP works well and meets your business requirements without significant performance issues or maintenance overhead, it may be wise to continue with this approach. It offers stability and compatibility with AEM Forms Designer. Also, If you anticipate a shift towards more JSON-centric architectures, or if you are developing new systems where JSON is predominantly used, exploring the JSON Schema + bindRef approach could be beneficial in the long term.
Thanks
Pranay
Views
Replies
Total Likes
I tried using JSON Schema with bindRef, but it's not working, even though the JSON schema hierarchy and the XDP structure have matching field names. Could you provide some recommendations or clarify how bindRef works with JSON Schema, especially to avoid relying on XML mapping?
Views
Replies
Total Likes