Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6381579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:24:43+00:00 2026-05-25T02:24:43+00:00

Does anyone know the solution for working with XML in Java that meets these

  • 0

Does anyone know the solution for working with XML in Java that meets these requirements?

  • Ability to fluently define XML schema (with no XSD)
  • Ability to work with XML data via Java standard types: if I say that this attribute of this tag is an integer, I’d like to be able to read and write it as int, without parsing and converting it to string manually.

The ideal solution is like this:

class MyXmlData { 
  @Bind("...xpath here...", Bind.Required)
  public Integer numberOfPersons; // required, integer

  @Bind("...xpath here...")
  public String title; // optional 
}

try { // throws, if required fields are not present
  MyXmlData data = MagicXml.read(MyXmlData.class, "1.xml");

  // at this point data.numberOfPersons is never null and
  // title may be null

  int myNumOfPersons = data.numberOfPersons; // here we go
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:24:44+00:00Added an answer on May 25, 2026 at 2:24 am

    Check out EclipseLink JAXB (MOXy). Our @XmlPath annotation is similar to the @Bind annotation that you are looking for:

    package blog.geocode;
    
    import javax.xml.bind.annotation.XmlRootElement;
    import javax.xml.bind.annotation.XmlType;
    
    import org.eclipse.persistence.oxm.annotations.XmlPath;
    
    @XmlRootElement(name="kml")
    @XmlType(propOrder={"country", "state", "city", "street", "postalCode"})
    public class Address {
    
        @XmlPath("Response/Placemark/ns:AddressDetails/ns:Country/ns:AdministrativeArea/ns:SubAdministrativeArea/ns:Locality/ns:Thoroughfare/ns:ThoroughfareName/text()")
        private String street;
    
        @XmlPath("Response/Placemark/ns:AddressDetails/ns:Country/ns:AdministrativeArea/ns:SubAdministrativeArea/ns:Locality/ns:LocalityName/text()")
        private String city;
    
        @XmlPath("Response/Placemark/ns:AddressDetails/ns:Country/ns:AdministrativeArea/ns:AdministrativeAreaName/text()")
        private String state;
    
        @XmlPath("Response/Placemark/ns:AddressDetails/ns:Country/ns:CountryNameCode/text()")
        private String country;
    
        @XmlPath("Response/Placemark/ns:AddressDetails/ns:Country/ns:AdministrativeArea/ns:SubAdministrativeArea/ns:Locality/ns:PostalCode/ns:PostalCodeNumber/text()")
        private String postalCode;
    
    }
    

    For More Information

    • http://blog.bdoughan.com/2010/07/xpath-based-mapping.html
    • http://blog.bdoughan.com/2010/09/xpath-based-mapping-geocode-example.html
    • http://blog.bdoughan.com/2011/03/map-to-element-based-on-attribute-value.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know a good solution for implementing a function similar to Ruby's timeout
Does anyone know of a solution to the following markup validation error? I'm not
Does anyone know how to move the Solution Explorer tab in Visual Studio 2005?
Does anyone know a cross-browser, reliable solution for catching presses of the tab-key in
Does anyone know of any reverse proxy solutions that allow the content/data of an
Does anyone know how to get IntelliSense to work reliably when working in C/C++
Does anyone know of a good Command Prompt replacement? I've tried bash/Cygwin, but that
Does anyone know of any existing packages or libraries that can be used to
Does anyone know if there is a framework out there that is able to
Does anyone know how to transform a enum value to a human readable value?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.